I want to build a simple switch that will switch an LED on and off when the throttle in my RC system passes about the halfway mark. I'm using the Picaxe 08 proto board with output to an LED via a transistor, and signal input from the RC receiver to pin 1 of the 08M2 via a 22k resistor, and a capacitor between pin 1 and ground (can't remember, but I must have picked that up from one of the circuits in the manual). Anyway, here's the code I'm using:
This way, the LED stays lit whatever the position of my throttle. If I change the if line to b13< 100, the LED stays off whatever the throttle.
What have I got wrong, please? Is is the code, or is it the number in the if line?
Code:
main:
let b13=0
checkinput:
pulsin 1,1,b13
if b13> 100 then high 2
else
low 2
endif
goto checkinput
What have I got wrong, please? Is is the code, or is it the number in the if line?