Shop OBEX P1 Docs P2 Docs Learn Events
Why this spin code doesn´t work in PIR Sensor (#555-28027) — Parallax Forums

Why this spin code doesn´t work in PIR Sensor (#555-28027)

loinadloinad Posts: 1
edited 2008-03-13 11:32 in Propeller 1
'OBJETO PIR SENSOR
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

High = 1
Low = 0
Out = %1


PUB arrancar

DirA[noparse][[/noparse]17] := 0
waitcnt((12_000_000 ) + cnt)

' The datasheet says that the PIR Sensor requires a ‘warm-up’ time in order to function properly. This is due to the settling time involved in ‘learning’ its environment. This could be anywhere from 10-60 seconds. During this time
there should be as little motion as possible in the sensors field of view.



repeat

if( InA[noparse][[/noparse]17] == 1)
outa[noparse][[/noparse]16] := High ' This is a led
else
outa[noparse][[/noparse]16] := Low

Comments

  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-03-13 11:32
    First of all, if you put your code in [noparse][[/noparse] code] and [noparse][[/noparse] /code] without the spaces it won't lose all the spacessmile.gif

    You never set pin 16 to be an output so your led will never come on.

    Just include this
    dira[noparse][[/noparse]16]:=1
    
Sign In or Register to comment.