Mohamad Afiq Bin Ahmad 2017806612 EMD6M12
Mohamad Afiq Bin Ahmad 2017806612 EMD6M12
After build the circuit plug Arduino board into the computer, start the Arduino Software
(IDE) and enter the code below. Also can load it from the menu File > Examples > 01.Basics
> Blink. The first thing to do is to initialize ledPin as an output pin with the line.
pinMode(ledPin, OUTPUT);
In the main loop, turn the LED on with the line:
digitalWrite(ledPin, HIGH);
Then turn it off with the line:
digitalWrite(ledPin, LOW);
The delay() commands tell the board to do nothing for 1000 milliseconds, or one second.
When you use the delay() command, nothing else happens for that amount of time.
digitalWrite(9, LOW);
// turn the LED off by making the voltage LOW
delay(1000);
// wait for a second
}