Wednesday, September 19, 2007

prototype two




This is our first attempt at getting our micro controller to record behaviors.





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

' check if a button is pressed page 78 of text

check VAR Byte
learn VAR Byte
playBack VAR Byte
checkTwo VAR Byte
counter VAR Byte
counterTwo VAR Byte(20)

DO

DEBUG ? IN3
DEBUG ? IN10
PAUSE 250
check = IN3
checkTwo = IN10

IF check = 0 THEN

FOR learn = 0 TO 19
DEBUG ? IN10
PAUSE 650
DEBUG ? checkTwo

IF IN10 = 0 THEN
DEBUG "shit"
counterTwo(learn) = 1
ELSE
counterTwo(learn) = 0
ENDIF
DEBUG ? counter


NEXT



ENDIF


FOR playBack = 0 TO 19
DEBUG ? counterTwo(playBack)
IF counterTwo(playBack) = 1 THEN
HIGH 14
PAUSE 500
ELSE
LOW 14
PAUSE 500
ENDIF
NEXT


LOOP

Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?