Hey Guys, new to arduino and need some help!
I have a load scale all calibrated and working. What I am trying to do is measure time between two events.
Event one: weight off scale leaves (Load Scale reads less than 10 lbs)
Event two: weight comes back onto the scale (Load Scale reads greater than 10 lbs)
How can i track (measure) the time when the weight is off the scale accurately?
And then use the time that was measured for another part in my coding?
Thank you guys so much for your help, these forums have seriously saved me!
Thanks,
Ty
Here is what my code looks like:
#include <SparkFun_Qwiic_Scale_NAU7802_Arduino_Library.h>
#include <HX711.h>
#include "HX711.h"
#define DOUT 3
#define CLK 2
HX711 scale;
float calibration_factor = -180000; //-180000 calibration is what worked
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.begin(DOUT, CLK);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); // Remove the need to tare the scale.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust my calibration factor
Serial.print("Reading: ");
Serial.print(scale.get_units(), 1);
Serial.print(" lbs"); //Change this to kg if needed
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(scale.get_units() < -10)
{Serial.println("Available ");
}
else
{Serial.println("Unavailable ");
}
}