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:
- pinMode ()
- digitalWrite ()
- 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:
- 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.
- 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.
- The loop function (), each LED is turned on for 100ms, with instruction in sequence:
digitalWrite (LED1, HIGH);
digitalWrite (LED1, LOW);
Same for the other led to change their variable LED2 … 8.
Source can be downloaded here.
Last updated byat .