LED Control with pro micro

Hi,

I'm currently building a controller to use on Windows. I'm very inexperienced with arduino and all the stuff like it.

Would this

work with a pro micro whilst using the button as a controller button wich sends a input to the pc?
So I basically want to controll the LED and get a Input on the PC with the same button.

DP switches won't work because of the limited space I got

Thank you for your help

To get input on the PC from the arduino, you have to use the serial monitor. Try the serial communication examples of the Arduino IDE.

1 Like

No current limiting resistors on the LEDs. Stop right there and throw that video in the bin.

A Pro Micro can be used as a HID so it can send keystrokes to the PC. It can also just send serial data and it can blink a LED.

2 Likes

Alright, thank you is it possible to do these two things at once? And with multiple button of such each one controls a LED and an input?
And do I connect the LED/ Button like in the video? With a resistor of course

Not at once, but it's like it was because the timing between the actions are microseconds.

Also possible, but limited to the available pins on the micro. I suggest you to implement one button first, then one LED and when everything works like you want, make it bigger.

Buttons from GND to a pin set as INPUT_PULLUP (the pin will read LOW when you press the button). LEDs can be connected from pin to GND with the appropriate resistor (which depends on the LED colour) in series, before or after the LED.

1 Like

Below are two ways shown to control LEDs using switches. The usual way is buttons SW1 and SW2 and LEDs D1 and D2; this gives you the greatest flexibility. If you only want the LEDs to light up when the button is pressed you can use the approach as shown for SW3 and SW4 and D3 and D4.

:warning: With the approach taken for SW3 and SW4 you should never make D18/D19 outputs as that might cause a short if the output is high and you press the button.

With SW1 and SW2, you need to use pinMode(thePin, INPUT_PULLUP) to prevent floating inputs; this was mentioned by @Brazilino in post #5.

With SW3 and SW4 you do not need to use pinMode(thePin, INPUT_PULLUP) because R3/D3 and R4/D4 act as pull-ups.

There is not necessarily a relationship between SW1 and D1 and SW2 and D2; you can switch D1 on based on the status of SW1 or on the status of SW2 depending on your needs.

You will need to think what you want to achieve. E.g. if you need the flexibility to fade a LED using PWM you will need to use pins that support PWM (pins D3/D5/D6/D9/D10).

You haven't told us what you want to achieve in Windows when you press a button. If you want to control or start an application you can search the web for arduino button box.

2 Likes

Jup, that's what I'm trying to do, thank you your text explained every question I got.

Hi, just one more quick question, can I still use the switches as inputs to the pc if I connect them like switches 3 and 4?

Not sure if I understand the question but they are connected to pins on the Pro Micro and hence can provide input to the microcontroller.

1 Like

Yeah that's what I meant😅