Why this spin code doesn´t work in PIR Sensor (#555-28027)
loinad
Posts: 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
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
You never set pin 16 to be an output so your led will never come on.
Just include this