Arduino LED Control with Push Button

This is another Arduino project for beginners, it shows how to control LED ON and OFF with push button where the LED changes its state whenever the pushbutton is pressed.
In this project, Seeed Studio Grove LED socket kit and Grove button modules will be used. With the Grove modules circuit connection is more easier.

To see Arduino LED blink example visit the following post:
Arduino LED Blink with Seeed Studio Grove LED Socket Kit

The Grove LED socket kit is shown below:

Seeed Studio Grove LED socket kit
Seeed Studio Grove LED socket kit

As shown in the Grove LED board there is a variable resistor of 10k ohm which is used to control the brightness of the LED.
We can easily change the color of the LED by replacing the red one with another with different color (yellow, white …).

And the following image shows the Grove button module:

Seeed Studio Grove button

The button module has a pull down resistor of 10k ohm, if the button is pressed the state of SIG (signal) pin will change from low to high.

Each module is connected to Seeed Studio Grove Base Shield via 4-pin Grove cable, the base shield is an add-on board that directly mounted to the Arduino/Genuino UNO board.
Both Grove modules can work with 3V3 and 5V systems.

Hardware Required:

Arduino LED control with push button circuit:
The following image shows the connection of the Grove LED socket kit and button modules with the base shield using 4-pin cables.
Note that the base shield is directly mounted to the Arduino UNO board.

Arduino LED control push button Grove modules circuit

And the image below shows more detailed circuit:

Arduino LED control push button Grove

The Grove LED is connected to base shield port D2 which is internally connected to the Arduino uno board as follows:
GND pin is connected to Arduino GND,
VCC pin is connected to Arduino +5V pin,
NC is a not connected pin (it looks as it is connected to pin D3),
SIG (signal) pin is connected to Arduino digital pin 2.

The Grove button module is connected to base shield port D5 where the SIG pin is connected to Arduino digital pin 5.

Arduino LED control with push button code:
Example Arduino code is below.

Arduino LED control with push button video:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.