#include <led.h>
Led class Functions to control the various LEDs on the robot
Example:
#include "psiswarm.h"
int main() {
init();
}
Definition at line 42 of file led.h.
§ blink_leds()
void Led::blink_leds |
( |
float |
timeout | ) |
|
Turns on all outer LEDs for a period of time defined by timeout then restore their previous state
- Parameters
-
timeout | - The time (in seconds) to keep LEDs on |
Definition at line 71 of file led.cpp.
§ get_led_states()
unsigned short Led::get_led_states |
( |
void |
| ) |
|
Returns the current state of the outer LEDs
- Returns
- A 16-bit value when MSB represent the green states and LSB the red states of the 8 LEDs
Definition at line 33 of file led.cpp.
§ restore_led_states()
void Led::restore_led_states |
( |
void |
| ) |
|
Restore the LED states to those set usign store_led_states()
Definition at line 118 of file led.cpp.
§ save_led_states()
void Led::save_led_states |
( |
void |
| ) |
|
§ set_base_led()
void Led::set_base_led |
( |
char |
state | ) |
|
Set the state of the base LEDs [if fitted]
- Parameters
-
state | - 0 for off, 1 for on |
Definition at line 45 of file led.cpp.
§ set_center_led() [1/2]
void Led::set_center_led |
( |
char |
state | ) |
|
Set the state the center LED
- Parameters
-
state | - 0 for off, 1 for red, 2 for green, 3 for orange |
Definition at line 78 of file led.cpp.
§ set_center_led() [2/2]
void Led::set_center_led |
( |
char |
state, |
|
|
float |
brightness |
|
) |
| |
Set the state the center LED with brightness control
- Parameters
-
state | - 0 for off, 1 for red, 2 for green, 3 for orange |
brightness | - brightness of LED [PWM duty cycle] - range 0.0 to 1.0 |
Definition at line 83 of file led.cpp.
§ set_center_led_brightness()
void Led::set_center_led_brightness |
( |
float |
brightness | ) |
|
Set the brightness of center LED without changing state
- Parameters
-
brightness | - brightness of LED [PWM duty cycle] - range 0.0 to 1.0 |
Definition at line 107 of file led.cpp.
§ set_green_leds()
void Led::set_green_leds |
( |
char |
green | ) |
|
Set the green component of all 8 outer LEDs to the defined colour sequence
- Parameters
-
green | - An 8-bit description of the green leds eg(0b00000001) means that LED 7 green is on, rest are off |
Definition at line 50 of file led.cpp.
§ set_led()
void Led::set_led |
( |
char |
led, |
|
|
char |
state |
|
) |
| |
Set the state of an invididual outer LED without affecting other LEDs
- Parameters
-
led | - The LED to change state of (range 0 to 7) |
state | - 0 for off, 1 for red, 2 for green, 3 for orange |
Definition at line 62 of file led.cpp.
§ set_leds()
void Led::set_leds |
( |
char |
green, |
|
|
char |
red |
|
) |
| |
Set all 8 outer LEDs to the defined colour sequence
- Parameters
-
green | - An 8-bit description of the green leds eg(0b00000001) means that LED 7 green is on, rest are off |
red | - An 8-bit description of the red leds eg(0b11111110) means that LED 7 red is off, rest are on |
Definition at line 38 of file led.cpp.
§ set_red_leds()
void Led::set_red_leds |
( |
char |
red | ) |
|
Set the red component of all 8 outer LEDs to the defined colour sequence
- Parameters
-
red | - An 8-bit description of the red leds eg(0b11111110) means that LED 7 red is off, rest are on |
Definition at line 56 of file led.cpp.
The documentation for this class was generated from the following files:
- D:/GoogleDrive/PsiSwarm/Code/MBED Code/PsiSwarmV8_CPP/led.h
- D:/GoogleDrive/PsiSwarm/Code/MBED Code/PsiSwarmV8_CPP/led.cpp