ME 507 Romi++
Cylindrical Differential Drive Robot created for ME 507 at Cal Poly in Spring 2025
Loading...
Searching...
No Matches
BATTERY_CHECK Class Reference

A finite state machine for monitoring battery voltage. More...

#include <battery_check.h>

Public Types

enum  state { S0_INIT , S1_CHECK_ADC , S2_BATTERY_LOW }
typedef enum BATTERY_CHECK::state state_t

Public Member Functions

 BATTERY_CHECK ()
 Constructor for the BATTERY_CHECK class.
void run (void)
 Executes one iteration of the battery check FSM.

Detailed Description

A finite state machine for monitoring battery voltage.

Uses ADC readings to determine if battery voltage is too low and triggers an indicator if necessary.

Member Enumeration Documentation

◆ state

Enumerator
S0_INIT 

Initialization state.

S1_CHECK_ADC 

Check ADC for battery level.

S2_BATTERY_LOW 

Battery is below acceptable threshold.

Constructor & Destructor Documentation

◆ BATTERY_CHECK()

BATTERY_CHECK::BATTERY_CHECK ( )

Constructor for the BATTERY_CHECK class.

Initializes the FSM to the S0_INIT state.

Member Function Documentation

◆ run()

void BATTERY_CHECK::run ( void )

Executes one iteration of the battery check FSM.

Reads ADC value and determines if battery is low.

Uses ADC readings to determine battery voltage level. If voltage falls below a threshold (~10.05V), an indicator LED is turned on. When the voltage rises above a recovery threshold (~10.20V), the LED is turned off. This ensures that the LED won't be constantly switching back and forth when the battery voltage decreases.


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