I am trying to make a counter using a 7 segment display. I only have a common anode one. Is there a way to turn individual segments on and off?
Have you tried Google? On the first page you find several tutorials.
Add a 330 ohm resistor to each segment and connect the other end of the resistors to the Arduino outputs.
Plenty of examples over at "talkingelectronics".
http://www.talkingelectronics.com/te_interactive_index.html
Down the LHS, "lap counter 2 digit" is just one of many.
When done playing, and time to get serious with it, get a module with driver IC such as the TM1637 in place. Makes life so much easier... Of course you can do it the hard way if you want.
MaXaMaX:
I am trying to make a counter using a 7 segment display. I only have a common anode one. Is there a way to turn individual segments on and off?
Connect the common anode to +5V. Connect each segment through a resistor to an Arduino pin. Set the pin mode to OUTPUT. Use digitalWrite(pin, LOW); to turn the segment on and digitalWrite(pin, HIGH); to turn the segment off.
You would need a GPIO pin for each segment, so unless you are counting to nine you need some kind of 7-segment display driver, like the MAX7219.
Can also use a shift register like TPIC6C595 to sink current from each segment. Still need current limit resistor per segment.
For most displays a regular 74HC595 will do just fine, 5 mA is enough for a single LED. That'd be one shift register per digit or you still need to multiplex on the Arduino - and wouldn't work that easily with say a 12-pin 4-digit display.