Project 1 – My Name in Lights


For our first Physical Computing project, wewere required to demonstrate mastery of programming basics, variables, and digital input and output, while using a switch of our own design, an RGB LED, and any other parts of our choice.

DesignCS111 Project1

For this project, I decided right away
that I wanted to use single color LED lights to create letters. I made a grid using twelve LED lights: three blue, three green, three red, and three yellow; the grid is four lights tall and three lights wide. Due to space constraints on my breadboard and a limited number of digital output pins on my RedBoard, I was limited in the letters I was able to make. Therefore, I decided to simply spell my nickname, Ally, with the LEDs. Followed by clockwise blinking of each LED composing the perimeter of the grid in sequence.

I did encounter a few hiccups along the way, but I was able to resolve them. The first issue I ran into came with arrays. Essentially, the lights were cycling nearly correctly but not quite, and the loop did not run continuously. This was because when trying to use arrayA, I had accidently written the limits outside of what was in arrayA. This was remidied as soon as I corrected the limits. Another issue was that all the LEDs were running through the loop properly, but the light they were emitting was very dim. In this case, I had mistakenly deleted the part in the void setup () function in which output pins are assigned. Similarly to the other problem, this was fixed with very simple corrections in the coding. I also ran out of pins to output to so the red LED in the middle column is not wired to. Luckily, none of the letters required that LED for their construction.


To create my LED board, I used the following equipment:

  • RedBoard by SparkFun
  • Half-Breadboard
  • Wire x23
  • Blue LED x4
  • Green LED x4
  • Red LED x4
  • Yellow LED x4
  • 330Ω Resistor x 12
  • 12kΩ Resistor
  • Switch (Pop can and tab)

CircuitProject 1 Circuit Board

See the circuit diagram to the right for reference. The circuit diagram was created with Fritzing.

To start, I connected a single LED and a 330Ω resistor in series to pins 2-5 and 7-13. I then connected one anode prong of the RGB LED in parallel with each of the three blue LED lights in the grid. This way, when a blue pin is lit, its corresponding RGB LED will also become lit. Additionally, I created my switch using a pop can and tab. The tab is connected directly to the 5V power source, while the can is connected to pin 6 as well as a grounded 10kΩ resistor. When the switch is closed, the wire into pin 6 and the 10kΩ resistor are in parallel; however, since the resistance of the wire going into pin 6 is so much smaller compared to the grounded path with the 10kΩ resistor, nearly 5V of electricity will reach pin 6. And when the switch is open, the grounded 10kΩ will draw any remaining electricity away from pin 6.


The code I used for this project is as follows:

