TeensyNanoExoCode
Loading...
Searching...
No Matches
Namespaces | Variables
StatusLed.h File Reference

Class to set an RGB LED to different colors based on the state of the system. More...

#include "Arduino.h"
#include "Board.h"
#include "StatusDefs.h"
Include dependency graph for StatusLed.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  status_led_defs
 define how each message will be displayed.
 
namespace  status_led_defs::colors
 colors each message should display
 
namespace  status_led_defs::patterns
 patterns to use for each message
 

Variables

const int status_led_defs::colors::off [] = {0, 0, 0}
 
const int status_led_defs::colors::trial_off [] = {0, 0, 255}
 
const int status_led_defs::colors::trial_on [] = {0, 255, 0}
 
const int status_led_defs::colors::test [] = {0, 255, 0}
 
const int status_led_defs::colors::torque_calibration [] = {255, 255, 0}
 
const int status_led_defs::colors::fsr_calibration [] = {255, 0, 255}
 
const int status_led_defs::colors::fsr_refinement [] = {255, 0, 255}
 
const int status_led_defs::colors::motor_start_up [] = {255, 68, 0}
 
const int status_led_defs::colors::error [] = {255, 0, 0}
 
const int status_led_defs::colors::warning [] = {255, 68, 0}
 
const uint8_t status_led_defs::patterns::solid = 0
 
const uint8_t status_led_defs::patterns::blink = 1
 
const uint8_t status_led_defs::patterns::pulse = 2
 
const uint8_t status_led_defs::patterns::rainbow = 3
 
const int status_led_defs::patterns::off [] = {solid, 0}
 
const int status_led_defs::patterns::trial_off [] = {solid,0}
 
const int status_led_defs::patterns::trial_on [] = {pulse, 500}
 
const int status_led_defs::patterns::test [] = {rainbow, 4000}
 
const int status_led_defs::patterns::torque_calibration [] = {solid, 0}
 
const int status_led_defs::patterns::fsr_calibration [] = {solid, 0}
 
const int status_led_defs::patterns::fsr_refinement [] = {pulse, 250}
 
const int status_led_defs::patterns::motor_start_up [] = {pulse, 4000}
 
const int status_led_defs::patterns::error [] = {blink, 250}
 
const int status_led_defs::patterns::warning [] = {blink, 250}
 
const uint8_t status_led_defs::on_state = logic_micro_pins::status_led_on_state
 
const uint8_t status_led_defs::off_state = logic_micro_pins::status_led_off_state
 
const bool status_led_defs::has_pwm = logic_micro_pins::status_has_pwm
 

Detailed Description

Class to set an RGB LED to different colors based on the state of the system.

Constructor: StatusLed(int r_pin, int g_pin, int b_pin) or (int r_pin, int g_pin, int b_pin, int brightness) The pins are the RGB LED pins ideally they are PWM but can also handle simple digital pins. In the header set NO_PWM to true or false depending on if you have PWM or simple digital pins. Brightness sets the brightness from 255 to 0, this is ignored for simple digital pins

updateLed(int message) method sets the color of the LED, these messages can be found in the preprocessor part of the header. setBrightness(int brightness) method is used to change the brightness after initialization.

Author
P. Stegall
Date
Dec. 2021