PetCare
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
WeightSensor Class Reference

Class to handle weight measurements using a digital scale sensor. More...

Collaboration diagram for WeightSensor:
Collaboration graph

Public Member Functions

 ~WeightSensor ()
 Destructor for WeightSensor.
 
void start ()
 Start the weight measurement process.
 
void stop ()
 Stop the weight measurement process.
 
int getLatestWeight () const
 Get the latest measured weight.
 
int readWeight ()
 Read and calculate the current weight from the sensor.
 

Static Public Member Functions

static WeightSensorgetInstance ()
 Retrieves the singleton instance of the WeightSensor.
 

Detailed Description

Class to handle weight measurements using a digital scale sensor.

This singleton class provides an interface for reading weight measurements from a digital scale. It initializes the necessary GPIO pins for communication with the sensor and provides methods to start and stop the measurement process, as well as to read the weight values.

Member Function Documentation

◆ getInstance()

static WeightSensor * WeightSensor::getInstance ( )
inlinestatic

Retrieves the singleton instance of the WeightSensor.

Returns
Pointer to the singleton instance.

◆ getLatestWeight()

int WeightSensor::getLatestWeight ( ) const

Get the latest measured weight.

Returns
The latest weight in units after calibration and adjustment.

◆ readWeight()

int WeightSensor::readWeight ( )

Read and calculate the current weight from the sensor.

Returns
The calculated weight.

The documentation for this class was generated from the following file: