Arduino tutorial: 8 LED simple flasher using looping

Examples of Arduino program here that has just been posted here. Simplified the program by adding a loop instruction that is: for ().
Because the digital pin to 8led is D2 .. D9, then the instruction pinMode (), digitalWrite, and delay () can be inserted into the looping of for() instruction.
More programs like the following:

Program can be explained as follow:

  1. On setup(), using looping for() defined n variables as series 2,3,4,5,6,7,8,9. thus, Inside looping of for(), function of pinMode() and digitalWrite() instructions executed for pin of digital as number of 2,3,4,5,6,7,8,9.
  2. Inside function of loop(), each led of digital pin turn on about 100ms. Thus do not need to write down instructions repeatedly, for each LED.

Once the compiled binary code becomes smaller when compared to the previous tutorial.

Having executed the same result as the following video.

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, Arduino, Tutorial, Uncategorized 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>