Hi friends, i m making a button box that is just full of buttons and only one output led to work as a gamepad for windows 10 pc .
I tested the code on tinkercad and it s working exactly the way i want it to work . But i. Using an arduino uno in tinkercard so i dont have access to the gamepad library and i m just using prints for outputs .
When i get the promicro or leonardo cards i ll just switch those print functions to gamepad buttons .
Anyway the code is working fine, what i mworried about is the hardware . As this is my first actual project ( i m just doing this becaude i need the box i dont know much about electronics ) i m not sure about how safe this is . Do i need more resistors for the buttons or do i only need them for leds etc ? I just want to have no risks of frying something ( the board , usb port or even worse my pc ... ) .
Can someone check this up please ( assume that i m using a promicro instead of the uno card most likely ) and tell me if i need to make any changes for it to be safe ?
It will be plugged to my pc by an usb 2.0 hub and will stay plugged in pretty much all the time .
define pin mode as INPUT_PULLUP (no external resistors are necessary).
connect one side of button to pin, and the other side to GND. For most push buttons best to make the connections diagonally.
In your code check for digitalRead(buttonPin) == LOW for button pressed.
The rest (LEDs, switches, potentiometer) looks ok... although not sure all components are shown on this schematic (1 LED, 2 push buttons, 1 switch missing).
Hry man thanks for the comment . It s reassuring as thats kinda what i did really .
Ye that schematic has a part 2 following it but it s just pretty much the sqme thing . I have a total of 17 buttons ( some toggles and some pushbuttons . And one potentiometer to control volume ) .
Anyway basically what i did is the same that u said . Ground on one side . Pin on the other and put pullup in the pin mode . Except for the code mine is a bit different cuz sometimes i need it to do an action when button pushed and another when button is released and i m using the potentiometer to press a bunch of buttons depending on value etc .
For the output led pin i dont need pullup right ?
I have some 2 positions buttons set to be following a led . So they either lit the led or toggle an action through a pin . It s wired this way :
5v -------> resistor -------> led ----> button ------ > ground
And when button is toggled then just pin to button to ground . That fine for the led and all ?
The only others resistors required in your circuit are in series with the LEDs to limit the voltage they see (otherwise they get 5v and won't last long)... and you already have those.