utility DigitalRadio
configure chanel to range1000-2000 ms. /*s1 - s5 & LEDS connected to analog pins 1-5its numbers from 14 to 18 */ #define AnalogOut 10 // PWM out int SelBtn = 14; // default int BtnLevels[19]; void setup(){ Serial.begin(9600);//5 of 6 modesBtnLevels[14] = 0; // 1 buttonBtnLevels[15] = 84;BtnLevels[16] = 127;BtnLevels[17] = 169;BtnLevels[18] = 255; // 5 button //force pwmTCCR1B = 0x01;delay(100); pinMode(SelBtn, OUTPUT);digitalWrite(SelBtn,0);analogWrite (AnalogOut, BtnLevels[SelBtn]); }void loop(){ScanBtns();delay(10);} void ScanBtns(){for (int i=14; i <= 18; i++) ScanBtn(i);} void ScanBtn(int ScanPin){if (SelBtn != ScanPin) {pinMode(ScanPin, INPUT); if (digitalRead(ScanPin)==0) { SelBtn = ScanPin; unsetOther(ScanPin); while (digitalRead(ScanPin)==0); // hold scaning until relise button pinMode(ScanPin, OUTPUT); digitalWrite(ScanPin,LOW); }}} void unsetOther(int excludePin){for (int i=14; i <= 18; i++) { if (i != excludePin) pinMode(i, INPUT); digitalWrite(i,HIGH); } analogWrite (AnalogOut, BtnLevels[excludePin]);Serial.println(BtnLevels[excludePin]); }TX Hobby King 2.4Ghz 6Ch :
|
Comment by Kabir on October 15, 2012 at 3:32am can I has one?????
Comment by Alexey Kozin on October 15, 2012 at 4:15am This switch may be assembled from standard mini - arduino board using external LEDs and buttons. I can send a printed circuit board or welded unit, but international shipping will cost more
Comment by Alexey Kozin on October 15, 2012 at 4:35am the chematic shows three LC filter on the output, but with
/ / force pwm
TCCR1B = 0x01;
two are already excessive
Comment by Charles lakins on October 15, 2012 at 10:11am how much for a completed board?

Comment by Todd Hill on October 15, 2012 at 11:56am Cool hack. That's what I call "getting the most out of your hardware".
Comment by Charles lakins on October 15, 2012 at 12:14pm im presently going this route for a seamless install by building my own
http://myfavoritestripper.blogspot.ca/2012/09/ardupilot-tx-mode-swi...
but i love the interface you have

Most Excellent! Is there a reason you made it with 5 buttons instead of 6?
Comment by Charles lakins on October 15, 2012 at 1:57pm i like the idea as i could incorporate it into my groundstation panel that runs my flightstick using an arduino too and runs through my trainer port
i wouldnt have to crack open my radio
Comment by Peter Meister on October 15, 2012 at 2:50pm Very slick!
Comment by Alexey Kozin on October 15, 2012 at 8:33pm small modification for six buttons
/*
s1 - s6 & LEDS connected to analog pins 1-6
its numbers from 14 to 19
*/
#define AnalogOut 10 // PWM out
int SelBtn = 14; // default
int BtnLevels[20];
void setup()
{
Serial.begin(9600);
//5 of 6 modes
BtnLevels[14] = 0;
BtnLevels[15] = 51;
BtnLevels[16] = 102;
BtnLevels[17] = 153;
BtnLevels[18] = 204;
BtnLevels[19] = 255;
//force pwm
TCCR1B = 0x01;
delay(100);
pinMode(SelBtn, OUTPUT);
digitalWrite(SelBtn,0);
analogWrite (AnalogOut, BtnLevels[SelBtn]);
}
void loop()
{
ScanBtns();
delay(10);
}
void ScanBtns()
{
for (int i=14; i <= 19; i++)
ScanBtn(i);
}
void ScanBtn(int ScanPin)
{
if (SelBtn != ScanPin)
{
pinMode(ScanPin, INPUT);
if (digitalRead(ScanPin)==0)
{
SelBtn = ScanPin;
unsetOther(ScanPin);
while (digitalRead(ScanPin)==0); // hold scaning until relise button
pinMode(ScanPin, OUTPUT);
digitalWrite(ScanPin,LOW);
}
}
}
void unsetOther(int excludePin)
{
for (int i=14; i <= 19; i++)
{
if (i != excludePin)
pinMode(i, INPUT);
digitalWrite(i,HIGH);
}
analogWrite (AnalogOut, BtnLevels[excludePin]);
Serial.println(BtnLevels[excludePin]);
}
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.1299 members
48 members
693 members
51 members
249 members
© 2013 Created by Chris Anderson.
Powered by

You need to be a member of DIY Drones to add comments!
Join DIY Drones