#include "TM1637.h"

const int CLK = 4;
const int DIO = 2;

TM1637 tm(CLK, DIO);


unsigned int counter = 0;

#include "HX711.h"

HX711 scale;

void setup() {
  tm.init();
  tm.set(BRIGHT_TYPICAL); 

  scale.begin(21, 19);

 

// calibrate scale
  scale.set_scale();                       // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();  
  delay(1000);
  scale.get_units(10);   
  scale.set_scale(2478/5.9);           // print the average of 5 readings from the ADC minus tare weight (not set) divided

  
 
 
}

void loop() {
  float cc = scale.get_units();
  int c1= int(cc*10);
  tm.display(0, (c1 / 1000) % 10);
  tm.display(1, (c1 / 100) % 10);
  tm.display(2, (c1 / 10) % 10);
  tm.display(3, c1 % 10);
                       // put the ADC in sleep mode
  delay(200);
 // scale.power_up();
}

4-Digit Display