Introduction: 0 to 99 Light Display
this circuit will take a light reading then display a number between zero and 99
please leave constructive comments
please leave constructive comments
Step 1: Parts You Will Need
to make the 0-99 LED display you will need...
~ photo resister
~ Arduino
~ 9 different wires
~ 2 seven segment led displays
~ bread board
~ staples
~ fine grit sandpaper
~ and a stapler
~ photo resister
~ Arduino
~ 9 different wires
~ 2 seven segment led displays
~ bread board
~ staples
~ fine grit sandpaper
~ and a stapler
Step 2: The Code
This is the code for the Arduino
I tryed 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
I tryed 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
Attachments
Step 3: STAPLES!!?!
With the code downloaded you need to connect the board
you need to connect the corresponding pins together so pin one
of one display connnects 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 acual staples apart
push them into the bread board leaving room for the display and wires
to connect to Arduino.
you need to connect the corresponding pins together so pin one
of one display connnects 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 acual 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
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
Step 6: Turn It On
plug the Arduino to a nine volt power or usb power and run the program
thank you for paying attention Please leave constructive comments for ways to improve code,
hardware design or a way to use it in a different project
thank you for paying attention Please leave constructive comments for ways to improve code,
hardware design or a way to use it in a different project