I keeping getting a error saying REPEAT must end a BEGIN…REPEAT block
BEGIN
# Set the initial position of the servo to 0
setTarget(0, 0)
# Loop forever
while (1) {
# Read the state of the switches
pin4State = getPosition(4)
pin5State = getPosition(5)
# Check if pin 4 is on (active)
if (pin4State > 0) {
# Turn the servo left
setTarget(0, 900)
}
# Check if pin 5 is on (active)
else if (pin5State > 0) {
# Turn the servo right
setTarget(0, 2000)
}
else {
# If neither switch is on, return the servo to position 0
setTarget(0, 0)
}
# Wait a short time before checking again
sleep(10)
}
REPEAT
I have zero idea why I am getting this error. any help would be much appreciated
yes, apologies for being vague. simple single servo on pin 0, pin 4 and pin 5 when HIGH turn the servo left to right on a 3 way switch. when the switch is in natural the servo should go back to zero. the project is a hydraulic bi-directional ram being controlled by a switch at a safe distance
thank you for the help.
Are you using one of our Maestro servo controllers? It looks like your code is written mostly in C (or some C variant); if that code is supposed to be a Maestro script, please note that the Maestro scripting language is a stack-based language very similar to FORTH (which is very different from C). I recommend reviewing “The Maestro Scripting Language” section of the Maestro user’s guide to get a better understanding of it.