Arduino Basics Lesson 1-1: “Hello, World!”

For the “Arduino For Kooks” course, I recommend you get the Arduino Starter Kit available here.

“Hello, World!” is the most basic “program” developers use to test their understanding of a piece of hardware or programming language. On the Arduino, the “blink” sketch stands as the most basic bit of code that will run with human-readable output.

Let’s get our feet wet with the Arduino platform by assembling a slightly more complex version of “blink” using an external LED.

The Circuit:

Connect a jumper wire from pin 2 to the anode of the LED. The anode is the “+” side of the LED and has a longer leg. The easy way to remember this is that the extra little bit of lead can be clipped off to make a plus sign on the leg.

Connect a 220R resistor to the cathode of the LED. We’re using a 220R resistor because it will allow the most voltage to come through while reducing the overall current. I’ll explain how this works in a future video.

Connect the resistor back to the ground pin of the Arduino with another jumper.

The Sketch:

"Hello World" Blink Sketch

Turns an LED on for one second, then off for one second, repeatedly.

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
modified 3 Aug 2019
by Matthew Eargle

This example code is in the public domain.

int ledPin = 2; //Define ledPin as integer variable with value of 2

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

// the loop function runs over and over again forever
void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

Can you determine what the Arduino is doing at each line in the code?

What happens if we change the values of some variables?

What happens if we change the time parameter of the delay?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.