Getting Started with Grove
Experiment: LED module
In this article, I'll show you how to use a Grove LED module. Just like with the button module, wiring will need only a few seconds and has not risk of error.
If you prefer to watch the video version of this article, go ahead.
Purchase a Grove LED module
This module has a socket for a 5mm LED, and a potentiometer that controls brightness.
This is a Seeed product. Click on the red button, to complete your purchase on the Seeed website.
About this experiment
I'll show you how to use this LED module.
About the Grove LED module
The LED module contains a socket in which you can insert the pins of a 5mm LED. Take an LED, determine which pin is the anode (it's the one that is longer), and insert the anode in the socket marked "+".
The LED module also contains a potentiometer. This potentiometer controls the brightness of the LED.
Connect the Grove LED module
Let's connect the LED module to one of the Grove connectors on the Base Shield. Because this module is a digital device, we'll use one of the available digital Grove connectors
Take a Grove cable.
Plug one end in socket D4 on the Grove Base Shield.
Plug the other end in the Grove socket of the LED module.
Your circuit should look like the example in this photo:
As we did with the button, follow the yellow wire from the module pin "SIG" to the Base Shield to determine the Arduino pin we will need to use in the sketch.
In the photograph, the arrows point to the yellow wire that conveys the controlling signal, and the two pins it connects: Arduino digital pin 4 (D4) which is in Grove connector D4, and pin "SIG" on the module.
Now that we now which Arduino pin the module is connected to, we can continue with the sketch.
The Arduino sketch
The sketch we'll use to read the state of the temperature sensor and calculate the temperature in degrees Celsius is very simple.
Have a look:
In line 54, we set the LED controlling pin, which is Arduino digital pin 4 (as we determined during the wiring process).
Inside the loop, using the "digitalWrite" function, we simply write the "HIGH" value to turn on the LED, and the "LOW" value to turn it off.
Let's try out this sketch and circuit.
Execute the sketch
Upload the sketch to your Arduino. The LED will blink on and off every one second.
Use a screwdriver to control the brightness of the LED.
How easy was that?
A few seconds to do the wiring, and then straight to the programming part of the prototyping process. The LED module contains a current limiting resistor and a potentiometer and supporting electronics. If you wanted to put all that on a breadboard, just getting this LED to blink would have taken a lot more time.
If you're interested in learning how to use more Grove modules, and in particular how to make them work together through 5 fun projects, I invite you to have a look at my course Grove for Busy People.
"Getting Started with Grove" series
Ready for some serious learning?
Grove For Busy People
In this course, I’m going to show you how to use the Grove system for the Arduino.
It is a course for people who know the basics of the Arduino. If you have never used an Arduino before, consider enrolling to Arduino Step by Step Getting Started first.
Just click on the big red button to learn more.