Im currently building a racing simulator and with that a button box to free up my keyboard.
I have built and wired the button box using 16 pushbuttons, 6 spst toggle switchs and 4 spdt toggle swtiches. I wired it in a 5x6 matrix to look like this:
R1---PB PB PB PB PB
R2---PB PB PB PB PB
R3---SW SW SW SW PB
R4---SW SW SW SW PB
R5---SW SW SW SW PB
R6---PB PB SW SW PB
(rows 4 and 5 switchs are the spdt togge)
Im pretty compitent building stuff but when it comes to programming I fall short. LOL
I am wondering if someone would be so kind as to write the code for this project and then run me through it so i can modify it for future projects. Every little things helps!
Before thinking about code, are you aware of ghosting?
Ethanallen2212:
I am wondering if someone would be so kind as to write the code for this project and then run me through it so i can modify it for future projects.
That's i good point. I could easily wire in some diodes quick. What diode dk you recommend? Thanks for bringing that up. Whats your hourly rate and how long would it take you?
Ah but that might not work for toggle switches, becasue that means more than one "cell" could be closed at a time. I think the library only "sees" one at a time?
Any small signal diode is probably fine. 1N4148 etc.
Ethanallen2212:
Whats your hourly rate and how long would it take you?
What I wanted to say is: This is a forum. You show what you did, explain what's not as expected and others help you.
You don't want to pay a programmer for this, it's not worth the hassle.
Willpatel_Kendmirez:
Ah but that might not work for toggle switches, becasue that means more than one "cell" could be closed at a time. I think the library only "sees" one at a time?
As of version 3.0 it now supports mulitple keypresses.
KeyState getState()
Returns the current state of any of the keys.
The four states are IDLE, PRESSED, RELEASED and HOLD.
Im currently building a racing simulator and with that a button box to free up my keyboard.
I have built and wired the button box using 16 pushbuttons, 6 spst toggle switchs and 4 spdt toggle swtiches. I wired it in a 5x6 matrix to look like this:
R1---PB PB PB PB PB
R2---PB PB PB PB PB
R3---SW SW SW SW PB
R4---SW SW SW SW PB
R5---SW SW SW SW PB
R6---PB PB SW SW PB
(rows 4 and 5 switchs are the spdt togge)
Im pretty compitent building stuff but when it comes to programming I fall short. LOL
I am wondering if someone would be so kind as to write the code for this project and then run me through it so i can modify it for future projects. Every little things helps!
I hope you added diodes to each switch? Otherwise it can never work with switches because of ghosting.
And for multiplexed inputs you can use the keypad library although that might give trouble with switches as well... Might be edited version available. But if you get the idea of input multiplexing writing something should not be to hard. So what did you try?
yes I plan on adding diodes. ive already wired the box up but putting in diodes is an easy fix. iv tried running through the tutorial for button matrix but I don't understand it at all. programming in general is hard for me to understand. I'm more of a mechanical person.