Forum >Using APC220 trancievers to spin propellors wirelessly
ArduinoGeneral

Using APC220 trancievers to spin propellors wirelessly

userHead Account cancelled 2015-06-18 02:40:03 1538 Views0 Replies
Hello

I have been working on a PC controlled quadcopter. I am using a pair of APC220 transceivers to control it remotely, but I cant get the wireless link to work.

I am using 2 arduinos, with an APC220 transciever connected to each.

The codes are:
PC Side:

Code: Select all
void setup() {
Serial.begin(9600);
}

void loop() {
if(Serial.available()>0){
// read the value
int throttle = Serial.parseInt() ;
Serial.println(throttle);
}
}

Quad Side:

Code: Select all
#include <Servo.h>
Servo Motor1;
Servo Motor2;
Servo Motor3;
Servo Motor4;

void setup() {
Motor1.attach(8);
Motor2.attach(9);
Motor3.attach(10);
Motor4.attach(11);
Serial.begin(9600);
Serial.println("initializing");
pinMode(13,OUTPUT);
}

void loop() {
if(Serial.available()>0){

digitalWrite(13, HIGH);
delay(250);
digitalWrite(13, LOW);
// read the value
int throttle = Serial.parseInt();

Serial.println("Printing the value: ");
Serial.println(throttle);

/*
* We only want to write an integer between
* 0 and 180 to the motor.
*/
if (throttle > -1 && throttle < 181)
{
// Print confirmation that the
// value is between 0 and 180
Serial.println("Value is between 0 and 180");
// Write to Servo
Motor1.write(throttle);
Motor2.write(throttle);
Motor3.write(throttle);
Motor4.write(throttle);
}
// The value is not between 0 and 180.
// We do not want write this value to
// the motor.
}
}

I first uploaded the quad side code to the arduino attached to the quadcopter, then unplugged the usb, connected the APC220 to the arduino(both APCs were configured properly using RF Magic before hand)

Then I uploaded the PC side code to the other arduino and connected it to the APC220, after this I opened a serial mointor and tried sending throttle values, and this did not work.

Can anyone tell me what I'm doing wrong here?