# Make A 0 to 99 Light Display Using Arduino

Contents

This circuit will take a light reading then display a number between zero and 99.

## Step 1: Parts you will need

#### Major Components in Project

To make the 0-99 LED display you will need…

~ photo resister
~ Arduino
~ 9 different wires
~ 2 seven segment led displays
~ staples
~ fine grit sandpaper
~ and a stapler

## Step 2: The Code

This is the code for the Arduino

I tried to explain it the best I could in the comments but I ran out of room in some of them

so lines of interest

int pinstringA[11] {
HIGH,LOW,HIGH,HIGH,LOW,HIGH,HIGH,HIGH,HIGH,HIGH};

these strings code for the state of one segment each so
pinstringA[0] == HIGH   this means that when the number is zero segment A is High

light = map(light, 0, 1024, 100, 0);
the pullup resister flips the values of the photo resister so a lot of light makes the number low
so I Changed the scale from 0 to 1024 to 0 to 100 then flipped it.

tens = light / 10;
This finds the tens value eg. 19/10= 1 remainder 9 the remainder is then thrown out
the line below saves the remainder for the ones place

PORTD = PORTD & B00000011;
This turns all the pins on port d off but leaves pin 0 and 1 alone (for serial communication)
see http://arduino.cc/en/Reference/PortManipulation for more details

## Step 3: STAPLES!!?!

you need to connect the corresponding pins together so pin one
of one display connects to pin one of the other display

Staples works very well for this they are six pins in length the only
bad part is that the glue that holds them together is non conductive so
take the sandpaper and rub off the glue on the downward leads
next pop them in a stapler and use it to push the actual staples apart

push them into the bread board leaving room for the display and wires
to connect to Arduino.

## Step 4: Attach wires

Attach wires to the led.

## Step 5: Connect to Arduino

Connect each wire to the Arduino.

Segment A to pin 4
B to 7
C to 8
D to 6
E to 3
F to 2
and G to pin 5

Also connect ground from ones place to pin 9
and ground from tens place to pin 10

Last connect the photo resister to the Arduino ground and Analog 0

For more detail: Make A 0 to 99 Light display Using Arduino