Arduino – blinky with delay function

This is another blinky project. A “Hello World” program for the electronics. This version of “blinky” example is using delay function to make an onboard LED blink for roughly one second. The code is on Github, click here.

Parts Required

  • Arduino board (i.e. UNO)

Software

This code is written in C++ and can be compiled using an Arduino IDE. All information about how to compile this project is here.

/**
 * Copyright (c) 2019, Łukasz Marcin Podkalicki <lpodkalicki@gmail.com>
 * ArduinoUno/001
 * Blinky with delay function.
 */

#define LED_PIN (13)

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Toggle LED pin
  delay(500); // wait 0.5s
}

 

Leave a Comment