http://kiwitricopter.blogspot.co.nz
Added code to null the PWM signals on loss of signal
void NullServos()
{
//Throttle TxVal[1]
//Rotary pot TxVal[2]
//Joy 1 X TxVal[3]
//Joy 1 Y TxVal[4]
//Joy 2 X TxVal[5]
//Joy 2 Y TxVal[6]
//rssi TxVal[7]
//digital TxVal[8]
//micros() TxVal[9]
//Throttle
val = 0;
val = map(val, 1, 179, 30, 179);
val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[0].write(val); // sets the servo position according to the scaled value
//Elevator Joy 1 Y TxVal[4]
val = 90;
val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[1].write(val); // sets the servo position according to the scaled value
//Left Flaperon
val = 90;
val = map(val, 0, 179, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[2].write(val); // sets the servo position according to the scaled value
//Right Flaperon
val = 90;
val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[3].write(val); // sets the servo position according to the scaled value
//Joy 2 X
val = TxVal[5] / 10;
val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[4].write(val); // sets the servo position according to the scaled value
//Joy 2 Y
val = TxVal[6] / 10;
val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
servo[5].write(val); // sets the servo position according to the scaled value
}
Xbee Arduino Remote On Yellow Plane nice and responsive and I clearly managed to wire the board up correctly
Got to do the code changes for flaperon mixing and some way of trimming the channels individually as well as some gain & limits
The Arduino outputs angle for the servos so in theory it would be pretty straight forward to apply the trims ect.
Shockingly simple code by the way
http://kiwitricopter.blogspot.co.nz/2...
http://kiwitricopter.blogspot.co.nz/2...
http://kiwitricopter.blogspot.co.nz/2...