Skip to content

Instantly share code, notes, and snippets.

@pknowledge
Last active August 20, 2019 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pknowledge/ea82547c2b0c1b68cdcf13f489bb56bb to your computer and use it in GitHub Desktop.
Save pknowledge/ea82547c2b0c1b68cdcf13f489bb56bb to your computer and use it in GitHub Desktop.
Arduino Tutorial for Beginners – Setup And Loop Blocks + light LEDs right to left
#define myAnodeLed1 10 // Define pin to easily change
#define myAnodeLed2 9
#define myAnodeLed3 8
#define Led_On_Off 500
void setup()
{
// put your setup code here, to run once:
pinMode(myAnodeLed1,OUTPUT); // Setup pin 10 is OUTPUT
pinMode(myAnodeLed2,OUTPUT); // Setup pin 9 is OUTPUT
pinMode(myAnodeLed3,OUTPUT); // Setup pin 8 is OUTPUT
}
void loop)()
{
// put your main code here, to run repeatedly:
digitalWrite(myAnodeLed1,HIGH); // OUTPUT 5 Voltage at pin 10
delay(Led_On_Off); // Delay 500ms (0.5s) as we set above
digitalWrite(myAnodeLed2,HIGH); // OUTPUT 5 Voltage at pin 9
delay(Led_On_Off);
digitalWrite(myAnodeLed3,HIGH); // OUTPUT 5 Voltage at pin 0
delay(Led_On_Off);
digitalWrite(myAnodeLed1,LOW); // OUTPUT 0 Voltage at pin 10
delay(Led_On_Off); // Delay 500ms (0.5s) as we set above
digitalWrite(myAnodeLed2,LOW); // OUTPUT 0 Voltage at pin 9
delay(Led_On_Off);
digitalWrite(myAnodeLed3,LOW); // OUTPUT 0 Voltage at pin 0
delay(Led_On_Off);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment