Robot autonome

  • il y a 16 ans
Voilà le robot programmé en basic :

' Robotics with the Boe-Bot - ForwardLeftRightBackward.bs2
' Move forward, left, right, then backward for testing and tuning.

' {$STAMP BS2}
' {$PBASIC 2.5}

DEBUG "Program Running!"

counter VAR Word

FREQOUT 4, 2000, 3000 ' Signal program start/reset

FOR counter = 1 TO 64 ' Forward
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT

PAUSE 200
FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT

PAUSE 200
FOR counter = 1 TO 24 ' Rotate right - about 1/4 turn
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT

PAUSE 200
FOR counter = 1 TO 64 ' Backward
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT

END

Recommandations