Question: PLEASE HELP I have used this code to get reading from a load cell, however, I need to record it where the serial monitor has
PLEASE HELP
I have used this code to get reading from a load cell, however, I need to record it where the serial monitor has a limit on it, and doesn't record data every mili second. I need the load cell to record only if the data measures between 1 to 2 lbs. And I want it to take the average and give me one reading.
#include "HX711.h"
#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUT 3 #define CLK 2 HX711 scale;
void setup() { Serial.begin(9600); constrain(2, 0, 4); // limits range of sensor values to between 0 and 4 Serial.println("Weight of barrel"); scale.begin(DOUT, CLK); scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to long zero_factor = scale.read_average(); //Get a baseline reading }
void loop() { Serial.print("Reading: "); Serial.print(scale.get_units(), 1); //scale.get_units() returns a float Serial.print(" lbs"); //You can change this to kg but you'll need to refactor the calibration_factor Serial.println(); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
