Assignment 3b – Arduino Introduction

The objective for this first lesson is to create a circuit that will turn on a LED.

General Information

First we receive some general information from Joe. Arduino is a microcontroller that facilitates building and programming the workings of electric circuits. There is no operating system and consequently no file system. However, the Arduinos can be programmed with a C like language for which an IDE exists. The board is equipped with pins which can be read (e.g. sensor) and written on (voltage).  A big advantage is the community around the Arduinos that can provide useful tips for any problem we might encounter.

Arduino IDE

We each receive an Arduino Uno. There are not enough bread boards for everyone and since I don’t know its importance I only take an Arduino. We connect it via a lan cable to our laptops on which we previously had installed the IDE that now automatically opens upon connection.

Via Tools the board can be connected to the program: the Board (now: Arduino Genuino/ Uno) and the Port (now: USB) need to be set. When this is done upload in the top can be clicked and as a response the Arduino blinks.

We disconnect the Arduino again to add LEDs and wires.

On an LED the short leg needs to be connected to the ground (as a return path for electric current) and the long one to Power. Right now the long leg is connected to Pin 13.

Make a blinking LED

The open file already contains two functions:

void setup() {}     :  called when the sketch starts. Here all pins and variables can be initialised.

void loop() {}       :  called again and again in a loop. Here the program can respond to events, set timers etc.


The Pin 13 now needs to be set as the output pin. In the setup function we therefore put:

pinMode(13, OUTPUT);

In the loop function we now specify what should to happen to the pin 13. First we add power, then we wait for a second after which we turn it off and wait 1 second again. Since the function is called in a loop this code is enough to create a blinking LED. It is executed with the « upload » button.

digitalWrite(13, HIGH); // turn the LED on
digitalWrite(13, LOW); // turn the LED off

Add a switch to turn on the LED

We now want to add a switch to the circuit, for which we will need the breadboard.


The circuit we want to build.

The light should only turn on when the button is pressed. For this reason the LED is not directly connected to the power but through the button. Since I don’t have a breadboard I cannot add the switch and continue working with Isha and Joe. In the end it works, but we are not 100% how that came to be, so we play around a little with the circuit and see what works and what doesn’t.



The circuit with a switch.



Publié dans Uncategorized