![]() |
ME507 Airheads Project v1.1.0
Flight Stabilization for Glider
|
Class for a generic potentiometer which is used to determine its position. More...
#include <potentiometer.h>
Public Member Functions | |
| Potentiometer (uint8_t pin, float offset) | |
| Constructor for the potentiometer class. More... | |
| float | get_voltage (void) |
| The method to retrieve the voltage at the input pin. More... | |
| float | get_angle (void) |
| The method to return the position of the potentiometer. More... | |
| void | zero (void) |
| The method to zero the potentiometer to its current position. More... | |
Public Attributes | |
| uint16_t | adc_value |
| ADC value from the GPIO input pin. | |
| float | voltage |
| Input voltage from ADC reading. | |
Class for a generic potentiometer which is used to determine its position.
| Potentiometer::Potentiometer | ( | uint8_t | pin, |
| float | offset | ||
| ) |
Constructor for the potentiometer class.
Constructor which creates a potentiometer object.
| pin | The GPIO input pin to read voltages from |
| offset | The offset values used to zero the potentiometer |
| float Potentiometer::get_angle | ( | void | ) |
The method to return the position of the potentiometer.
Measures position of the potentiometer.
| float Potentiometer::get_voltage | ( | void | ) |
The method to retrieve the voltage at the input pin.
Measures the voltage at the input pin.
| void Potentiometer::zero | ( | void | ) |
The method to zero the potentiometer to its current position.
Zeros the position of the potentiometer by setting the offset voltage to the voltage measured at its current position.