As we know that light-emitting diode(LED) is a semiconductor device that produces light from electricity. They can produce many different colors. so in this experiment, we are going to blink LED.
Required.1 x LED color as you like.
Arduino board
Wire,
Breadboard
Resistor 330Ω
1. Connect to the breadboard
Connect According to the diagram as I have shown you. In the above figure, the black wire is connected to GND and the red wire is connected to the 5V above the GND pin in the Arduino board. Place the LED as shown in the figure, the negative terminal is connected with one end of the resistor and the second end of the resistor is connected to the negative terminal(fig). We place a resistor in order to avoid damage for LED if more current flows. The green wire is connected to pin 12, once the circuit is complete. Connect your Arduino board to your computer with the help of USB cable.
2. Open Arduino IDE software
void setup()
{
pinMode(12, OUTPUT);
}
void loop()
{
digitalWrite(12, HIGH); //Turn on The LED
delay(1000); // Wait for One second
digitalWrite(12, LOW); // Turn off the LEDdelay(1000); // Wait for One second
}
Verify your code before uploading to the board. just by clicking on the tick button
once you receive this message, then you are good to go.
3. Upload code to Arduino Board
Once your code is ready, plug your Arduino board to your computer and click on the upload button.
DONE
your code is uploaded to your board. as you see LED start blinking with Delay of one second. you can change the delay time and play with it.
How to memorize this code?
Connect two or more LED with different color and plug into the board. please make sure the negative and positive terminal. once you connect, then add the code. Remember the pin where you plug starting from 13 to 2. do not connect in pin 1 and pin 0.
if it is not working let me know down in the comment.
GOOD LUCK






0 comments: