1. Testing the Connections for the Arduino with LED Module The final step in connecting the Arduino with LED module to the computer is to test that everything is working. At this point you should have the LED module connected to the Arduino board as shown on the grid, and the Arduino board connected to the computer via the USB cable and the ChDuino interface (for Windows and MacOS machines) or the Arduino Controller (for Chromebooks).
To test the hardware and software connections we use either ChDuino or the Arduino Controller to send a High signal to the LED to turn it on (or Low to turn it off). The red LED in the LED module is connected to the Arduino’s digital pin 13. Because we want to output a signal from the Arduino to the LED, we need to set pin 13 to “Output” mode using the pulldown menu next to the pin number in ChDuino or Arduino Controller.
Click on the pulldown menu and change it to “Output” and it will look like this:
For the Arduino Controller interface, changing pin 13 to Output looks like slightly different:
To output a “turn on” signal to the LED, simply click the “High” radio button for pin 13 in the ChDuino interface or use the pulldown menu for pin 13 in the Arduino Controller interface to select “High.” A 5 volt signal will be sent through pin 13 to the LED, thus turning it on. To turn it off, simply click the “Low” button (ChDuino) or select “Low” (Arduino Controller), which sends a 0 volt signal to the pin and out to the LED.
2. Trying Different Colors You can also try turning on/off the blue light by outputting a High or Low signal on pin 11 and turning on/off the green light by doing the same for pin 12. It’s fine to turn on multiple lights at the same time. For example, turning on the red and blue LEDs at the same time gives a purple effect.
3. Dimming the LED Using the PWM Output Option It’s also possible to get a “dimmer switch” effect using certain of the Arduino’s digital pins. Normally, a digital device is either on (High voltage) or off (Low or 0 voltage). But using a technique known as “pulse width modulation” (PWM), it’s possible for a digital pin on the Arduino to simulate a range of voltage outputs. When an LED is connected to a digital pin set to the PWM mode, the simulated range of voltage outputs allows the brightness of the LED to be varied over the range from Low (off) to High (full on). If you look closely at the numeric labels for the digital pins on the Arduino board, you will see that some of them have a tilde (squiggly line) in front of the number. This indicates that the pin can be set to PWM mode in addition to Input or Output mode. You can also see the tilde indicators in the ChDuino interface (Windows and MacOS machines), though not in the Arduino Controller interface (Chromebooks). In both ChDuino and Arduino Controller, however, you can see which pins have the PWM option by clicking on the Input/Output menu for that pin. If it’s a PWM pin, then you will see PWM as a third option. For reference, the PWM pins are digital pins 3, 5, 6, 9, 10, and 11. To try out the PWM dimmer effect, use ChDuino or the Arduino Controller to set pin 11 (connected to the blue LED) to PWM. This shows how ChDuino (on the left) and Arduino Controller (on the right) display the PWM option with a slider control:
4. IMPORTANT: Resetting All the Pins to Low (Off)
5. Troubleshooting If you run into problems, see the lesson on Tips for Debugging for Physical Computing with Arduino for a number of suggestions. Here are a few basic things to check:
|
Click the Run button to view and answer a question about this lesson. |
Grid Size: S M L | Simple View: | MinView: |
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
|
|||||||||||
|
|||||||||||