Arduino tutorial: 8 LED simple flasher

Here I will explain how to make a simple 8 LED flasher. Of course the program is made very simple logic, using very little instruction as the lesson.
Instructions used are:

  1. pinMode ()
  2. digitalWrite ()
  3. delay ()

With three kinds of instruction can make a simple flasher 8led. 

Open the program code in the Arduino IDE, the program can be described as follows:

  1. First defined the digital pin for the LED 1 .. 8, using the instruction: int LED1 = 2, meaning that using a pin LED1 D1 (digital channel 1). Similarly to other LED uses the same instruction.
  2. In the function setup (), define each pin as an output LED1 .. LED8 with instructions: pinMode (). Also all led made turn off using instruction: digitalWrite (LED1, LOW), as well as for the other led.
  3. The loop function (), each LED is turned on for 100ms, with instruction in sequence:
    digitalWrite (LED1, HIGH);
    delay (100);
    digitalWrite (LED1, LOW);
    Same for the other led to change their variable LED2 … 8.

YouTube Preview Image

Source can be downloaded here.

 

Last updated by at .

Avatar of Bambang Siswoyo

About Bambang Siswoyo

I am a college lecturer since 1988 at UB (University of Brawijaya) in the electronics department. My experience: Applications of Microprocessor system, Applications of Control System, Applications of Field Programmable Gate Array, Computer Programming in computer instrumentations. My hobby: Music especially playing the saxophone, hiking and exploring the countryside.
This entry was posted in Arduino, Tutorial and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>