Skip to content

Instantly share code, notes, and snippets.

@astro648
Created August 16, 2021 01:15
Show Gist options
  • Save astro648/e57db89828dcba4ce22380a0b530b6aa to your computer and use it in GitHub Desktop.
Save astro648/e57db89828dcba4ce22380a0b530b6aa to your computer and use it in GitHub Desktop.
Flashing LED Light Arduino Code with Basic Explanations
//(Remember to use the Arduino IDE) Let's say that you want to make a flashing LED light.
//In this specific example, the LED is connected to Pin 2.
void setup(){
//Setting up the output for Pin 2
pinMode(2,OUTPUT);
}
//In the Arduino IDE, void loop(){} loops the code inside curly brackets.
void loop(){
//The line of code below turns on the light.
digitalWrite(2,HIGH);
//This line keeps it on for 50ms.
delay(50);
//This line turns it off.
digitalWrite(2,LOW);
//This line keeps it off for 50ms.
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment