#include <LiquidCrystal_I2C.h>
#include <HX711.h>
#include <TM1637.h>

const int CLK = 25;
const int DIO = 26;

HX711 scale;
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);
TM1637 tm(CLK, DIO);

float weight = 0;
int LEDBARPINS[] = {15,2,0,4,16,17,5,18,19,23};
const int ledCount = 10;

void setup() {
  Serial.begin(115200);
  scale.begin(12, 14);
  scale.set_scale(420.f);
  scale.tare();
  tm.init();
  tm.set(BRIGHT_TYPICAL);
  lcd.init();
  lcd.backlight();
  lcd.home(); 
  lcd.print("Grams left: ");
  lcd.setCursor(0, 1);
  lcd.print("% used: ");
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(LEDBARPINS[thisLed], OUTPUT);
  }
}

void loop() {
  delay(1000); // this speeds up the simulation
  weight = scale.get_units(10);
  lcd.setCursor(12, 0);
  lcd.print(weight * 1000); //IRL will add some math to subtract the spool weight and such
  lcd.setCursor(8, 1);
  lcd.print((1 - weight) * 100); //Same math

  String fullValue = String(weight, 3);
  Serial.println(fullValue);
  tm.display(0, int(fullValue[0] - '0'));
  tm.display(1, int(fullValue[2] - '0'));
  tm.display(2, int(fullValue[3] - '0'));
  tm.display(3, int(fullValue[4] - '0'));

  int ledLevel = map((weight*100), 0, 100, 0, ledCount);
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    if (thisLed < ledLevel) {
      digitalWrite(LEDBARPINS[thisLed], HIGH);
    }
    else {
      digitalWrite(LEDBARPINS[thisLed], LOW);
    }
  }
}
$abcdeabcde151015202530fghijfghij
4-Digit Display