Arduino 7 segment 4 digit

I have trouble getting the display to do as I want it. I'm using the library from here, where I just follow the example given. However, "8.8.8.8." just shows up instead. Why is that?

//D1 = pin 2 ... D4 = pin 5
//a = pin 6
//b = pin 7 etc...
//dp = pin 13

void setup() {
   byte numDigits = 4;
   byte digitPins[] = {2, 3, 4, 5};
   byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
   sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins);
}

void loop() {
  sevseg.setNumber(3.141,3); 
  sevseg.refreshDisplay();
}

Is that the complete program ?

How is the display wired ?

That is the complete program. It is wired as:

d1 = pin 2 d2 = pin 3 d3 = pin 4 d4 = pin 5

a = pin 6 b = pin 7 c = pin 8 ... dp = pin 13

That is the complete program

Should it not #include the sevseg library ?

It is included, I just forgot to put it in, heh. Sorry, I'm kinda tired at the moment

This code is before the setup()

#include "SevSeg.h"

const int red_led = 2;
const int green_led = 3;
int knap = 4;

SevSeg sevseg;

However, "8.8.8.8." just shows up instead.

That makes me think that you have a wiring fault as all segments are lit.

I just rewired it all - again. Same problem, only displaying "8.8.8.8.".

sevseg.setNumber(3.141,3);

try the example of

sevseg.setNumber(3141,3);

or

sevseg.setNumber(3.141f,3);

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Also a picture of your project so we can see your layout.

What is the part number of your displays?

Thanks.. Tom... :slight_smile:

I drew the circuit in fritz. There are 2 * 6 pins on my display, so in total 12. I couldn't find a display that only had 12 pins, so ignore the 2 outer left pins on the top and bottom.

About the part number, I'm not sure if this is what you're looking for, but this is on the display: SH5461AS

SOLUION: I forgot to check if it was common anode or common cathode. My display was common cathode, but my code specified common anode. Thanks for the help :slight_smile: