-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweight_measurement.ino
31 lines (25 loc) · 1.21 KB
/
weight_measurement.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <SPI.h>
#include "HX711.h" //You must have this library in your arduino library folder
#define DOUT 12
#define CLK 13
HX711 scale(DOUT, CLK);
//Change this calibration factor as per your load cell once it is found you many need to vary it in thousands
float calibration_factor = -106600; //-106600 worked for my 40Kg max scale setup
//=============================================================================================
// SETUP
//=============================================================================================
void setup() {
Serial.begin(9600);
Serial.println("Press T to tare");
scale.set_scale(-106600); //Calibration Factor obtained from first sketch
scale.tare(); //Reset the scale to 0
}
//=============================================================================================
// LOOP
//=============================================================================================
void loop() {
Serial.print("Weight: ");
Serial.print(scale.get_units()*10, 3); //Up to 3 decimal points
Serial.println(" gms"); //Change this to kg and re-adjust the calibration factor if you follow lbs
delay(1000);
}