Arduino and Linker Introduction

The Linker Base shield enables a range of components to be easily connected to the Ardunio Uno. This tutorial will cover how to program the Arduino to control 3 LEDs.

Equipment Required:

Preparation:

You will need to visit the Arduino website and sign up for an account. Next go to the Arduino web editor and follow the steps to install the plugin.

Plug the Linker Base Shield into the top of the Arduino Uno as shown.

Connect the LEDs to the Linker Base Shield as shown in the picture.

Programming the Arduino:

Connect the Arduino to one of your computer’s USB ports. At the top of the web editor select the Arduino Uno from the drop-down list.

Place this code at the top of your program. It gives the pin number for each LED an easy to remember name.

int redLED = 13;
int yellowLED = 12;
int greenLED = 11;

Add the following code to the setup function. The setup function runs when the Arduino starts up. This code sets the pins used by the LEDs to output mode.

void setup() {
  pinMode(redLED, OUTPUT);
  pinMode(yellowLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
}

Add the following code to the loop function. Any code inside the loop function is repeated continuously. This code will turn on each LED in turn for 1 second.

void loop() {
  digitalWrite(redLED, HIGH);
  delay(1000);
  digitalWrite(redLED, LOW);
  digitalWrite(yellowLED, HIGH);
  delay(1000);
  digitalWrite(yellowLED, LOW);
  digitalWrite(greenLED, HIGH);
  delay(1000);
  digitalWrite(greenLED, LOW);
}

Program the Arudino by clicking on the tick at top of the page. Your program should start running as soon as it has been compiled and transferred to the Arduino.

Leave a Reply

Your email address will not be published. Required fields are marked *