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 :
|
You need to be a member of diydrones to add comments!








Comments
its no commercial forum i cant show price here
please all details by email
yes i do.
my mail kozin@mail.ru
Hi Charles
i can produce one this
http://youtu.be/S5TCgGjUu7M
that's cost parts for me
psb 5$
atmega328p 4$
resonator 1$
5 tactile buttons 3$
5 smd 0603 Leds 3$
other 3$
---------------------
six button and led may be installed externaly on the body of tx near trottle stick for faster access to manual mode
the next I wanted to do - add a beeper to dialtone and alarm warning of a low battery HК 6сh TX
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]);
}
Most Excellent! Is there a reason you made it with 5 buttons instead of 6?
Cool hack. That's what I call "getting the most out of your hardware".
the chematic shows three LC filter on the output, but with
/ / force pwm
TCCR1B = 0x01;
two are already excessive
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
-
1
-
2
of 2 Next