Sentinel
Loading...
Searching...
No Matches
Battery Class Reference

Public Member Functions

void begin ()
 Initializes the battery monitoring system.
 
float getBatteryStatus ()
 Gets the battery status as a percentage based on the voltage.
 
int percent ()
 Gets the battery percentage based on the voltage.
 
uint32_t getBatteryVoltage ()
 Gets the current battery voltage in millivolts.
 
float readVoltage ()
 Reads the battery voltage in volts.
 
void getUpdate ()
 Gets the battery update every 10 seconds.
 
void powerSaveMode ()
 Enters power save mode by putting the device into deep sleep for a short duration.
 
void deepSleep (uint32_t ms)
 Puts the device into deep sleep mode for a specified duration.
 
bool isPowerOn (int pin)
 Checks if the power pin is on.
 
void turnOnPower (int pin)
 Turns on the power pin.
 
void turnOffPower (int pin)
 Turns off the power pin.
 
void safetyShutdown ()
 Initiates a safety shutdown due to low battery voltage.
 
void setRGB (int percent)
 Sets the RGB LED color based on battery percentage.
 

Member Function Documentation

◆ deepSleep()

void Battery::deepSleep ( uint32_t ms)

Puts the device into deep sleep mode for a specified duration.

Parameters
msDuration in milliseconds

◆ getBatteryStatus()

float Battery::getBatteryStatus ( )

Gets the battery status as a percentage based on the voltage.

Returns
float

◆ getBatteryVoltage()

uint32_t Battery::getBatteryVoltage ( )

Gets the current battery voltage in millivolts.

Returns
uint32_t

◆ isPowerOn()

bool Battery::isPowerOn ( int pin)

Checks if the power pin is on.

Parameters
pin
Returns
true
false

◆ percent()

int Battery::percent ( )

Gets the battery percentage based on the voltage.

Returns
int

◆ readVoltage()

float Battery::readVoltage ( )

Reads the battery voltage in volts.

Returns
float

◆ setRGB()

void Battery::setRGB ( int percent)

Sets the RGB LED color based on battery percentage.

Parameters
percent

◆ turnOffPower()

void Battery::turnOffPower ( int pin)

Turns off the power pin.

Parameters
pin

◆ turnOnPower()

void Battery::turnOnPower ( int pin)

Turns on the power pin.

Parameters
pin

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