I'm looking to calibrate a load cell and for some reason, when I open both the serial monitor and plotter, they both come up blank. My plotter is set to the corresponding 9600 baud, however, this doesn't seem to change anything.
here is the code below:
#include "HX711.h"
#include <Servo.h> // Include the Servo library
#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define LOADCELL_DOUT_PIN 3
#define LOADCELL_SCK_PIN 2
int servoPin = 5; // Declare the Servo pin
HX711 scale;
Servo Servo1; // Create a servo object
float units;
void setup() {
Serial.begin(9600);
Serial.println("HX711 scale demo");
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
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 0
Serial.println("Readings:");
Servo1.attach(servoPin); // We need to attach the servo to the used pin number
}
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();
Serial.print("Reading: ");
units = scale.get_units(10);
if (units > 3.35 && units < 3.45)
{
Servo1.write(180);
delay(1000);
Serial.print("Success. Door is now OPEN!");
}
else
{
Servo1.write(0);
delay(1000);
Serial.print("Success. Door is now CLOSED!");
}
}
here are screenshots of the potter and monitor: