Tiffin Computing Club
The blog for Tiffin School's computing club- currently focusing on the world of Arduino!
Monday, 28 April 2014
Sunday, 16 March 2014
Arduino Blinking Light Experiment
We look at blinking lights on an Arduino Uno, and our implementation of it, and a peek at the code behind it!
Monday, 3 February 2014
The Exploits of the Second Week
In this week, we tried expanding the "blink" tutorial to cover FOUR lights! Extraordinary, I know.
Here's the Blink tutorial for Arduino for those unaware:
Hardware Required
To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative leg, called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.
Most Arduino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink.
Schematic

Code
In the program below, the first thing you do is to initialize pin 13 as an output pin with the line
pinMode(13, OUTPUT);
In the main loop, you turn the LED on with the line:
digitalWrite(13, HIGH);
This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line:
digitalWrite(13, LOW);
That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the delay() commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay() command, nothing else happens for that amount of time.
Video Tutorial
And the code!
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
See Also:
Here's the Blink tutorial for Arduino for those unaware:
Hardware Required
- Arduino Board
- LED
- Circuit
To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an LED (the positive leg, called the anode) to the resistor. Attach the short leg (the negative leg, called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program, and enter the code below.
Most Arduino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink.
Schematic
Code
In the program below, the first thing you do is to initialize pin 13 as an output pin with the line
pinMode(13, OUTPUT);
In the main loop, you turn the LED on with the line:
digitalWrite(13, HIGH);
This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line:
digitalWrite(13, LOW);
That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the delay() commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay() command, nothing else happens for that amount of time.
Video Tutorial
And the code!
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
See Also:
- setup()
- loop()
- pinMode()
- digitalWrite()
- delay()
- BareMinimum: The bare
minimum of code needed to start an Arduino sketch.
- Blink: Turn an LED on and
off.
- DigitalReadSerial:
Read a switch, print the state out to the Arduino Serial Monitor.
- AnalogReadSerial:
Read a potentiometer, print it's state out to the Arduino Serial Monitor.
- Fade: Demonstrates the use
of analog output to fade an LED.
- ReadAnalogVoltage : Reads an analog input and prints the voltage to the serial monitor
A very tutorial-based post this week, but the next should be more of a diary on how we got on attempting to do the above code but with four lights!
Are arrays the way, or long sections of code? Your debate.
Computing Club 3/2/14
Tuesday, 28 January 2014
Welcome to our Blog
Welcome to the Tiffin Computing Blog. Here we will post updates on our latest project- using Arduinos! Here's some background information:
Arduino kit reviews http://aaroneiche.com/2009/07/16/arduino-starter-rundown-part-2/
The one we went for, ARDX: http://oomlout.co.uk/products/arduino-starter-kit-ardx
The OOMLOUT tutorials:http://www.oomlout.com/a/products/ardx/
The software for the Arduion robot: http://arduino.cc/en/Main/Robot
A cool video about the Arduino robot:
Arduino kit reviews http://aaroneiche.com/2009/07/16/arduino-starter-rundown-part-2/
The one we went for, ARDX: http://oomlout.co.uk/products/arduino-starter-kit-ardx
The OOMLOUT tutorials:http://www.oomlout.com/a/products/ardx/
The software for the Arduion robot: http://arduino.cc/en/Main/Robot
YouTube Video
Subscribe to:
Comments (Atom)

