Introduction: Running a One Through a Field of Zeros

Back in the 70's I was working for Northern Telecom (Nortel Networks). I attended a digital electronics course and part of the course dealt with LED's and flip flops.

One of the tasks we had to perform was called Running a one through a field of zeros. In this example we have six LEDs that are turned off and each LED had to be turned on then off through the entire sequence of LEDs.

It was a lot of wiring and I probably could not do it today and why would I? Using the Arduino board is so much easier!

This example is for beginners or the curious.

If you want to try this example you will need the following parts:

6 LEDs.

6 330 ohm resistors.

1 Arduino Clone.

7 jumper cables.

1 Breadboard.

You can power this example through the USB port.

======================================================================

Here is the code: You can copy and paste into your IDE.

/* Running a one through a field of zeros This example code is in the public domain. */

// give the LEDs a name and assign them a number:

int led1 = 2;

int led2 = 3;

int led3 = 4;

int led4 = 5;

int led5 = 6;

int led6 = 7;

// the setup routine runs once when you press reset:

void setup() {

// initialize the digital pins as output.

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(led4, OUTPUT);

pinMode(led5, OUTPUT);

pinMode(led6, OUTPUT);

}

// the loop routine runs over and over again forever:

void loop()

{ digitalWrite(led1, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led1, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led2, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led3, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

digitalWrite(led4, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led4, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

digitalWrite(led5, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led5, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

digitalWrite(led6, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait

digitalWrite(led6, LOW); // turn the LED off by making the voltage LOW

delay(50); // wait

}

Making things do stuff by writing code is SO much easier!

If you want another challenge try running a zero through a field of ones by changing the code!