4x3 membrane keypad as input [help please]

PaulS:
The teensy or the Micro will work. So, what is the problem?

im not sure, i have posted the code i am using. when i open the serial monitor, it works but i cant figure out why it does nothing in the pc itself. I may have an incorrect setting orsomething but i just dont know.

Am i right in thinking that if i am in any text editor, then the button press should show as a number in the editor?

board is set to micro
programmer is USBtinyISP

but i cant figure out why it does nothing in the pc itself.

Because you are not sending keystrokes. THAT is done with the Keyboard library.

so is it doable? feel free to speak to me like a child, i really do know almost nothing.

if it is not feasible with the membrane button pad then i will build a board

Thanks

if it is not feasible with the membrane button pad then i will build a board

It IS feasible to get data from the button pad. But, what, EXACTLY, do you want to do with that data? Have you looked at the Keyboard library examples?

i have yes and to be honest, i though i was doing it correctly but it appears i wasnt.

The purpose of it for me, is to be able to map the numbers on the pad to in game commands on a racing game so i can turn my lights on/off winscreen wipers on/off etc.
I could use my keybord but if i can get this working, it will be a much better solution (space wise at least)

http://www.elecfreaks.com/estore/sealed-membrane-3-4-button-pad-with-sticker.html

You did not answer any of my questions. What are the labels on the keys? If the match what is in the code, what, EXACTLY, should happen when the '3' key is pressed?

If you want to execute a Keyboard.press('3'); when that happens, why don't you?

i can map in game controls to any key on my keyboard
an example would be keypad 3 turns my lights on / off
i would like to press number 3 on the button pad (the one in the earlier link) and have it register as the keyboard number 3
in my mind it sounds simple but i am not a coder so it would sound simple to me :wink:

i can adjust my seating position in game using wasd keys, i could remap them to 2,4,6,8 on number pad.

As i sit in a racing seat, i cant really reach my keyboard so this stick on pad would be an excellent replacement.

I have installed the keypad library and all works well within the arduino IDE but i am having trouble once i try to do anything outside of this.

I appreciate your patience and thank you for it

I have installed the keypad library and all works well within the arduino IDE but i am having trouble once i try to do anything outside of this.

Why are you trying to do anything outside of the IDE?

PaulS:
Why are you trying to do anything outside of the IDE?

im not, i am trying the code inside and the serial monitor shows my keystrokes. I want these keystrokes to show as actual keystrokes on the pc (ie. if i have my curser in the google search bar and i press 1 on my numberpad, i want it to show in the serch bar)

Not sure i have explained correctly. i want to control a game with it or at least an option within the game. i just want to press a button and it register as a keystroke.
i know this can be done with buttons and wiring and breadboards etc, i have seen videos but i can not get my button pad to register as a keystroke and see it as such anywhere outside of the serial monitor.

and the serial monitor shows my keystrokes

No, it does not. It shows some text sent by the Arduino. That is NOT the same as a keystroke.

The Serial pot is useful to get the code to the point where it can properly read from the keypad. Since you have that working, you now need to stop using Serial, so that the Keyboard class can talk to the PC, in a manner that does not use Serial.

Instead of using Serial.print(key), you will use Keyboard.press(key), a small delay, and Keyboard.release(key);. Look at thhe Keyboard examples, as I have said repeatedly.

Thank you again
i shall give this a quick try in a minute then sadly, its of to work i go.
I will report back and let you know how much of a start you have been

I can't read the music format.

That's the Disney theme song. " I owe, I owe, so off to work i go...".

i think i owe you a coffee :slight_smile:

123456789*0£

all typed with the number pad. only problem is the £ is actually a # on the pad but that easily fixed (keyboard setting maybe?)

Anyway, i removed Serial.print(key) and replaced it with

Keyboard.press(key);
    delay; 500, 
    Keyboard.release(key)

Thank you for your help (and patience)

Anyway, i removed Serial.print(key) and replaced it with

I hope you mean "something like", because there are problems with that snippet.

PaulS:
I hope you mean "something like", because there are problems with that snippet.

what have i done wrong?

The snippet should be:

    Keyboard.press(key);
    delay(500); 
    Keyboard.release(key);

The last line was missing a ;. The middle one was not calling delay(). The 500, bit was just weird.

By the way, holding the key pressed for half a second might be way too long. I'd be using 10, not 500, as the key down time.

I see, learning all the time. In work now but will alter my sketch once home.
It's starting to make sense now.

home from work, tested and working.
Just tried in game to assign controls and it works without issue.

Thanks for your help and thank you for not just giving me the answer either :wink: