Hello everyone, I currently have a bunch of LED's hooked up to a Arduino micro, and I want to make it so that when I physically push down on one of the LED's heads it changes colors, but I don't know how I would go about detecting that push. Does anyone have any advice for getting started?
Hello tareill
Take a view into the examples provided by the IDE.
“I want to make it so that when I physically push down on one of the LED's heads it changes colors”
-
Will you please explain this more ?
-
Show us images of your components.
LEDs cannot detect being pushed. So you will need to mount a pushbutton underneath. But care must be taken that no metal part of the pushbutton can cause a short circuit across the LED's pins.
A simple Google search for bi color pushbutton would be a good start.
I agree, and only suggest this so someone will say it woukd never work:
Since LEDs exhibit a photovoltaic effect, you could turn off the LED briefly, or it is off aready and detect whether it was exposed to light or not; a finger blocking such light might be in that way visible and act as a signal, a signal to do whatever.
a7
But just covering the led, without physically pushing down on it, would cause a false detection based on @tareill 's specification:
Or even just putting it in a dark room...
![]()
- Put the project enclosure on a weight sensor.
When you push on the RGB LED mounted on the enclosure surface, the weight sensor detects the push, software adjusts the LED colour as needed.
![]()
Maybe instead of LEDs, you need pushbuttons that have multicolor LEDs in them:
Is this just a one-time operation, or is something returning the LED to it's original position?
Well, since no reply seems to be coming, let's assume the LED needs to return to it's relaxed position after being pushed.
I can see a LED, either thru hole or SMT, being placed in an opening in thin non-conductive foam. If thru hole, the LED legs can be bent up to the sides of the LED and then clipped off near the bottom of the LED. The LED can then be placed into a suitable hole in the foam, such that the bottom of the LED and bent wire leads cannot touch the copper traces on a circuit board. When the foam/LED is attached to the circuit board, there is no electrical contact until the LED is pressed down.
Taken from the way push button switches used to be constructed for cheap solid state radios.

