Hi all.
I'm trying to control the speed of a motor by counting the N° of revs per second, using a Hall effect switch.
The problem I'm having is that the AND condition appears not to be working on the IF THEN ELSE line.
I need this condition so that the program doesn't count the same pulse more than once.
Thanks.
' This program is to control the speed of a motor by counting signals from a Hall
' effect switch.
#picaxe 08M2
#no_data
setfreq m8
symbol revcounter = b1
symbol trig = b2
Main:
revcounter =0
trig =0
beginning:
if pinC.4=0 and trig =0 then
high C.1
revcounter = revcounter +1
trig =1
else
low C.1
let trig = 0
endif
goto beginning
I'm trying to control the speed of a motor by counting the N° of revs per second, using a Hall effect switch.
The problem I'm having is that the AND condition appears not to be working on the IF THEN ELSE line.
I need this condition so that the program doesn't count the same pulse more than once.
Thanks.
' This program is to control the speed of a motor by counting signals from a Hall
' effect switch.
#picaxe 08M2
#no_data
setfreq m8
symbol revcounter = b1
symbol trig = b2
Main:
revcounter =0
trig =0
beginning:
if pinC.4=0 and trig =0 then
high C.1
revcounter = revcounter +1
trig =1
else
low C.1
let trig = 0
endif
goto beginning
Attachments
-
8.6 KB Views: 25