Task 1 Task 2 Task 3 Task 4 Task 5 Task 6  Homework Tasks

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 and call it LEDmultiple, then 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.