tryna figure out something

so im using the 4-Digit 7-Segment LED and im tryna put up the number 10 but the problem is i cant figure out how to put up two different digits at the SAME TIME so can someone pls explain to me how to put it up ?
heres what i tried to do:

void ten()
{
  //1
  digitalWrite(D1,HIGH);
 digitalWrite(D2,HIGH);
 digitalWrite(D3,LOW);
 digitalWrite(D4,LOW);
 digitalWrite(pinA,LOW);
 digitalWrite(pinB,HIGH);
 digitalWrite(pinC,HIGH);
 digitalWrite(pinD,LOW);
 digitalWrite(pinE,LOW);
 digitalWrite(pinF,LOW);
 digitalWrite(pinG,LOW);
 //0
 
 digitalWrite(pinA,HIGH);
 digitalWrite(pinB,HIGH);
 digitalWrite(pinC,HIGH);
 digitalWrite(pinD,HIGH);
 digitalWrite(pinE,HIGH);
 digitalWrite(pinF,HIGH);
 digitalWrite(pinG,LOW);

OK, here's the rules:

  • Give Web links to the parts you are using.
  • Show your circuit.
  • Explain what the overall goal is.

Use this sequence:

Turn all digits off
Setup all segments for next digit
Turn digit on
Wait 5 millis
Repeat for each digit
Repeat again to keep display on

i cant figure out how to put up two different digits at the SAME TIME

Until you post your circuit (a photo of a hand drawn diagram is good enough) it is difficult to provide help. For instance, are you using shift registers to drive the display or are the digits multiplexed and are they common cathode or common anode displays ?

HKJ-lygte:
Use this sequence:

Turn all digits off
Setup all segments for next digit
Turn digit on
Wait 5 millis
Repeat for each digit
Repeat again to keep display on

And you are offering this advice knowing absolutely nothing about what the OP is attempting to do or what their understanding is? :roll_eyes:

Paul__B:
And you are offering this advice knowing absolutely nothing about what the OP is attempting to do or what their understanding is? :roll_eyes:

I read the program fragment he posted, it shows how the display is connected. His explanation says what he wants to do.

But it looks like he is a bit confused about common anode/cathode: Either a digit pin must be high and segment pins low to turn something on or the other way around. In the example he sets both high.

mahonston:
how to put up two different digits at the SAME TIME

The secret is... you can't ! With this type of display, only one digit can be lit at once.

But... You can light one digit, then the other, and swap between them so fast that to the eye it looks like they are both on. This is how it's almost always done with led displays. The effect is called "persistence of vision".

HKJ-lygte:
Either a digit pin must be high and segment pins low to turn something on or the other way around. In the example he sets both high.

That could be because the OP is using inverting buffer like uln2803 with a common cathode display. Then HIGH on anode pin and HIGH on arduino pin controlling cathode via uln chip would be correct.

But my guess is the OP has never heard of uln2803 and may not even be using current limiting resistors!

But my guess is the OP has never heard of uln2803 and may not even be using current limiting resistors!

Good guess, but my Poirot skills have seen this bit:-

  digitalWrite(D1,HIGH);
 digitalWrite(D2,HIGH);
 digitalWrite(D3,LOW);
 digitalWrite(D4,LOW);

This sets up what one of the four digits you are lighting up. Listen very carefully this is set up only once. ( hello hello ) So you first write a one and then immediately write a zero to the same digit. You will only ever see the zero, and perhaps some flickering on some of the other segments. So in HKJ-lygte's defense he has probably got this right. Although there are better ways of multiplexing using interrupts to trigger the next digit to be displayed, but that is for another day.

So to the op I say:-
Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

And when you post code post it all:- Post all your code