Shop OBEX P1 Docs P2 Docs Learn Events
Help ! IR with Basic Stamp 2 — Parallax Forums

Help ! IR with Basic Stamp 2

NTNT Posts: 14
edited 2009-10-07 22:30 in BASIC Stamp
hi all, I need help to achieve an assembly with infrared my system does not work ! shakehead.gif
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.cry.gif
353 x 373 - 4K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-07 22:30
    A short pulse of the LED won't really be visible. How about:

    IF IR_detect = 0 THEN unbroken

    HIGH 9
    GOTO loop

    unbroken:
    LOW 9
    GOTO loop
Sign In or Register to comment.