Needless to say I am new here but have been reading as many posts on this subject as I could find and it seems that programming the futaba 6ex for 6 flight modes is a not a simple project. So I ask .. what if I only wanted to utilize 3 flight modes- Auto, Stabalize and Loiter, would this be possible on the futaba by mixing 2 two postions switches? If so is there a tutorial somewhere?
You need to be a member of diydrones to add comments!
Replies
Arduino Nano code:
#include <Servo.h>
volatile int futaba_ch5; // Here's where we'll keep our channel values
volatile int futaba_ch6;
volatile int mix1;
volatile int mix2;
volatile int mix;
volatile long mixed;
Servo myServo;
void setup()
{
pinMode(2, INPUT); // Set our input pins as such
pinMode(4, INPUT);
pinMode(9,OUTPUT);
myServo.attach(9);
Serial.begin(9600); // Serial output setup
mixed == 1000; // Give initial reading for "mixed"
}
void loop()
{
futaba_ch5 = pulseIn(2, HIGH, 23000); // Read the pulse width of channel 5, wait for 25k microsecond
myServo.writeMicroseconds(mixed); // Continue to output last PWM signal
Serial.print("Output1 = "); // in order to reduce time interval between output pulse
Serial.println(mixed); // If not doing these 3 lines, the output pulse will have interval of 2 x 23ms = 46ms
futaba_ch6 = pulseIn(4, HIGH, 23000); // Read the pulse width of channel 6, wait for 25k microsecond
// Why 25k microsecond?
// Because there are typically 20ms (20,000 E-6 s) between pulse
// Each pulse has the length between 1ms (min) to 2ms (max)
// 23,000 = 20,000 + 2,000 + 1,000 where the 1,000 is allowance
// Serial.print("Futaba Channel 5: "); // Print the value of channel 5
// Serial.println(futaba_ch5);
// Serial.print("Futaba Channel 6: "); // Print the value of channel 6
// Serial.println(futaba_ch6);
if ( futaba_ch5 > 1500 ){
mix1 =3;
}
else {
mix1 =1;
}
if ( futaba_ch6 > 1500 ){
mix2 =1;
}
else {
mix2 =0;
}
mix = mix1 + mix2; // "Mixes" the channels
if (mix ==1) mixed = 1000; // Position 1 starting point
if (mix ==2) mixed = 1250; // Position 2
if (mix ==3) mixed = 1500; // Position 3 mid-point
if (mix ==4) mixed = 1750; // Position 4 2000 is end point
myServo.writeMicroseconds(mixed); // Output PWM of "4-position" switch
Serial.print("Output2 = "); // Print the value of mixed channel
Serial.println(mixed);
}
Did you ever figure out how to setup the Futaba 6ex to work with various flight modes of the FC? I've got a Futaba 6EX that I am trying to setup for simple, loiter and rtl. With only the two position switch I am not sure how to do this. Any suggestions appreciated.....BTW....went and (back) ordered the Turnigy 9X....though might be some time before I see it!