BS2 BOE Walker
Carol Hazlett
Posts: 312
This is a basic walker based on the old Milford Instruments Stampbug from the early 1990's. It is built using the Minds-i building system (mymindsi.com) and a BOE. The BOE may be a bit of overkill but I have a stash of them so I used what was readily available. Here is the code for it:
You can see videos of this project on facebook.com/Robothon or facebook.com/CarolLynnHazlett.
' {$STAMP BS2}
' {$PBASIC 2.5}
' Program for Minds-i walking robot. Designed and constructed by
' Carol Lynn Hazlett on Dec. 2, 2012.
' -----[ Variables ]----------------------------------------------------------
irDetectLeft VAR Bit ' Variable to store IR detection value
irDetectRight VAR Bit ' Variable to store IR detection value
counter VAR Word ' Variable for walking speed counter
reps VAR Nib ' Variable for repitions of steps
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000 ' Send pulse to piezo speaker
' -----[ Main Routine ]-------------------------------------------------------
DO
FREQOUT 8, 1, 38500 ' Store IR detection values in
irDetectLeft = IN9 ' bit variables.
FREQOUT 2, 1, 38500 ' Store IR detection values in
irDetectRight = IN0 ' bit variables
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN ' Both detects
HIGH 10 ' Turn on left LED
HIGH 1 ' Turn on right LED
GOSUB BackWalk ' Back up
GOSUB LeftTurnBack ' U-turn (left twice)
GOSUB LeftTurnBack
ELSEIF (irDetectLeft = 0) THEN ' Left detects
HIGH 10 ' Turn on left LED
GOSUB BackWalk ' Back up
GOSUB LeftTurnBack ' Turn left
ELSEIF (irDetectRight = 0) THEN ' Right detects
HIGH 1 ' Turn on right LED
GOSUB BackWalk ' Back up
GOSUB RightTurnBack ' Turn right
ELSE ' None detect
LOW 10 ' Turn off left LED
LOW 1 ' Turn off right LED
GOSUB ForwardWalk ' Walk forward
ENDIF ' and check again
LOOP
'-----[Subroutines]------------------------------------------------------
BackWalk:
FOR reps = 1 TO 5 ' Repeats steps 5 times
FOR counter=1 TO 20 ' Determines speed of walk
PULSOUT 14, 850 ' Left side of middle leg goes down
PULSOUT 13, 1100 ' Right legs swing forward
PULSOUT 12, 1000 ' Left legs swing backward
PAUSE 20 ' Pause for servo signal
NEXT
FOR counter=1 TO 20 ' Determines speed of walk
PULSOUT 14, 700 ' Right side of middle leg swings down
PULSOUT 13, 450 ' Right legs swing backwards
PULSOUT 12, 400 ' Left legs swing forward
PAUSE 20 ' Pause for servo signal
NEXT
NEXT
RETURN
LeftTurnBack:
FOR reps = 1 TO 12 ' How many times steps repeat
FOR counter=1 TO 20 ' Determines the speed of walk
PULSOUT 14, 700 ' Left side of middle leg goes down
PULSOUT 12, 1000 ' Left legs swing backwards
PAUSE 20
NEXT
FOR counter=1 TO 20 ' Determines speed of walk
PULSOUT 12, 400 ' Left leg swings forward
PAUSE 20 ' Pause for servo signal
NEXT
NEXT
RETURN
RightTurnBack:
FOR reps = 1 TO 12 ' Number of times step repeats
FOR counter=1 TO 20 ' Determines speed of walk
PULSOUT 14, 850 ' Right side of middle legs goes down
PULSOUT 13, 450 ' Right legs swing backwards
PAUSE 20 ' Pause for servo signal
NEXT
FOR counter=1 TO 20 ' Determines speed of walk
PULSOUT 13, 1100 ' Right legs swing forward
PAUSE 20 ' Pause for servo signal
NEXT
NEXT
RETURN
ForwardWalk:
FOR counter = 1 TO 20 ' Determines speed of walk
PULSOUT 14, 700 ' Right side of middle leg goes down
PULSOUT 13, 1100 ' Right legs swing forward
PULSOUT 12, 1000 ' Left legs swing backwards
PAUSE 20 ' Pause for servo signal
NEXT
FOR counter = 1 TO 20 ' Determines speed of walk
PULSOUT 14, 850 ' Left side of middle leg goes down
PULSOUT 13, 450 ' Right leg swings backwards
PULSOUT 12, 400 ' Left leg swings forward
PAUSE 20 ' Pause for servo signal
NEXT
RETURN
You can see videos of this project on facebook.com/Robothon or facebook.com/CarolLynnHazlett.



Comments
Id like to see a video of this, looks like a neat little bot!