#include “HX711.h” #define DOUT 4 #define CLK 5 const int buttonPin = 2; int buttonState = 0; HX711 scale(DOUT, CLK); float calibration_factor = -9640.00; //-7050 worked for my 440lb max scale setup void setup() { Serial.begin(9600); Serial.println(“HX711 calibration sketch”); Serial.println(“Remove all weight from scale”); Serial.println(“After readings begin, place known weight on scale”); Serial.println(“Press + or a to increase calibration factor”); Serial.println(“Press – or z to decrease calibration factor”); scale.set_scale(); scale.tare(); //Reset the scale to 0 long zero_factor = scale.read_average(); //Get a baseline reading Serial.print(“Zero factor: “); //This can be used to remove the need to tare the scale. Useful in permanent scale projects. Serial.println(zero_factor); pinMode(buttonPin, INPUT); } void loop() { buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { scale.set_scale(); scale.tare(); //Reset the scale to 0 long zero_factor = scale.read_average(); //Get a baseline reading Serial.print(“Zero factor: “); //This can be used to remove the need to tare the scale. Useful in permanent scale projects. Serial.println(zero_factor); pinMode(buttonPin, INPUT); } scale.set_scale(calibration_factor); //Adjust to this calibration factor Serial.print(“Reading: “); float libbre = scale.get_units(); float kg = (libbre/2.2046); Serial.print(kg, 1); //scale.get_units() returns a float Serial.print(” kg”); Serial.print(” calibration_factor: “); Serial.print(calibration_factor); Serial.println(); if(Serial.available()) { char temp = Serial.read(); if(temp == ‘+’ || temp == ‘a’) calibration_factor += 10; else if(temp == ‘-‘ || temp == ‘z’) calibration_factor -= 10; } }