pressure_sensor.begin(DOUT,SCLK);

image

CODE

#include "HX710B.h"

const int DOUT = 2; //sensor data pin
const int SCLK = 3; //sensor clock pin

HX710B pressure_sensor;

void setup() {
Serial.begin(9600);
pressure_sensor.begin(DOUT,SCLK);
}

void loop() {

if (pressure_sensor.is_ready()) {
Serial.print("PSI: ");
Serial.println(pressure_sensor.psi());
} else {
Serial.println("Pressure sensor not found.");
}

delay(1000);

}

ERROR WHILE UPLODING

C:\Users\pgnan\Downloads\hx710B_pressure_sensor-main\hx710B_pressure_sensor-main\examples\HX710B_Basic\HX710B_Basic.ino: In function 'void setup()':
C:\Users\pgnan\Downloads\hx710B_pressure_sensor-main\hx710B_pressure_sensor-main\examples\HX710B_Basic\HX710B_Basic.ino:10:19: error: 'class HX710B' has no member named 'begin'
pressure_sensor.begin(DOUT,SCLK);
^~~~~
C:\Users\pgnan\Downloads\hx710B_pressure_sensor-main\hx710B_pressure_sensor-main\examples\HX710B_Basic\HX710B_Basic.ino: In function 'void loop()':
C:\Users\pgnan\Downloads\hx710B_pressure_sensor-main\hx710B_pressure_sensor-main\examples\HX710B_Basic\HX710B_Basic.ino:15:23: error: 'class HX710B' has no member named 'is_ready'; did you mean 'isReady'?
if (pressure_sensor.is_ready()) {
^~~~~~~~
isReady
C:\Users\pgnan\Downloads\hx710B_pressure_sensor-main\hx710B_pressure_sensor-main\examples\HX710B_Basic\HX710B_Basic.ino:17:36: error: 'class HX710B' has no member named 'psi'
Serial.println(pressure_sensor.psi());
^~~

exit status 1

Compilation error: 'class HX710B' has no member named 'begin'

Before I try to read your code and figure out what you want please spend the time to read the forum guidelines and post your code using code tags. Since I cannot see what you have also post links to technical information on the hardware items and your preliminary schematic be sure to show all power, ground and power sources.

The code you have is either wrong, or not intended to be used with the library you included.

When using a new library, read the documentation and test the basic functions, starting with the library examples.

Code seems OK, but it can't find the HX710B library.
Did you install the library, and how.
Leo..

yes i installed the library by following link
https://github.com/kurimawxx00/hx710B_pressure_sensor/tree/main
and i also searched in library manager but that also not set to me

There are two HX710 libraries in the library manager of IDE 1.8.19.
Did you try them first?
Leo..

YES I TRIED BOTH
BY PBernalPolo and Andhie Setyabudi..
both not worked showing same error
Compilation error: 'class HX710' has no member named 'begin'; did you mean 'beginData'?

Compilation error: 'class HX710B' has no member named 'begin'

Everything points to the code not using the library.
So did you install them via the library manager?

Which Arduino. Your Fritzing shows an Uno R3.
Leo..



I am using Arduino Uno R3
I installed hx10b libalsirary

I installed the first HX710 library I saw in Library Manager.
It came with examples.
They use in setup()

ps.initialize( PD_SCK , DOUT );
not
pressure_sensor.begin(DOUT,SCLK);

Make sure you use the right code with the library that you're using.
Maybe remove all the HX710 libraries, and start again.
And restart the IDE after you have installed a new library.
Leo..

But you forgot to look at the examples in the library, to see if they matched the calls in your program, or test any of the library examples. See post #3.

From https://github.com/andhieSetyabudi/hx710b_arduino/blob/main/examples/reading_raw.ino

#include "HX710B.h"
#define SCK_PIN 3
#define SDI_PIN 4

HX710B air_press(SCK_PIN, SDI_PIN);

void setup()
{
    Serial.begin(115200);
    if ( !air_press.init() )
    { 
      Serial.println(F("HX710B not Found !"));
      while(1);
    }
}

uint32_t time_update = 0;
void loop()
{
    uint32_t rollOver = millis();
    if( rollOver < time_update )
      time_update = rollOver;
    if( millis() - time_update >= 2000UL )
    {
      uint32_t data_raw = 0;
      if ( air_press.read(&data_raw, 1000UL) != HX710B_OK )
        Serial.println(F("something error !"));
      else
      {
        Serial.print(F("Data raw of ADC is : "));
        Serial.println((unsigned long) data_raw);
      }
      time_update = millis();            
    }
}

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