Arduino – Getting Started

This page has the links and other resources for the Learn Arduino workshops held at the Watsonia Library in 2018.

The Learn Arduino slides (see link below) provide an introduction to the Arduino, and some guidance on getting your first project up and running.

These workshops use examples provided in Alan Smith’s Introduction to Arduino textbook. Alan’s book is available as a free PDF download (see link below), or a hard copy can be purchased from Amazon via a link on Alan’s website www.introtoarduino.com.

Key resources

Led Chaser

This is the project in Chapter 2.8 of Alan Smith’s Introduction to Arduino textbook.

To make this project, you will need an Arduino board (such as the Arduino UNO), a breadboard, 4 x LEDs, 4 x 220R resistors, and some jumper wires.

The Arduino “Sketch” is provided below. Copy and paste this into the Arduino IDE.

When you hit the “upload” button in the Arduino IDE, this program will be compiled and then uploaded to your Arduino board. If all goes well, you should see a repeating light-chasing pattern on your 4 LEDs.

If the project uploaads successfully but doesn’t run properly, the most likely explanation is that one or more of the LEDs is around the wrong way. Try pulling the LED out from the breadboard, rotating it 180 degrees, and reinserting it.

/*
 *  LED Chaser example 
 *  
 *  From Chapter 2.8 of Alan Smith's "Introduction to Arduino" textbook
 *  www.introtoarduino.com
 *  
 */

const int kPinLed1 = 2;
const int kPinLed2 = 3;
const int kPinLed3 = 4;
const int kPinLed4 = 5;

void setup()
{
  pinMode(kPinLed1, OUTPUT);
  pinMode(kPinLed2, OUTPUT);
  pinMode(kPinLed3, OUTPUT);
  pinMode(kPinLed4, OUTPUT);
}

void loop()
{
  // turn on each of the LEDs in order
  digitalWrite(kPinLed1, HIGH);
  delay(100);
  digitalWrite(kPinLed2, HIGH);
  delay(100);
  digitalWrite(kPinLed3, HIGH);
  delay(100);
  digitalWrite(kPinLed4, HIGH);
  delay(100);

  // turn off each of the LEDs in order
  digitalWrite(kPinLed1, LOW);
  delay(100);
  digitalWrite(kPinLed2, LOW);
  delay(100);
  digitalWrite(kPinLed3, LOW);
  delay(100);
  digitalWrite(kPinLed4, LOW);
  delay(100);
}

Potentiometer

This is the project in Chapter 3.2 and Listing 3.5 of Alan Smith’s Introduction to Arduino textbook.

To make this project, you will need an Arduino board (such as the Arduino UNO), a breadboard, 1 x LED, 1 x 220R resistor, 1 x 4.7K potentiometer, and some jumper wires.

The Arduino “Sketch” is provided below. Copy and paste this into the Arduino IDE.

Compile and upload this program to your Arduino board. If all goes well, the speed at which the LED flashes will vary as you turn the potentiometer.

/*
 *  Potentiometer example 
 *  
 *  From Chapter 3.2 of Alan Smith's "Introduction to Arduino" textbook
 *  www.introtoarduino.com
 *  
 */

const int kPinPot = A0;
const int kPinLed = 9;

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

void loop()
{
  int sensorValue;

  sensorValue = analogRead(kPinPot);

  digitalWrite(kPinLed, HIGH);
  delay(sensorValue);
  digitalWrite(kPinLed, LOW);
  delay(sensorValue);
}

Infrared Remote Control

Adding an infrared remote control receiver to an Arduino project is simple and cheap.

This webpage describes the process -> How to Set Up an IR Remote and Receiver on an Arduino

Links

Starter Kits:

Useful tutorials: