SevSeg.h and LiquidCrystal_I2C.h not working together

Hello everyone.
I am working a project where I want to use a LCD Screen and a 4 Seven Segment Display

problem
The 4 seven segment display does not display anything when I initialize the LCD in the void setup

lcd.init();
lcd.clear();
lcd.backlight();

Without these 3 lines the 4 seven segment display works. My code is provided below.

My guess is that both libraries use I2C

Please suggest me a solution and Thank you in advance.

#include "SevSeg.h" 
SevSeg sev_disp;

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,1);

#define r_led 24
#define y_led 26
#define g_led 28

int button = 30;
int button_state = 0;

int count = 10; 
int newcount;
int i = 1;

unsigned long previous_time = 0;
unsigned long current_time;

void setup() {

  Serial.begin(9600);
  pinMode(r_led, OUTPUT);
  pinMode(y_led, OUTPUT);
  pinMode(g_led, OUTPUT);
  pinMode(button, INPUT_PULLUP);

  lcd.init(); 
  lcd.clear();          
  lcd.backlight();  

  byte numDigits = 2;
  //                  D1, D2, 
  byte digitPins[] = {2, 3 }; 
  //                    A, B, C, D, E, F, G, DP 
  byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};

  bool resistorsOnSegments = true; // 'false' means resistors are on digit pins 
  byte hardwareConfig = COMMON_ANODE; // See README.md for options 
  bool updateWithDelays = false; // Default 'false' is Recommended 
  bool leadingZeros = true; // Use 'true' if you'd like to keep the leading zeros 
  bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected 
  
  //Initialize sevseg object. 
  sev_disp.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, 
  updateWithDelays, leadingZeros, disableDecPoint); 
  sev_disp.setBrightness(90);

}

void loop(){

  current_time = millis();

  if(current_time - previous_time == 1000){
    previous_time = current_time;
    newcount = count - 1;
    count = newcount; 
    sev_disp.setNumber(count, 0);
    if (count == 0) count = 11;
  }

  sev_disp.refreshDisplay();
  
} 

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.