Ive got a project goin that needs me to have 6 pushbuttons wired to the arduino micro, I need help programming the sketch to make those 6 buttons to type a specific key (keys are listed below). Any help would be appreciated!!!
keys needed:
Arrow up
arrow down
arrow left
arrow right
enter
Backspace
I apologize now if my answer provides no help but this is the best I can do, if you don't like it ignore it.
Were not going to do the coding for you, (at least I'm not) because then you'd never learn.
One option would be to check out some of the examples for the Arduino (you can find the ones best for your case in File>Examples>Basics).
but better than that would be to study the language, start with the basics on the Arduino page (Arduino - Home) and/or find yourself a good C or C++ textbook or refrence web site (C++ preferably) and start studying it. I won't promise it to be exciting but then this is education, you get out what you put in.
lastly just so you don't think I'm no help at all this is the general format I use for multiple buttons.
Thanks guys! I wasnt expecting anyone to do it for me, just some steps to get me goin... ive been bangin my head on this for a little while. Thanks again for the fast respones, and to Grumpy mike I have an arduino micro
It would really help you to go through a number of examples you can find in your Arduino IDE. Learn to trace code line by line while picking up the language fundamental basics.
If you learn all of the Control Structures tutorials and Nick Gammon's tutorial linked below you should know enough to start off well.
The examples are also covered with more explanation on the Arduino site. Here are some links to bookmark, collect more as you go.
Arduino specific pages, the last is the reference for the standard libraries that Arduino uses.
i am a complete beginner at this, this is my first real sketch so i really need some guidance.
all i am wanting to do is wire 6 push buttons to the ARDUINO MICRO and make them push keys on the keyboard,up,down,left,right,enter,and backspace. so far i have gotten 2 pushbuttons in the sketch...if someone can help i can definatly do the rest of em
Heres the Sketch:
its messy i know, but its my first one.....
what i need help with is when i upload the sketch it continually presses the 2 buttons at the same time, and also how would i wire this?
i know i am asking for a lot but ANY help would be awesome!
oh and im not asking someone to write the code for me i just want some help thats all
Looks like you're missing some if statements, else statements and have some erroneous semicolons. I recommend looking at some simple examples on how to structure if statements with regards to semicolons, brackets, etc.
Okay I feel like Ive got everything workin on the software side, how would I wire it up? Sorry im pretty much clueless on how to do this but im ready to learn!
Your buttons are simulating keyboard cursor controls in an OS application.... Like a USB keyboard. All of the wiring is virtual----> over the USB cable.
Open notepad, word or similar, the plug in your Arduino... Give plug 'n play a few seconds, have fun. Remember, the Arduino thinks it is a keyboard.
The 14 - 18 are Arduino pins NOT physical numbers.
Buttons are wired: http://arduino.cc/en/Tutorial/Button
One reason to learn the Control Examples in the IDE before writing your own code is to learn about arrays and for-loops.
#define KEYS 5;
byte keyPin[ KEYS ] = { 14, 15, 16, 17, 18 }; // easy to change once here, easy to use below
enum { enter, up, down, left, right } key; // learn about these later, just be aware
void setup() {
for ( byte i = 0; i < KEYS; i++ ) // i will not exist outside of this for loop
{
pinMode( keyPin[ i ], INPUT );
}
//other setup code...
}