ESP Line Following Buggy
2nd Year Embedded System Project (Group 48 - 2023/24)
Loading...
Searching...
No Matches
SensorArray Class Reference

Represents an array of sensors with corresponding LEDs for detection. More...

#include <sensor_array.h>

Public Member Functions

 SensorArray (PinName sens0, PinName sens1, PinName sens2, PinName sens3, PinName sens4, PinName sens5, PinName led0, PinName led1, PinName led2, PinName led3, PinName led4, PinName led5, int sample_count, float detect_range, float angle_coefficient)
 Constructs a new SensorArray object.
 
void reset (void)
 Resets the sensor array.
 
void update (void)
 Updates the sensor array.
 
bool is_line_detected (void)
 Checks if a line is detected (in the last update).
 
void set_all_led_on (bool status)
 Sets the status of all LEDs.
 
float get_sens_output (int index)
 Gets the output value of a sensor at the specified index.
 
float * get_sens_output_array (void)
 Gets an array of sensor output values.
 
float get_array_output (void)
 Gets the output value of the sensor array.
 
float get_filtered_output (void)
 
void calibrate_sensors (void)
 
float * get_calibration_constants (void)
 

Detailed Description

Represents an array of sensors with corresponding LEDs for detection.

This class provides functionality to read sensor values, detect lines, and control LEDs.

Definition at line 17 of file sensor_array.h.

Constructor & Destructor Documentation

◆ SensorArray()

SensorArray::SensorArray ( PinName sens0,
PinName sens1,
PinName sens2,
PinName sens3,
PinName sens4,
PinName sens5,
PinName led0,
PinName led1,
PinName led2,
PinName led3,
PinName led4,
PinName led5,
int sample_count,
float detect_range,
float angle_coefficient )

Constructs a new SensorArray object.

Parameters
sens0-sens5Pin names for the sensors.
led0-led5Pin names for the LEDs.
sample_countThe number of samples to take for averaging sensor readings.
detect_rangeThe detection threshold for line detection.
angle_coefficientThe gain at which the sensor output is multiplied to represent the angle.

Definition at line 9 of file sensor_array.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ calibrate_sensors()

void SensorArray::calibrate_sensors ( void )

Definition at line 166 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ get_array_output()

float SensorArray::get_array_output ( void )

Gets the output value of the sensor array.

Returns
The output value of the sensor array.

Definition at line 156 of file sensor_array.cpp.

◆ get_calibration_constants()

float * SensorArray::get_calibration_constants ( void )

Definition at line 185 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ get_filtered_output()

float SensorArray::get_filtered_output ( void )

Definition at line 161 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ get_sens_output()

float SensorArray::get_sens_output ( int index)

Gets the output value of a sensor at the specified index.

Parameters
indexThe index of the sensor.
Returns
The output value of the sensor.

Definition at line 142 of file sensor_array.cpp.

◆ get_sens_output_array()

float * SensorArray::get_sens_output_array ( void )

Gets an array of sensor output values.

Returns
A pointer to an array of sensor output values.

Definition at line 151 of file sensor_array.cpp.

◆ is_line_detected()

bool SensorArray::is_line_detected ( void )

Checks if a line is detected (in the last update).

Returns
True if a line is detected, false otherwise.

Definition at line 136 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ reset()

void SensorArray::reset ( void )

Resets the sensor array.

This function resets the internal state of the sensor array.

Definition at line 22 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ set_all_led_on()

void SensorArray::set_all_led_on ( bool status)

Sets the status of all LEDs.

Parameters
statusThe status to set (true for on, false for off).

Definition at line 35 of file sensor_array.cpp.

Here is the caller graph for this function:

◆ update()

void SensorArray::update ( void )

Updates the sensor array.

This function updates the sensor readings.

Definition at line 44 of file sensor_array.cpp.

Here is the caller graph for this function:

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