RC controller project
bennettdan
Posts: 614
Hello
··· I was wondering if I could read the Pulse Width of an 2 Channel·RC car controller reciver, It would take two pins reading pulsein but I understand that the BS2 can only read one pulsein at a time so if I was one to read the other·I need to measure for 2ms at a time to get an acurate reading?··
··· I was wondering if I could read the Pulse Width of an 2 Channel·RC car controller reciver, It would take two pins reading pulsein but I understand that the BS2 can only read one pulsein at a time so if I was one to read the other·I need to measure for 2ms at a time to get an acurate reading?··
Comments
I've used a BS2 to read a 6-channel radio this way, plus executed a 600 line program to control the machine.
Cheers
1. measure all the inputs
2. use the measured values to figure out what needs to be done
3. update the outputs based on what happened in step 2.
4. goto step #1.
So, to answer your question, I read all channels one right after the other. Here's a sample from a simpler, 4-channel system.
mainLOOP:
PULSIN 8,0,ch1 ' winch 1 control stick
PULSIN 9,0,ch2 ' winch 2 control stick
PULSIN 10,0,ch3 ' forward/reverse main motors;including trolling motor
PULSIN 11,0,ch4 ' left/right on fans; y-connection to steering servo
'DEBUG DEC3 ch1," ",DEC3 ch2," ",DEC3 ch3," ",DEC3 ch4," ",DEC1 IN12,HOME
GOSUB motspd
'PAUSE 250
GOTO mainLOOP
Cheers