int blue1 = 13;    //blue light in first column
int blue2 = 12;    //blue light in second column
int blue3 = 11;    //blue light in third column
int green1 = 10;   //green light in first column, etc.
int green2 = 9;
int green3 = 8;
int red1 = 7;
int red3 = 5;
int yellow1 = 4;
int yellow2 = 3;
int yellow3 = 2;
int const switchPin = 6;  //switch is connected to pin 6
int arrayA[8] = {  //LEDs make the shape of the letter 'A'
  blue1, blue2, blue3,
  red1, red3,
  yellow1, yellow2,
int arrayL[6] = {  //LEDs make the shape of the letter 'L'
  green1, green2,
  red1, red3,
int arrayY[6] = {  //LEDs make the shape of the letter 'Y'
  green1, green2, green3,
  yellow2, yellow3
int arrayBox [10] = {   //LEDs on perimeter of LED grid
  green1, blue2, yellow3,
  green3, blue3,
  red3, green2, yellow1,
  red1, blue1
int time = 100;

void setup() {
  //initializes all output pins
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  //initialize input pin
  pinMode(switchPin, INPUT);

void loop() {
  int newPin = 0;
  int oldPin = 0;
  int bounce1 = digitalRead(switchPin); //these three lines send instructions to read pin 6
  delay(25);                            //this is dependent upon whether or not the switch has been flipped
  int bounce2 = digitalRead(switchPin);
  while ((bounce1 == bounce2) && (bounce1 == HIGH)) { //if both readings are high the following happens 
    for(int i=0; i<8; i++)            //for all 8 elements of arrayA
      digitalWrite(arrayA[i], HIGH);  //turns on all LEDs in arrayA
    delay(1000);                      //waits 1 second
    for(int i=0; i<8; i++) 
      digitalWrite(arrayA[i], LOW);   //turns off all LEDs in arrayA
    delay(250);                       //waits .25 seconds
    int i=0;
    for (int i=0; i<2; i++) {         //the steps in the brackets happen twice
      for(int i=0; i<6; i++)
        digitalWrite(arrayL[i], HIGH);  //turns on all LEDs in arrayL
      delay(1000);                      //waits 1 second
      for(int i=0; i<6; i++)
        digitalWrite(arrayL[i], LOW);   //turns off all LEDs in arrayL
      delay(250);                       //waits .25 seconds
    for(int i=0; i<6; i++)
      digitalWrite(arrayY[i], HIGH);  //turns on all LEDs in arrayY
    delay(1000);                      //waits 1 second
    for(int i=0; i<6; i++)
    digitalWrite(arrayY[i], LOW);   //turns off all LEDs in arrayY

    delay(250);                       //waits .25 seconds
    for (int i=0; i<3; i++){
      for (int i=0; i<10; i++){
        digitalWrite(arrayBox[i], HIGH);
        digitalWrite(arrayBox[i], LOW);
    if (newPin == 0) {   //this tells the system what to do when the numbering restarts
      for (int i=0; i<10; i++) digitalWrite(arrayBox[i], LOW);  //all lights off
    bounce1 = digitalRead(switchPin);  //checks to see if switch is flipped again
    bounce2 = digitalRead(switchPin);
 for (int i=0; i<10; i++) digitalWrite(arrayBox[i], LOW); //all lights off


To reiterate the comments within the code, I begin by assigning all the output pins a name based upon the color and position of the light they correspond to. This made assigning pins to the various arrays much easier; I needed only to look at the lights to determine which were needed to make the respective letters. Next, I assigned arrays that would look like the desired letters when all the elements of the array were lit. Throughout the program, I used a notation similar to this: for (int i=0; i<x; i++) {. This means that everything in the brackets will occur for several values of i. When i=0, the first element of the array is used. x should be taken as the upper bound of the array, or the number of elements it has. i++ means that the value i will increase in increments of 1 from i=0 to i<x. On several occasions, a statement like the ones aforementioned precedes a statement of the same type. When this happens, the first for statement acts like a repeat command. Whatever x is equal to in the first statement is indicative of how many times that particular portion of the code will repeat itself in one loop of the overall function. The statement beginning with while is a conditional statement. It says that the LEDs will only light up when the input to pin 6 is high, or the switch has been flipped.


It would seem that this type of project has been much improved upon already. After constructing and running this system, I noticed that this must be very similar to the way in which LCD screens, digital clocks, etc. work. Certain combinations of blinking LEDs are used to create the numbers, letters, and even complete pictures that we see on older TVs.

Even though this technology has been much explored and improved upon, there are still expansions that can be made to this project directly. One of those improvements would be to make a larger grid, such that all letters and maybe even entire words can be spelled out with lights. A practical use for this would be perhaps and open/closed sign. Flip the switch one way and the LEDs light up to spell “open;” flip it the other way and it says “closed.” Another, more fun improvement could be to add a light-dependent resistor to the circuit so that the lights would only operate when it is dark.

Closing Statements

In conclusion, I think that technologies like this one have been and will continue to be very common in our everyday lives. I think this project was both hard for me, as a first-timer, and very much fun. Right now I’m thinking that I might try to make a sign for the basement of the house I will be living in next year. I’ll be sure to post if that becomes a reality. Thanks for reading!

Leave a Reply

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