1
7
8#include "HX711.h"
9#define DOUT 3
10#define CLK 2
11
12HX711 scale(DOUT, CLK);
13#include <Wire.h>
14#include <LiquidCrystal_PCF8574.h>
15
16LiquidCrystal_PCF8574 lcd(0x3F);
17float calibration_factor = -96650;
18const int SW = 7;
19void setup()
20{
21 Wire.begin();
22 Wire.beginTransmission(0x3F);
23 pinMode(SW, INPUT_PULLUP);
24 lcd.setBacklight(255);
25 lcd.begin(16, 2);
26 lcd.setCursor(0,0);
27 lcd.print("Nissi 3kgLoadCell");
28 lcd.setCursor(0,1);
29 lcd.print("Press Sw to tare");
30 scale.set_scale(-849650);
31 scale.tare();
32}
33void loop()
34{
35 lcd.setCursor(0,1);
36 lcd.print("W = ");
37 lcd.setCursor(6,1);
38 lcd.print(scale.get_units(),3);
39 lcd.println(" kg ");
40 int x = digitalRead(SW);
41 if(x == LOW)
42 {
43 scale.tare();
44 }
45}
46