Help ! IR with Basic Stamp 2
NT
Posts: 14
hi all, I need help to achieve an assembly with infrared my system does not work !
I want to do a montage of object detection. How it works:
_ If the object·is not detected, Led (P9) = 1.
_ If the object is detected, LED (P9)·= 0.
Here is my program :
' {$STAMP BS2}
' Detect
IR_detect· VAR· Bit
· LOW 7
loop:
· PAUSE 50
· FREQOUT 7, 1, 38500
· IR_detect = IN8
· IF IR_detect = 0 THEN unbroken
··PULSOUT 9, 250
· GOTO loop
·unbroken:
···GOTO loop
Thank you for answering me.
I want to do a montage of object detection. How it works:
_ If the object·is not detected, Led (P9) = 1.
_ If the object is detected, LED (P9)·= 0.
Here is my program :
' {$STAMP BS2}
' Detect
IR_detect· VAR· Bit
· LOW 7
loop:
· PAUSE 50
· FREQOUT 7, 1, 38500
· IR_detect = IN8
· IF IR_detect = 0 THEN unbroken
··PULSOUT 9, 250
· GOTO loop
·unbroken:
···GOTO loop
Thank you for answering me.
Comments
IF IR_detect = 0 THEN unbroken
HIGH 9
GOTO loop
unbroken:
LOW 9
GOTO loop