Skip to the content.

Hello World!

In computer programming, when you learn a new language for the first time, you usually write a ‘hello world!’ program. This gets you into the very basics of the programming language, how to edit and execute code, some basic print statements, etc.

A comparable example for Arduinos is making an LED blink.

Hardware

Physical set up.

led-blink

(image source: https://github.com/rwaldron/johnny-five)

Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}
// Create a variable to set the LED pin
int ledPin = 13;

void setup() {
  // Set the pin to be an output pin
  pinMode(ledPin, OUTPUT);
}

// Whatever is in the loop will repeat over and over again.
void loop() {
  // Push some voltage to the pin
  // digitalWrite is either, HIGH or LOW, on or off
  digitalWrite(ledPin, HIGH);

  // delay makes the script wait for the given miliseconds
  // this keeps the light on
  delay(100);

  digitalWrite(ledPin, LOW);
  delay(100);
}

Make it so