Home AMX User Forum NetLinx Studio

Sony Camera Presets

I am trying to write code that will allow me to store presets for a Sony Camera. I would like to touch Preset then touch Preset 1,2, or 3 and it would then store the Preset to that number. Below is the code I am trying to use but I have errors. Thanks for any help.

Define Vars
ncampreset1 // button 109
ncampreset2 // button 110
ncampreset3 // buton 111

ncamsetpre // button 112

Program:

BUTTON_EVENT[dvTP,112]
{
PUSH:
{
If ncamsetpre = ncampreset1 // FIRST ERROR
send_string dvCam,"$81,$01,$04,$3f,$01,$00,$ff"
}
{
Else if ncamsetpre = ncampreset2
send_string dvCam,"$81,$01,$04,$3f,$01,$01,$ff"
}
{
else ncamsetpre = ncampreset3
send_string dvCam,"$81,$01,$04,$3f,$01,$02,$ff"
}
}


[dvTP,109] = ncampreset1
[dvTP,110] = ncampreset2
[dvTP,111] = ncampreset3
[dvTP,112] = ncamsetpre

Comments

  • Chip MoodyChip Moody Posts: 727
    The expression you're testing for true/false needs to be in parenthesis.
    IF (this = that)
    {
      // this runs if this equals that
    }
    
    In NL Studio, Help -> Netlinx Keywords is an INVALUABLE source of information that may have helped you out in the the space of time it took for you to post that.

    You're also not showing us where values get assigned to variables, but your feedback statements probably aren't going to do what you want. If you want button 109 to light up when ncamsetpre equeals ncampreset1, you want this:
    [dvTP,109] = (ncamsetpre = ncampreset1)  
                    // kind of an implied IF - if the values are equal, light up the button
    

    The way you have it in your example, button 109 would light up any time the variable ncampreset1 was equal to anything but zero.

    Also - you do know that there are existing modules for a lot of equipment - including Sony cameras, right? I'm not going to knock you for doing it the way you've started, 'cos you'll learn a lot, but if you just want to get a camera up & running for a job, you might want to look into getting the module...

    - Chip
  • David_wDavid_w Posts: 23
    Thanks

    Thanks Chip, I do know there are module. I am just trying to teach myself how to code in AMX. Trying to get myself to think in same logic format. Since I doing this for fun right now, I can take my time and try new stuff while getting help from others. Thank you so much for your help.
  • Chip MoodyChip Moody Posts: 727
    I suspected that was the case. Good luck, & Rock 'n roll!

    - Chip

    David_w wrote:
    Thanks Chip, I do know there are module. I am just trying to teach myself how to code in AMX. Trying to get myself to think in same logic format.
  • GSLogicGSLogic Posts: 562
    David_w wrote:
    I am just trying to teach myself how to code in AMX. Trying to get myself to think in same logic format.
    Try this!
    DEFINE_CONSTANT
      INTEGER btCamStore    =  10;
      INTEGER btCamPreset[] =  { 11,12,13 };
    
    DEFINE_VARIABLE
      INTEGER nCamSelected;
      INTEGER nStorePre;
    
      
    //###########################################################
    BUTTON_EVENT[dvTP_Cams, btCamStore]
    {
      PUSH: nStorePre = 1;
    }
    
    //###########################################################
    BUTTON_EVENT[dvTP_Cams, btAudienceCam]
    {
      PUSH:
      {
    	nCamSelected = get_last(btAudienceCam);
    	
    	(* Send Preset *)
    	if(nStorePre == 0)
    	{
    	  send_string dvSonCam, "$81,$01,$04,$3F,$02, nCamSelected-1 ,$FF";
    	}
    	(* Store Preset *)
    	else
    	{
    	  send_string dvSonCam, "$81,$01,$04,$3F,$01, nCamSelected-1 ,$FF";				
    	  nStorePre = 0;
    	}
      }
    }
    
    
    DEFINE_PROGRAM
    [dvTP,btCamPreset[1]] = (nCamSelected == 1)
    [dvTP,btCamPreset[2]] = (nCamSelected == 2)
    [dvTP,btCamPreset[3]] = (nCamSelected == 3)
    
Sign In or Register to comment.