Arduino Leonardo LED Blinking
by jonyeh1688 in Circuits > Arduino
1428 Views, 0 Favorites, 0 Comments
Arduino Leonardo LED Blinking
Compared to the original version, the delay seconds are not able to stop when the value is 0. This might make the system having errors because it can not produce the result of negative seconds. I also made the value of the product subtract 1 after every time so the LED light will blink faster after every round. I also changed the pin of the LED light because I can changed it to analog when I want, and I do not need to change the pin again.
Downloads
The Hardware Materials
Materials:
Dupont Lines x2
Resistance x1
Arduino Leonardo x1
LED light x1
Breadboard x1
The Circuit
I got power from the board(pin 6). After the process, I added a resistance to the circuit to reduce the electron of the circuit so that the electricity is able to pass through the LED light without burning up. The LED light reconnects to the ground by having a wire to connect to the Arduino board.
The Code and the Edited Part
Link: https://create.arduino.cc/editor/jonyeh/5e71eb79-c...
Code:
int led = 6;
//改
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
for(int del=500;del>=0;del--){//改
digitalWrite(led, HIGH);
delay(del);
digitalWrite(led, LOW);
delay(del); } //改