LED Blinking

by mimi1017 in Circuits > Arduino

180 Views, 0 Favorites, 0 Comments

LED Blinking

53E72261-BCEA-4ED8-A6C6-6F7DCE350448_1_105_c.jpeg
IMG_4737.jpeg

step one: build the circuit

step two: write the code

Code

//Blinking_LED

//turn on the LED for half a second, then off for half a second, repeatedly

const int ledPin = 9;//the number of the LED pin

void setup()

{

pinMode(ledPin,OUTPUT);//initialize the digital pin as an output

}

void loop()

{

digitalWrite(ledPin,HIGH);//turn the LED on

delay(700); // delay 0.7 seconds

digitalWrite(ledPin,LOW); //turn the LED off

delay(700); //delay 0.7 seconds

}

/*************************************************/

step three: upload the board

then the LED light will blink!!!


((you can add a case for your work to make it prettier))

Supplies

- Arduino board * 1

- USB cable * 1

- Resistor * 1

- LED * 1

- Breadboard * 1

- Jumper wires