Library for controlling onboard hardware components including HEX display, LED stripe, and RGB LED. More...
#include <HTL_onboard.h>
Public Member Functions | |
HTL_onboard () | |
void | begin () |
Initializes the HTL_onboard library. | |
void | writeHex (int8_t hexNumber) |
Writes a hexadecimal number to the HEX display. | |
void | writeInt (int8_t intNumber) |
Writes an integer to the HEX display. | |
void | writeChar (char c) |
Display a character on the 7-segment display. | |
void | writeBinary (int binValue) |
Writes a binary value to the LED stripe. | |
void | writeProgress (int progressValue) |
Writes a value to the LED stripe in Progress Bar form. | |
void | setLED (int pin) |
Sets a specific LED on the LED stripe. | |
void | clearLED (int pin) |
Clears a specific LED on the LED stripe. | |
void | clearStripe () |
Clears all LEDs on the LED stripe (turns them off). | |
void | setRGB (uint8_t red, uint8_t green, uint8_t blue) |
Sets the RGB LED to the specified color. | |
int | readSwitchState () |
Reads the state of the switches. | |
int | readPot () |
Reads the potentiometer value. | |
void | setMode (int mode, bool state) |
Sets the mode of the HTL_onboard. | |
void | cfgSwitches (int switch1Threshold, int switchNoneThreshold, int switch12Threshold) |
Configures the switch thresholds. | |
void | updateMultiplex () |
Updates all displays. Call this function in loop() | |
void | setModesMultiplex (const int modes[], int size) |
Sets the modes which are used to display in multiplex operation. | |
void | setMultiplexInterval (int multiplexInterval) |
Sets the interval for multiplexing between different display modes. | |
void | setHexMode (int mode) |
Sets the display mode of the HEX display. | |
int | getHexMode () |
Gets the current display mode of the HEX display. | |
void | setHexNumber (int number) |
Sets the number to be displayed on the HEX display. | |
int | getHexNumber () |
Gets the number/character currently displayed on the HEX display. | |
void | setChar (char c) |
Sets the character to be displayed on the HEX display. | |
void | setString (String str) |
Sets the string to be displayed on the HEX display. | |
String | getString () |
Gets the string to be displayed on the HEX display. | |
void | setStripeMode (int mode) |
Sets the display mode of the LED Stripe. | |
int | getStripeMode () |
Gets the current display mode of the LED Stripe. | |
void | setRGB_Multiplex (uint8_t red, uint8_t green, uint8_t blue) |
Sets the RGB Values used in Multiplex Mode. | |
void | setRed (uint8_t r) |
Sets the intensity of the red component of the RGB LED. | |
void | setGreen (uint8_t g) |
Sets the intensity of the green component of the RGB LED. | |
void | setBlue (uint8_t b) |
Sets the intensity of the blue component of the RGB LED. | |
uint8_t | getRed () |
Gets the intensity of the red component of the RGB LED. | |
uint8_t | getGreen () |
Gets the intensity of the green component of the RGB LED. | |
uint8_t | getBlue () |
Gets the intensity of the blue component of the RGB LED. | |
void | setStringDelay (int stringDelay) |
Sets the delay of how long to display a character in string display mode. | |
int | getStringDelay () |
Gets the delay of how long to display a character in string display mode. | |
void | setLedStripeValue (int value) |
Sets the value of the LED stripe. | |
int | getLedStripeValue () |
Gets the current value of the LED stripe. | |
Library for controlling onboard hardware components including HEX display, LED stripe, and RGB LED.
This library provides functions to control various onboard hardware components of the HTL Uno, including a HEX display, LED stripe, and RGB LED. It allows for displaying hexadecimal and integer values on the HEX display, controlling individual LEDs on the LED stripe, setting colors on the RGB LED, reading switch states, and reading the value of a potentiometer.
Tobias Weich 2024
HTL_onboard::HTL_onboard | ( | ) |
void HTL_onboard::begin | ( | ) |
Initializes the HTL_onboard library.
Sets up pin modes for all necessary pins.
void HTL_onboard::cfgSwitches | ( | int | switch1Threshold, |
int | switchNoneThreshold, | ||
int | switch12Threshold ) |
Configures the switch thresholds.
switch1Threshold | Threshold for switch 1. |
switchNoneThreshold | Threshold for no switch pressed. |
switch12Threshold | Threshold for both switches pressed. |
void HTL_onboard::clearLED | ( | int | pin | ) |
Clears a specific LED on the LED stripe.
This function turns off the specified LED on the LED stripe by setting its corresponding pin to HIGH.
pin | The pin number of the LED to clear (0 to 9). |
void HTL_onboard::clearStripe | ( | ) |
Clears all LEDs on the LED stripe (turns them off).
uint8_t HTL_onboard::getBlue | ( | ) |
Gets the intensity of the blue component of the RGB LED.
uint8_t HTL_onboard::getGreen | ( | ) |
Gets the intensity of the green component of the RGB LED.
int HTL_onboard::getHexMode | ( | ) |
Gets the current display mode of the HEX display.
int HTL_onboard::getHexNumber | ( | ) |
Gets the number/character currently displayed on the HEX display.
int HTL_onboard::getLedStripeValue | ( | ) |
Gets the current value of the LED stripe.
uint8_t HTL_onboard::getRed | ( | ) |
Gets the intensity of the red component of the RGB LED.
String HTL_onboard::getString | ( | ) |
Gets the string to be displayed on the HEX display.
int HTL_onboard::getStringDelay | ( | ) |
Gets the delay of how long to display a character in string display mode.
int HTL_onboard::getStripeMode | ( | ) |
Gets the current display mode of the LED Stripe.
int HTL_onboard::readPot | ( | ) |
Reads the potentiometer value.
int HTL_onboard::readSwitchState | ( | ) |
Reads the state of the switches.
void HTL_onboard::setBlue | ( | uint8_t | b | ) |
Sets the intensity of the blue component of the RGB LED.
b | The intensity of the blue component (0 to 255). |
void HTL_onboard::setChar | ( | char | c | ) |
Sets the character to be displayed on the HEX display.
c | The character to display (ASCII). |
void HTL_onboard::setGreen | ( | uint8_t | g | ) |
Sets the intensity of the green component of the RGB LED.
g | The intensity of the green component (0 to 255). |
void HTL_onboard::setHexMode | ( | int | mode | ) |
Sets the display mode of the HEX display.
mode | The mode to set (0 for HEX, 1 for Decimal, 2 for Character). |
void HTL_onboard::setHexNumber | ( | int | number | ) |
Sets the number to be displayed on the HEX display.
number | The number to display (-15 to 15 in HEX mode, -19 to 19 in Decimal mode). |
void HTL_onboard::setLED | ( | int | pin | ) |
Sets a specific LED on the LED stripe.
pin | The pin number of the LED to set (0 to 9). |
void HTL_onboard::setLedStripeValue | ( | int | value | ) |
Sets the value of the LED stripe.
value | The value to set (0 to 1023). |
void HTL_onboard::setMode | ( | int | mode, |
bool | state ) |
Sets the mode of the HTL_onboard.
mode | The mode to set (0 for HEX, 1 for LED stripe, 2 for RGB). |
state | The state to set the mode to (true for active, false for inactive). |
void HTL_onboard::setModesMultiplex | ( | const int | modes[], |
int | size ) |
Sets the modes which are used to display in multiplex operation.
modes | array of modes that are displayed in Multiplex mode. (0 for HEX, 1 for LED stripe, 2 for RGB) |
void HTL_onboard::setMultiplexInterval | ( | int | multiplexInterval | ) |
Sets the interval for multiplexing between different display modes.
This function sets the interval, in milliseconds, for how frequently the system cycles through the different active display modes (HEX, LED stripe, RGB). The provided interval must be non-negative.
multiplexInterval | The time interval in milliseconds for multiplexing. Must be a non-negative integer. |
void HTL_onboard::setRed | ( | uint8_t | r | ) |
Sets the intensity of the red component of the RGB LED.
r | The intensity of the red component (0 to 255). |
void HTL_onboard::setRGB | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue ) |
Sets the RGB LED to the specified color.
red | The red intensity (0 to 255). |
green | The green intensity (0 to 255). |
blue | The blue intensity (0 to 255). |
void HTL_onboard::setRGB_Multiplex | ( | uint8_t | red, |
uint8_t | green, | ||
uint8_t | blue ) |
Sets the RGB Values used in Multiplex Mode.
red | The red intensity (0 to 255). |
green | The green intensity (0 to 255). |
blue | The blue intensity (0 to 255). |
void HTL_onboard::setString | ( | String | str | ) |
Sets the string to be displayed on the HEX display.
The string gets displayed character by character, with each character being displayed for strDelay (ms). Displaying strings is only supported for Multiplex mode, for Hex_mode only use setChar or only activate HEX mode
str | The string to display (ASCII). |
void HTL_onboard::setStringDelay | ( | int | stringDelay | ) |
Sets the delay of how long to display a character in string display mode.
ms | The delay in ms. |
void HTL_onboard::setStripeMode | ( | int | mode | ) |
Sets the display mode of the LED Stripe.
mode | The mode to set (0 for Binary, 1 for Progress). |
void HTL_onboard::updateMultiplex | ( | ) |
Updates all displays. Call this function in loop()
void HTL_onboard::writeBinary | ( | int | binValue | ) |
Writes a binary value to the LED stripe.
binValue | The binary value to display (0 to 1023). |
void HTL_onboard::writeChar | ( | char | c | ) |
Display a character on the 7-segment display.
Displaying characters is supported in Multiplex mode
This function attempts to display the provided character on the 7-segment display. If the character is not directly supported, it will attempt to display the uppercase or lowercase equivalent. If the character is still unsupported, it defaults to displaying '0'.
c | The character to display. |
void HTL_onboard::writeHex | ( | int8_t | hexNumber | ) |
Writes a hexadecimal number to the HEX display.
hexNumber | The hexadecimal number to display (-1F to 1F). |
void HTL_onboard::writeInt | ( | int8_t | intNumber | ) |
Writes an integer to the HEX display.
intNumber | The integer number to display (-19 to 19). |
void HTL_onboard::writeProgress | ( | int | progressValue | ) |
Writes a value to the LED stripe in Progress Bar form.
progressValue | The progress value to display (0 to 10). |