quick help writing a real short program for a sharp 120 object detector
lobo
Posts: 100
the sharp is on pin 15 and using a lm339, basic stamp 2 on the boe-bot and servos are connected to port 12,13. i would like the debug to remain just so when boe is connected i can see or verify the the sensor are working. what can i do to cause the servo to react when the sensor sees something? I just need something quick and basic for i am a beginner. thank you.
according to the 123 project for the evil genius
'IR Proximity Dectector-Monitor Sharp GD2D120 Proximity Detector Output
'{$STAMP BS2}
' {$PBASIC 2.5}
' IR Proximity Detector - Monitor Sharp GD2D120 Proximity Detector OUTPUT
'Variables
Whisker PIN 15
Flag··· VAR Bit
' Initialization
·Flag=0
· DO
··· IF (Whisker = 0 ) AND (Flag = 0) THEN
····· Flag = 1: DEBUG "Ouch, collision",
······
··CR
····· ELSE
··· ' When Whisker Released, Reset
······· IF (Whisker = 1) THEN Flag = 0
······· ENDIF
······· LOOP
·
according to the 123 project for the evil genius
'IR Proximity Dectector-Monitor Sharp GD2D120 Proximity Detector Output
'{$STAMP BS2}
' {$PBASIC 2.5}
' IR Proximity Detector - Monitor Sharp GD2D120 Proximity Detector OUTPUT
'Variables
Whisker PIN 15
Flag··· VAR Bit
' Initialization
·Flag=0
· DO
··· IF (Whisker = 0 ) AND (Flag = 0) THEN
····· Flag = 1: DEBUG "Ouch, collision",
······
··CR
····· ELSE
··· ' When Whisker Released, Reset
······· IF (Whisker = 1) THEN Flag = 0
······· ENDIF
······· LOOP
·
Comments