hi!, i have a problem to decode a 2.4ghz r/c receiver's signal.
I really tried but many have not yet succeeded in build a sketch that decodes signals from the receivers and make them usable from other arduino's code.
asking for help to all experts!!
please, help me!!
oh, sorry for duplicated reply, i have a lots of internet connection problems.
i have used a lots of codes found around the forum, in particular i have tryied this one, found on diydrones.com :
void setup() { Serial.begin(57600); //Serial Begin pinMode(3, INPUT); //Pin 3 as input } void loop() { while(pulseIn(3, LOW) < 5000){} //Wait for the beginning of the frame for(int x=0; x<=channumber-1; x++)//Loop to store all the channel position { value[x]=pulseIn(3, LOW); } for(int x=0; x<=channumber-1; x++)//Loop to print and clear all the channel readings { Serial.print(value[x]); //Print the value Serial.print(" "); value[x]=0; //Clear the value afeter is printed } Serial.println(""); //Start a new line }
and i also tryied this one:
unsigned long transmitterThrottle=0; unsigned long transmitterLeftRight=0; unsigned long transmitterForwardBack=0; void setup() { pinMode (8, INPUT); pinMode (9, INPUT); pinMode (10, INPUT); Serial.begin(57600); Serial.println("Done with setup"); } void checkTransmitter() { transmitterThrottle = (pulseIn (9, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse transmitterLeftRight = (pulseIn (8, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse transmitterForwardBack = (pulseIn (10, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse } void loop() { checkTransmitter();//check the data being received by the transmitter. Serial.print ("data: ");//if we decrease altitude we should check for landing, and slow our decent when we get close to the ground. Serial.println (transmitterThrottle); Serial.println (transmitterLeftRight); Serial.println (transmitterForwardBack); delay (200); }
founded on youtube under the search voice of "2.4 ghz receiver connected to arduino"
so i have tryied also to use arrays to store on arduino the bit-strings from the receivers.. but only a lots of errors.
Hi, go and check the code of ardupilot. This is an arduino based autopilot that reads the inputs from a R/C receiver decodes it, just what you are looking for.