Multiple LED Control

1 Circuit Design

Multiple Outputs

  • The Arduino has multiple outputs, which can be used to control a variety of components.
  • We will now get it to control 2 LEDs.

Try It

  • First, you will need to connect another LED through a 330 ohm resistor as shown in the picture below.

Multiple_LED.jpg

  • Now we can write a program to get the LEDs to flash.
  • Start a new sketch called MultipleLED and write the following code.

Multiple_code.jpg

Badge It

  • Silver, as per the example above, write the program to get the 2 LEDs to flash alternatively.
  • Gold, In the previous topic(lesson 2), you wrote a program to control the LED using a switch. Now write a program that will get the LEDs to flash when you are holding the switch down.
  • Platinum, Write a program to get the LEDs to flash when you momentarily push the switch and then stop when you momentarily push the switch again.