Presentation is loading. Please wait.

Presentation is loading. Please wait.

PROMGRAMING YOUR ROBOT

Similar presentations


Presentation on theme: "PROMGRAMING YOUR ROBOT"— Presentation transcript:

1 PROMGRAMING YOUR ROBOT
Controlling Distance 9/21/2018 1

2 Loops Infinite loops Finite loops Doesn’t know when to stop
Can’t get out of the loop Finite loops Defined start and stop time For… next commands to specify the number of times to execute the loop 9/21/2018

3 Example Code ‘ ------Declarations -----
pulse_count var word ‘Declare a variable for counting LOW 12 ‘reset ports LOW 13 ' ---- Main routine ----- main: forward: ' Forward routine FOR pulse_count = 1 TO 100 ' Loop that sends 100 forward-move pulses PULSOUT 12, 500 '1.0 ms pulse to right servo PULSOUT 13, 1000 '2.0 ms pulse to left servo PAUSE 20 pause for 20 millisecond (20 ms) NEXT STOP ‘stop until the reset button is pressed 9/21/2018

4 Variable Declaration 9/21/2018

5 Now Your Turn Make the robot go backwards and then stop
Make the robot go forward, pause, and then backwards, and stop 9/21/2018

6 Distance Calculation Circumference of the Boe-Bot wheel:
π* wheel diameter = * 6.67 cm » 21 cm. We need 21cm for one complete turn At full speed, the servos turn at 37.5rpm or rev/sec 21 cm/revolution * revolutions/sec = cm/s. The time it takes to make the Boe-Bot travel 50 cm is ; ttravel = 50 cm/ cm/s » 3.81 seconds Since the pulse and pause periods are known, the time it takes for a single loop can be calculated: tloop = 1.0 ms ms + 20 ms = 23 ms Left and right wheels Pause 9/21/2018


Download ppt "PROMGRAMING YOUR ROBOT"

Similar presentations


Ads by Google