I am trying to write the code to display some number to 2 digit 7 segment led. I am be able to display to one digit led, but I do not know how to display to dual digits. any helps would be appreciated very much.
Before we can offer at help we have to know how it is wired up. This is because there are many ways to wire this up and it affects the code. Please post a schematic.
To make both the digits work you will have to use something called "multiplexing"; it is simply a method of controlling many outputs using less pins. The same technique is used to control LED matrices. For example if you wanted to control each LED in an 8x8 LED matrix, you would need 64 pins, but if you use multiplexing you can achieve the same job in only 16 pins. The same applies to seven segment displays you are using.
You can easily find tons of examples online on multiplexing seven segment displays.
and the code ?
it would help if you could also show the actual picture of how it all comes together, especially with the connection to ground.
in any case, you can only show one digit at a time.
see the previous post about multiplexing - this is a trick where you "take turns" turning on one digit, turning it off, and then turning the other one on, and repeating the cycle VERY FAST which tricks the human eye to thinking they're both on.
OK so you are multiplexing them.
However you can not source all the current for all the segments from just pin 10 ( or 11 ), that would add up to a total of 72mA way over the 40mA point where damage starts to occur.
You have a common anode display so you must supply digit 1 & 2 with a switched voltage.
You must wire up the two digits through a pnp transistor and drive the base of that through a resistor from your arduino pins.
Grumpy_Mike:
...
...
You have a common anode display so you must supply digit 1 & 2 with a switched voltage.
You must wire up the two digits through a pnp transistor and drive the base of that through a resistor from your arduino pins.
sounds quite advanced; if not to you, Mike !
i searched "switched voltage" and it gave pages re: voltage regulators - that's not what you mean, right ?
is it more along the lines of this ?