jsimpson001
Member
does anyone know how to set pwmout to a freq of 38khz, ive already had a go but it doesn't seem to work (the project is an IR beam alarm, and the IR LED is being modulated.
Heres the code
<code><pre><font size=2 face='Courier'>
'INFRARED BEAM ALARM FOR PICAXE-08M
symbol detector = pin3
symbol stateval = b0
init:
low 1
let stateval = 0
pwmout 2,38,19
wait 2
goto detect
detect:
if detector = 1 then sendback
if detector = 0 then valset
goto init
valset:
let stateval = 1
goto action
action:
if stateval = 1 then alarm
if stateval = 0 then init
goto init
alarm:
high 1
goto sendback
sendback:
if detector = 1 then detect
if stateval = 1 then alarm
</font></pre></code>
Heres the code
<code><pre><font size=2 face='Courier'>
'INFRARED BEAM ALARM FOR PICAXE-08M
symbol detector = pin3
symbol stateval = b0
init:
low 1
let stateval = 0
pwmout 2,38,19
wait 2
goto detect
detect:
if detector = 1 then sendback
if detector = 0 then valset
goto init
valset:
let stateval = 1
goto action
action:
if stateval = 1 then alarm
if stateval = 0 then init
goto init
alarm:
high 1
goto sendback
sendback:
if detector = 1 then detect
if stateval = 1 then alarm
</font></pre></code>