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

Controller for managing water levels using a sensor and motor. More...

Collaboration diagram for WaterLevelController:
Collaboration graph

Public Member Functions

 ~WaterLevelController ()
 Destructor for WaterLevelController.
 
void checkWaterLevel (int gpio, int level, uint32_t tick)
 Function called by the GPIO library when the water level changes.
 
void startMotor ()
 Starts the motor if it is not already running.
 
void stopMotor ()
 Stops the motor if it is running.
 

Static Public Member Functions

static WaterLevelControllergetInstance ()
 Retrieves the singleton instance of the WaterLevelController.
 

Detailed Description

Controller for managing water levels using a sensor and motor.

This singleton class controls the operation of a motor based on the readings from a water level sensor. It ensures that the motor is activated when the water level is below a certain threshold and stops the motor once the water level is adequate.

Member Function Documentation

◆ checkWaterLevel()

void WaterLevelController::checkWaterLevel ( int gpio,
int level,
uint32_t tick )

Function called by the GPIO library when the water level changes.

Parameters
gpioGPIO pin number that triggered the alert.
levelNew level of the GPIO pin (high or low).
tickTime at which the change occurred.

◆ getInstance()

static WaterLevelController * WaterLevelController::getInstance ( )
inlinestatic

Retrieves the singleton instance of the WaterLevelController.

Returns
Pointer to the singleton instance.

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