OK here I go
I want to control a relay ON/Off using a picaxe that responds to the outputs of a 2.4GHz radio control RX. Basically an R/C switch.
I want to use this to replace a servo that moves a mechanical switch that is used to change the direction of a DC motor in a large scale model train loco.
The pulses out from the RX that correspond to a stick on the TX and are in the count range of 75 (left), 150 (centre), 225 (right), being the pulse width, in mS, of the input signal that drives a servo.
The stick is self-centering so when released returns to the centre position and outputs a 150 count till moved again.
The logic goes like this;
1. Look at the input pin.
2. If pulses = 175-225 then output = 1 - stick moved right
3. If pulses = 125-75 then output = 0 - stick moved left
4. If pulses = 125-175 then do nothing – stick in centre
5. If output = 1 and pulses = 175-225 then do nothing
6. If output = 0 and pulses = 125-75 then do nothing
The pulse number ranges are adjustable, but these are chosen so that if the stick is bumped it does not cause a sudden change of direction causing damage to the loco
My question is “where do I start with this”?
I have looked at the manuals and have found servo commands that control a servo eg “servpos” but nothing about a servo signal as an input.
I have looked at “pulsein” but cannot see how it would fit my need.
At present I am staring at a blank page in editor with the first line of “start” being the only entry.
I do have a big issue of being able to convert normal speak logic into picaxe speak.
I really need a push in the right direction and a bit of mentoring to get me on my way and I thought a simple task like this would be just what I need. I do not want a solution handed to me as I will not learn from that.
I do have programs written by others and can break them down but have never gone the other way and started from scratch.
I want to control a relay ON/Off using a picaxe that responds to the outputs of a 2.4GHz radio control RX. Basically an R/C switch.
I want to use this to replace a servo that moves a mechanical switch that is used to change the direction of a DC motor in a large scale model train loco.
The pulses out from the RX that correspond to a stick on the TX and are in the count range of 75 (left), 150 (centre), 225 (right), being the pulse width, in mS, of the input signal that drives a servo.
The stick is self-centering so when released returns to the centre position and outputs a 150 count till moved again.
The logic goes like this;
1. Look at the input pin.
2. If pulses = 175-225 then output = 1 - stick moved right
3. If pulses = 125-75 then output = 0 - stick moved left
4. If pulses = 125-175 then do nothing – stick in centre
5. If output = 1 and pulses = 175-225 then do nothing
6. If output = 0 and pulses = 125-75 then do nothing
The pulse number ranges are adjustable, but these are chosen so that if the stick is bumped it does not cause a sudden change of direction causing damage to the loco
My question is “where do I start with this”?
I have looked at the manuals and have found servo commands that control a servo eg “servpos” but nothing about a servo signal as an input.
I have looked at “pulsein” but cannot see how it would fit my need.
At present I am staring at a blank page in editor with the first line of “start” being the only entry.
I do have a big issue of being able to convert normal speak logic into picaxe speak.
I really need a push in the right direction and a bit of mentoring to get me on my way and I thought a simple task like this would be just what I need. I do not want a solution handed to me as I will not learn from that.
I do have programs written by others and can break them down but have never gone the other way and started from scratch.