Bo-bot

An autonomous Bo-bot coded and designed by Mireu Seo

“I want to put a ding in the universe.”
-Steve Jobs

“Computers themselves, and software yet to be developed, will revolutionize the way we learn.”
-Steve Jobs

“Stay hungry, stay foolish.”
-Steve Jobs

“Innovation distinguishes between a leader and a follower.”
-Steve Jobs

“Design is not just what it looks like and feels like. Design is how it works.”
-Steve Jobs


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

' final-bo-bot-code.bs2

DEBUG "Programming Running!"
irDetectLEft VAR Bit
irDetectRight VAR Bit
pulseLEft VAR Word
pulseRight VAR Word
pulseCount VAR Byte


FREQOUT 4, 2000, 3000

DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0

IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
    FOR pulseCount = 0 TO 15
    PULSOUT 13, 650
    PULSOUT 12, 850
    GOSUB turn_right
    PAUSE 50
NEXT

ELSEIF (irDetectLeft = 0) THEN
    pulseLeft = 850
    pulseRight = 850
    PAUSE 50
ELSEIF (irDetectRight = 0) THEN
    pulseLeft = 650
    pulseRight = 650
    PAUSE 50
ELSE
    pulseLeft = 850
    pulseRight = 650
ENDIF

IF (irDetectLeft = 0) THEN
    HIGH 10
    PAUSE 10
ELSEIF (irDetectRight = 0) THEN
    HIGH 1
    PAUSE 10
ELSEIF (irDetectRight = 0) AND (irDetectLeft = 0) THEN
    HIGH 10
    HIGH 1
    PAUSE 1000
ELSE
    LOW 10
    LOW 1
ENDIF

    PULSOUT 13, pulseLeft
    PULSOUT 12, pulseRight
    PAUSE 15
LOOP



'----Subroutines

forward_pulse:
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
RETURN

turn_left:
FOR pulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
RETURN

turn_right:
FOR pulseCount = 0 TO 20
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN


back_up:
FOR pulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN


							
							

Hi! I'm Mireu

I'm the author of this blog. Thank you for reading.