Bravia
Ireland
Asked
— Edited
This Script may be of interest to anyone setting up the Pololu ir Beacon with EZ-B while I control 2 servo motors it should be easy to adapt to a movement panel
:forward SLEEP(10) IF (GETDIGITAL(D11)=0) servo(d0, 48) GOTO(forward) ELSEIF (GETDIGITAL(D11)=1) SERVO(D0, 54) ENDIF :reverse IF (GETDIGITAL(D13)=0) SERVO(D0, 62) GOTO(REVERSE) ELSEIF (GETDIGITAL(D13)=1) SERVO(D0, 54) SLEEP(10) ENDIF :Turnleft SLEEP(10) IF (GETDIGITAL(D12)=0) SERVO(D1, 50) GOTO(TURNLEFT) ELSEIF (GETDIGITAL(D12)=1) SERVO(D1, 45) SLEEP(10) ENDIF :TURNRIGHT IF (GETDIGITAL(D14)=0) SERVO(D1, 38) GOTO(TURNRIGHT) ELSEIF (GETDIGITAL(D14)=1) SERVO(D1,45) ENDIF GOTO(FORWARD)
@Rich, thanks for you help
Not a problem, I'm happy to help. Your posts inspired my next scripting tutorial idea - the If command and all of it's conditions.
By the way if you use the code tag in your posts
use the word code inside square brackets.
Also, you can use just an ELSE rather than ELSEIF. I know I used ELSEIF in my first example to you, both ways work but ELSE is less typing
I wondered what it was for and have to admit I'm still not entirely sure what it does (well, I know what it does I don't know the why). It'll loop around forward until a status chance, then look around reverse etc. Is that what it is meant to do?
As for adapting for a movement panel, just use the commands Forward([speed], [milliSeconds]) Reverse([speed], [milliSeconds]) Left([speed], [milliSeconds]) Right([speed], [milliSeconds])
(Would need a Movement Panel set up in ARC otherwise it doesn't know what to move)
Using it as a test for locating battery charger
I us two servos to operate a joystick of a motorised wheelchair this script allows me to walk off with the second beacon and the robot will then follow me. Hide the Beacon and it will stop.