Sometimes I feel that my geek credentials are lacking given the lack of code I write, yes I make cool things occasionally, I work as an EMC Engineer for a small Stockport Company, I am a Director of Squashed Fly a small independent Hosting and General Geeky company with Tas, and hope to be a good Daddy to MiniBoyGeek.

My Git skills are a little lacking, and my coding skills are a little rusty, For the first few weeks I am going to work through .:oomlout:.’s Getting started with Arduino kit guide, given the simplicity of the examples I think I will try and get more than one done a week, but I will list them all together.

I will be putting everything on github at, where you can follow where I am up to.

let us set up Git

In make a new repository

I have called mine

CodeAWeek because I am amazingly imaginative…

Make a folder and set it up as

I keep my Projects in Dropbox (even when they also are git repositories (Yes I can hear a lot of people cringing)).

So in ~/Dropbox/Projects:
mkdir CodeAWeek
cd CodeAWeek
git init

Grab the SSH location of the git repository from git hub:

and paste it onto the end of git remote add origin (Sets the new remote) making something like:
git remote add origin [email protected]:PhilipMcGaw/CodeAWeek.git
You will now want to do some more git magic (Verifies the new remote URL) git remote -v and to pull down the files in github git pull origin master and we are all up to date…

Add a few files on the computer and you will need to do the following:
git add .
git commit -m "some helpful comments, apparently WIP is not helpful and people will glare at you for that kind of thing"
git push --set-upstream origin master

The other thing I tend to do that may make people squeak is store largish binary files in repos, I have a copy of the .:oomlout:. ARDX-EG-OOML-DD Guide and ARDX-circuit-sheets for the first few weeks stashed in a reference folder.

Week 1a.

The first circuit in the .:oomlout:.

Week 01a LED on Pin 13

Week 01a LED on Pin 13

If you look at the above image you will see that the resistor is listed as 220 Ohm rather than the 550 Ohm listed in the ARDX-EG-OOML-DD Guide.

Looking at Fritzing again I have found out how to adjust the value of the resistor, Click the resistor, on the right hand side it brings up the Inspector:

Fritzing Inspector

Fritzing Inspector for changing Value of Resistors

I have updated the image showing the correct value of resistor on pin 13:

Week 01a LED on Pin 13

Week 01a LED on Pin 13, showing the correct value of resistor.

The code for week 1a is:

/* Blink
* Turns on an LED on for one second, then off for one second,
* repeatedly.
* Created 1 June 2005 By David Cuartielles
* based on an orginal by H. Barragan for the Wiring i/o board
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup()
{ // initialize the digital pin as an output:
    pinMode(ledPin, OUTPUT);

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
    digitalWrite(ledPin, HIGH); // set the LED on
    delay(1000); // wait for a second digital
    Write(ledPin, LOW); // set the LED off
    delay(1000); // wait for a second

Uploading the code to the Arduino Uno is simple from the IDE, and then causes the LED to flash (at 0.5 Hz with a 50% duty cycle) thusly:

However there are several problems with using the delay command, while the processor is executing the delay command it is blocked from doing any thing else; no other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt.

There is a better way:

Week 1b

/* Blink without Delay

 Turns on and off a light emitting diode (LED) connected to a digital
 pin, without using the delay() function.  This means that other code
 can run at the same time without being interrupted by the LED code.

 The circuit:
 * LED attached from pin 13 to ground.
 * Note: on most Arduinos, there is already an LED on the board
 that's attached to pin 13, so no hardware is needed for this example.

 created 2005
 by David A. Mellis
 modified 8 Feb 2010
 by Paul Stoffregen
 modified 11 Nov 2013
 by Scott Fitzgerald

 This example code is in the public domain.

// constants won't change. Used here to set a pin number :
const int ledPin =  13;      // the number of the LED pin

// Variables will change :
int ledState = LOW;             // ledState used to set the LED

// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated

// constants won't change :
const long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);

void loop() {
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledPin, ledState);

This code looks quite a bit more complex, we have broken out the delay time to a constants called interval that allows the frequency for the flashing to be changed, so to get a 1 Hz flash we would put the interval to 500 ms rather than 1000 ms for the current 0.5 Hz.

There are some more things that you can do with this circuit, if we move from Pin 13 to a pin with a ~ (tilde) next to it, we can do PWM, but I will do that next time.