CShore's Maker Workshops

Arduino Blink Sketch: Controlling the On-board LED

  • Open the Arduino IDE
  • Open File|Examples|01.Basics|Blink
  • You should see:
/*
  Blink

snip

*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
  • Since the Uno comes with Blink pre-installed, make changes that will be obvious, such as changing the ON time to half a second (change first delay(1000) to delay(500)) and the OFF time to five (5) seconds ( change second delay(1000) to delay(5000)).
  • Compile your changes (Sketch|Verify/Compile)
  • Send them to the Uno (Sketch|Upload)
Fork me on GitHub