Hello, I am wanting to take three samples per second from my ADC input, so I can be sure the input is continuous and not just a quick, one off input.
Each sample gets stored into B12 and then copied to B13. B13 grows incrementally with each sample of B12.
I then divide B13 by three and test the value.
This is the code I am using, but it is not doing anything.
I am sure it is something simple I am doing wrong. Could someone please take a look ? I am unfamiliar with the nuances of picaxe basic.
Thanks kindly for any help.
main:
let w0=0
let w1=0
readadc 4,w0
let w1=w0
pause 500
readadc 4,w0
let w1 = w1+w0
pause 500
readadc 4,w0
let w1 = w1+w0
let w1 = w1/3
if w1 >= 152 then
goto lights
endif
goto main
Each sample gets stored into B12 and then copied to B13. B13 grows incrementally with each sample of B12.
I then divide B13 by three and test the value.
This is the code I am using, but it is not doing anything.
I am sure it is something simple I am doing wrong. Could someone please take a look ? I am unfamiliar with the nuances of picaxe basic.
Thanks kindly for any help.
main:
let w0=0
let w1=0
readadc 4,w0
let w1=w0
pause 500
readadc 4,w0
let w1 = w1+w0
pause 500
readadc 4,w0
let w1 = w1+w0
let w1 = w1/3
if w1 >= 152 then
goto lights
endif
goto main
Last edited: