Mini Maestro programming script

Hi

I am still new to programming script, and I am not a programming.
Can someone help me convert this simple c# to script for masestro.
I try reading the manual, but this is as far I can go.
ANyway, thank in advance

[code]int tempCounter=1;
private void AnalogPositionTest() {

if (analogSensor3 >= 500) {

if (tempCounter == 1) {
servo(1, 500, 50, false);
tempCounter= 2;
}
else if (tempCounter == 2) {
servo(1, 1000, 50, false);
tempCounter= 3;
}
else if (tempCounter == 3) {
servo(1, 2000, 50, false);
tempCounter= 1;
}

}
}
[/code]************
now script???

begin 3 get_position 500 greater_than if 2000 1 servo ??? 4000 1 servo ??? 8000 0 servo ??? repeat

Hello.

You might try something like this:

begin
  # Put servo position on stack
  # Then call frame subroutine
  2000 frame
  4000 frame
  8000 frame
repeat

sub frame
  begin
    3 get_position		# Get analog sensor value
    499 greater_than	# Compare value >= 500
    if
      # Move servo 1 to position value on the stack
      1 servo
      return			# Go back to return address
    endif
  repeat

The Maestro scripting language is similar to the stack-based programming language called FORTH, so you might try searching for more in-depth documentation on FORTH to get a better understanding of the Maestro scripting language.

Also, you might find it useful to use the “Step Script” button in the “Script” tab of the Maestro Control Center. The Step Script feature can be used to step through your script line by line so that you can see what happens at every step.

Also, we added code tags ([ code ] [ /code ] - without spaces) to your post; please use this method when posting code in the future.

- Amanda