So I Need More Buttons on My Flight Control. A New HOTAS setup is beyond My financial means at this time.
So I hacked a few Switch Sets from these CR-V Door Latches We did as Recalls at Work(I'm a Master Tech in a Honda car dealership). I Purchased a Plastic-back Clipboard at Office Max to make Mounts for the Switches. I made a Template from Cardboard and Cut the Clipboard Backing. Then I used a Heat-Gun to Shape the Backing. The Wires all came from Hacked Honda Car Harnesses(from Wrecked Vehicle Repairs at Work).I Used the Wires that Connect to the Engine ECU.
While Its crude at this Point, I'll soon dress it up. I need to prove it can work in flight before I go & glue it on. I'll also put the wires into some Convoluted Tubing (also from Hacked Honda Car Harnesses).
The Micro Mounts on a 40-Pin I.C. Socket I Mounted it to a Perforated Board(Purchased from Radio Shack) by Pushing the Pins Thru the Holes and Bending them Over. I Hacked an Old SRS(Airbag) ECU(again from Wrecked Vehicle Repairs at Work) to get the Pins and Bent them Thru the Perf-board. I Soldered the Pins to the I.C. Socket Pins. This Makes a More Permanent Mount and gives Me the ability to change things around as I need it.
The Code was the Most Challenging(I'm not that much of a Programmer)...I Derived it from several examples, re-writing it several times before getting it to work.
const int buttonPin2 = 2; // the number of the pushbutton pin
const int buttonPin3 = 3; // the number of the pushbutton pin
const int buttonPin4 = 4; // the number of the pushbutton pin
const int buttonPin5 = 5; // the number of the pushbutton pin
const int buttonPin6 = 6; // the number of the pushbutton pin
const int buttonPin7 = 7; // the number of the pushbutton pin
const int buttonPin8 = 8; // the number of the pushbutton pin
const int buttonPin9 = 9; // the number of the pushbutton pin
const int buttonPin10 = 10; // the number of the pushbutton pin
const int buttonPin11 = 11; // the number of the pushbutton pin
const int buttonPin12 = 12; // the number of the pushbutton pin
const int buttonPin13 = 13; // the number of the pushbutton pin
int buttonState; // the current reading from the input pin
int lastButtonState = HIGH; // the previous reading from the input pin
void setup() {
// make The pins an input and turn on the
// pullup resistor so it goes high unless
// connected to ground:
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
int reading = digitalRead(buttonPin2);
if ((buttonState == LOW && lastButtonState == HIGH)) {
delay(200);
}
if(digitalRead(2)==LOW){ // MRM/DOGFIGHT OVERRIDE
//Send the message
Keyboard.print("A");
}
if(digitalRead(3)==LOW){ // MRM MODE
//Send the message
Keyboard.print("W");
}
if(digitalRead(4)==LOW){ // DOGFIGHT MODE
//Send the message
Keyboard.print("F");
}
if(digitalRead(5)==LOW){
//Send the message
Keyboard.print("K");
}
if(digitalRead(6)==LOW){
//Send the message
Keyboard.print("L");
}
if(digitalRead(7)==LOW){
//Send the message
Keyboard.print("Y");
}
if(digitalRead(8)==LOW){
//Send the message
Keyboard.print("C");
}
if(digitalRead(9)==LOW){
//Send the message
Keyboard.print("B");
}
if(digitalRead(10)==LOW){
//Send the message
Keyboard.print("V");
}
if(digitalRead(11)==LOW){
//Send the message
Keyboard.print("I");
}
if(digitalRead(12)==LOW){
//Send the message
Keyboard.print("N");
}
if(digitalRead(13)==LOW){
//Send the message
Keyboard.print("J");
}
}
I'd like to add Inputs from a Game-Pad Joystick thru the Analog Inputs, Turning it into a 4-way Hat Switch. I Hacked it out & I hooked it up and I can See it change voltage in the serial monitor; Just have to get the code right.