My Boe Bot is afraid of the dark
I'm trying to do the flashlight follower Boe Bot and have had pretty good success. It works perfectly in all conditions except very dark. It still works when it's very dark, but it gets "jittery". It still responds to the light correctly, but it jitters and vibrates and when going straight only goes at about half speed.
I took a look at the capacitor discharge times in a very dark room, and those don't exceed 65535. I tried different size capacitors and that didn't help.
I tinkered with the Pause 20 for the servo signal and that didn't help.
Here is my code:
' {$STAMP BS2}
' {$PBASIC 2.5}
Rdisch VAR Word
Ldisch VAR Word
diff VAR Word
counter VAR Word
right PIN 12
left PIN 13
Reye PIN 1
Leye PIN 0
DO
HIGH Reye
HIGH Leye
PAUSE 1
RCTIME Reye, 1, Rdisch
RCTIME Leye, 1, Ldisch
diff = (Rdisch + Ldisch) / 12
IF (Ldisch > (Rdisch + diff)) THEN
GOSUB RotR
' DEBUG HOME, "Going.Right.............", CR
ELSEIF (Rdisch > (Ldisch + diff)) THEN
GOSUB RotL
' DEBUG HOME, "Going.Left...............", CR
ELSE
GOSUB Gostr8
' DEBUG HOME, "Else.Condition.Happening.Going.Straight..........", CR
ENDIF
PAUSE 15
DEBUG HOME, "diff = ", DEC5 diff, CR
DEBUG "Rdisch = ", DEC5 Rdisch, CR
DEBUG "Ldisch = ", DEC5 Ldisch, CR
LOOP
'
SubRoutines
Gostr8:
FOR counter = 1 TO 5
PULSOUT right, 650
PULSOUT left, 850
NEXT
RETURN
RotR:
FOR counter = 1 TO 5
PULSOUT right, 800
PULSOUT left, 800
NEXT
RETURN
RotL:
FOR counter = 1 TO 5
PULSOUT right, 700
PULSOUT left, 700
NEXT
RETURN
Thanks for any suggestions
I took a look at the capacitor discharge times in a very dark room, and those don't exceed 65535. I tried different size capacitors and that didn't help.
I tinkered with the Pause 20 for the servo signal and that didn't help.
Here is my code:
' {$STAMP BS2}
' {$PBASIC 2.5}
Rdisch VAR Word
Ldisch VAR Word
diff VAR Word
counter VAR Word
right PIN 12
left PIN 13
Reye PIN 1
Leye PIN 0
DO
HIGH Reye
HIGH Leye
PAUSE 1
RCTIME Reye, 1, Rdisch
RCTIME Leye, 1, Ldisch
diff = (Rdisch + Ldisch) / 12
IF (Ldisch > (Rdisch + diff)) THEN
GOSUB RotR
' DEBUG HOME, "Going.Right.............", CR
ELSEIF (Rdisch > (Ldisch + diff)) THEN
GOSUB RotL
' DEBUG HOME, "Going.Left...............", CR
ELSE
GOSUB Gostr8
' DEBUG HOME, "Else.Condition.Happening.Going.Straight..........", CR
ENDIF
PAUSE 15
DEBUG HOME, "diff = ", DEC5 diff, CR
DEBUG "Rdisch = ", DEC5 Rdisch, CR
DEBUG "Ldisch = ", DEC5 Ldisch, CR
LOOP
'
SubRoutines
Gostr8:
FOR counter = 1 TO 5
PULSOUT right, 650
PULSOUT left, 850
NEXT
RETURN
RotR:
FOR counter = 1 TO 5
PULSOUT right, 800
PULSOUT left, 800
NEXT
RETURN
RotL:
FOR counter = 1 TO 5
PULSOUT right, 700
PULSOUT left, 700
NEXT
RETURN
Thanks for any suggestions
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support