coolcoder345
Published © LGPL

First arduino project: flash led

Learn how to code an led to flash on and off

BeginnerProtip80
First arduino project: flash led

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
5 mm LED: Green
5 mm LED: Green
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

led circuit

Code

flashledcode

Arduino
// plug led in breadboard.  Then plug in two wires one on the negative and the other on the positive side of the led.  The positive side is the side with the long leg.
// plug the positive side in to digital pin 4 on the arduino.  Then upload this code.  YOu should see the led flash on and off.

int ledpin = 4;  // tells the arduino board what pin the led is on. You could use a different pin but make sure to change the number.
void setup(){// anything in this will only run once
  pinMode(ledpin, OUTPUT); // this tells the arduino that the ledpin is an output
    
  
}
void loop(){ // any code in this will run forever
  digitalWrite(ledpin, HIGH);  // this make the ledpin high or turns it on
  delay(1000); // this make the arduino pause before going on to the next line
  digitalWrite(ledpin, LOW);  // this makes the ledpin low or turn off
  delay(1000);
}

Credits

coolcoder345
1 project • 0 followers

Comments