I am a student in an aerospace engineering class and programming is not my strongest topic. One of our projects is to use a Beachcraft King Air cockpit and turn it into a full enclosure flight simulator. We are using X-Plane as our software and are making our own switch panel with aluminum and toggle switches. I chose to use the arduino UNO for the interface between toggle switch and computer because the iPac we were going to use was pressing and HOLDING the corresponding keys so it caused many problems.
What I Need:
I learn best by example. I have tought myself the very basic of programming (if even) by going online and finding simple projects with the program already written and the circuit already made, I then build the circuit and replicate the code to work and try to branch off from there. For example, I found an article online telling me how to make a LED dimmer using a potentiometer and an LED. Then once I learned the general syntax for that I branched off and made the LED blink at different rates with the corresponding potentiometer position (like a strobe light). Now I know you can replicate this simply from a simple circuit but the point is, I am learning how to code it. So I need someone to make an example circuit and write a code that will make it work and post it, if at all possible.
The Problem:
The switch board I mentioned before needs to interface with the computer by pressing a letter for half a second and let go. I don't want it to loop through and keep pressinf it. I want it to, when I switch to a different position in the switch to then press that corresponding key for half a second and not do anything until I switch toggle switch the the other position. I am needing to make a panel with multiple switches so if someone could make a circuit with one corresponding key per position to add up for a total of 4 keys, I would greatly appreciate it.
Conclusion:
I really appreciate the people who are reading this and who respond. I understand that I may miss some key points so if anyone needs more information on this project and what it needs to do please post and I would be happy to clarify anything.
The switch board I mentioned before needs to interface with the computer by pressing a letter for half a second and let go. I don't want it to loop through and keep pressinf it. I want it to, when I switch to a different position in the switch to then press that corresponding key for half a second and not do anything until I switch toggle switch the the other position. I am needing to make a panel with multiple switches so if someone could make a circuit with one corresponding key per position to add up for a total of 4 keys, I would greatly appreciate it.
This is not clear to me….
“…when I switch to a different position in the switch to then press that corresponding key for half a second and not do anything until I switch toggle switch the the other position….”
Please detail more about the functions of the switches. Think in terms of input to the CPU and outputs.
Make a sketch...
What I mean is when i have the toggle switch in the up position, it will send a command to hold for example "g" for 500 milliseconds. But I don't want it to loop through and press it again until I put it in the down position.
Ok, I think I have an idea of what you are asking….
Using something like the UNO, you have available a number of inputs and outputs.
As I understand the iPac works like a keyboard. Instead of keys it has inputs that can represent various keys.
It looks like the inputs to the iPac are pulled high, and connected to ground to turn on.
I don’t know the switching voltage of the iPac (logic voltage level), but “ASSUME” it is in the input range of the Atmel.
Common the grounds on the 2 systems. Make sure 0 volts is same on both boards.
Connect the UNO outputs to the inputs of the iPac. You must decide what these are.
You could use IO 2,3,4, and 5 as inputs and IO 6,7,8, and 9 as outputs. That is using 8 of the available I/O 14 total. That would leave you 3 more I/O pairs still available.
In general the main loop would:
Read inputs and de-bounce them,
Calculate the time to turn off.
Set the outputs accordingly.
Variable = millis()
Returns the number of milliseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days.