SevSeg library blank function error

Hi. I'm working on a program that uses a 4-digit 7 segment display to show the time, according to which digital input is either high or low. As stated in the title i'm using the sevseg library to handle it, but when I attempt to call the sevseg.blank() function in order to clear the display when nothing is showing, a single segment of the first digit stays on permanently, making it even interfere with other numbers. Also, not using this function makes random segments stay lit when switching the state of the digital input.

Here's the code:

#include "SevSeg.h"
SevSeg sevseg;

bool entradaNumero1 = 0;             //means inputNumberX
bool entradaNumero2 = 0;
bool entradaNumero3 = 0;
bool entradaNumero4 = 0;
bool entradaNumero5 = 0;
bool entradaNumero6 = 0;
bool entradaNumero7 = 0;
int pinNumero1 = 32;                 //means pinNumberX
int pinNumero2 = 33;
int pinNumero3 = 34;
int pinNumero4 = 35;
int pinNumero5 = 36;
int pinNumero6 = 37;
int pinNumero7 = 38;


void setup() {
    pinMode(pinNumero1, INPUT);
    pinMode(pinNumero2, INPUT);
    pinMode(pinNumero3, INPUT);
    pinMode(pinNumero4, INPUT);
    pinMode(pinNumero5, INPUT);
    pinMode(pinNumero6, INPUT);
    pinMode(pinNumero7, INPUT);

    pinMode(entradaNumero1, OUTPUT);
    pinMode(entradaNumero2, OUTPUT);
    pinMode(entradaNumero3, OUTPUT);
    pinMode(entradaNumero4, OUTPUT);
    pinMode(entradaNumero5, OUTPUT);
    pinMode(entradaNumero6, OUTPUT);
    pinMode(entradaNumero7, OUTPUT);

  byte numDigits = 4;
  byte digitPins[] = {45, 44, 43, 42};
  byte segmentPins[] = {22, 23, 24, 25, 26, 27, 28};
  bool resistorsOnSegments = false;
  byte hardwareConfig = COMMON_CATHODE; 
  bool updateWithDelays = false; 
  bool leadingZeros = false; 
  bool disableDecPoint = true; 

  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
               updateWithDelays, leadingZeros, disableDecPoint);
  sevseg.setBrightness(90);
}

void loop() {
  /*static unsigned long timer = millis();
  static int numero = 0;

  if (millis() - timer >= 1000) {                              ignore
    timer += 1000;                                                this
    numero++;

    if (numero == 10) {
      numero = 0;
    }
    sevseg.setNumber(numero, 1);
  }
  
  sevseg.refreshDisplay();*/

  entradaNumero1 = digitalRead(pinNumero1);

  if(entradaNumero1 == LOW){
    sevseg.setNumber(100, 1);
    sevseg.refreshDisplay();
  }
  else {
    sevseg.blank();
  }

  entradaNumero2 = digitalRead(pinNumero2);

  if(entradaNumero2 == LOW){
    sevseg.setNumber(300, 1);
  }
  else {
    sevseg.blank();
  }

  entradaNumero3 = digitalRead(pinNumero3);

  if(entradaNumero3 == LOW){
    sevseg.setNumber(700, 1);
  }
  else {
    sevseg.blank();
  }

  entradaNumero4 = digitalRead(pinNumero4);

  if(entradaNumero4 == LOW){
    sevseg.setNumber(1100, 1);
  }
  else {
    sevseg.blank();
  }

  entradaNumero5 = digitalRead(pinNumero5);

  if(entradaNumero5 == LOW){
    sevseg.setNumber(1600, 1);
  }
  else {
    sevseg.blank();
  }

  entradaNumero6 = digitalRead(pinNumero6);

  if(entradaNumero6 == LOW){
    sevseg.setNumber(2000, 1);
  }
  else {
    sevseg.blank();
  }

  entradaNumero7 = digitalRead(pinNumero7);

  if(entradaNumero7 == LOW){
    sevseg.setNumber(2300, 1);
  }
  else {
    sevseg.blank();
  }
}

I apologize in advance for the language difference. I added some slight commentary in any case.

Here's the SevSeg GitHub page: GitHub - DeanIsMe/SevSeg: Seven segment display controller library for Arduino

Pictures: Imgur: The magic of the Internet

Without calling the sevseg.refreshDisplay() method at least 200 times a second, it won't work. As you commented that section out, it doesn't work and simply shows one part of the digit.

So I should be refreshing sevseg.blank() as well?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Do the schematic from your project, not from what you have copied, you may find a wiring fault.

Ops image;

Tom.. :slight_smile:
PS. Can you show an image with some figures displayed?

So I should be refreshing sevseg.blank() as well?

That call doesn't refresh another method but it's responsible to do the display. The LEDs in the display are turned on and off very quickly in turn to display all the digits although you don't need as many pins as the display has LEDs.

So call the refreshDisplay() method in every loop() round and don't use the delay() function at all!