Serial monitor and plotter coming up blank

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:


Is that all of your code?

Yes

We will ask that question again, and this time think very carefully before you answer. Is that all your code?

1 Like

It doesn't compile, so how you expect to see anything on screen beats me

Woopsy, just realised I didn’t have the whole thing pasted properly. I’ve just updated it now anyways

The code has now been updated to the full one

Thankyou!

Ok, well, the serial plotter is unlikely to show anything with that code, but you should be able to see something on serial monitor.

Have you selected the correct port? For example COM1 or /dev/ttyUSB0 or something?

What kind of Arduino are you using?

My thoughts exactly, it should at least show something.

Yes the correct port is selected )which is COM4 only instance)

I am using an Arduino Nano

Hmm... What if you click the Nano's reset button while serial monitor is already up? Do you see the "HX711 scale demo" message?

Do you have anything connected to pins 0 or 1?

Hitting reset doesn't seem to do much. Also I have nothing connected pins 0 & 1

Well, using Serial Monitor is one of the most basic functions of Arduino, so something pretty basic must be wrong if it isn't working...

Can you upload the basic example Blink sketch and confirm the built-in led flashes?

Can you upload the basic example DigitalReadSerial sketch, attach a button and see the output in serial monitor?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.