![]() |
8x8 Led Matrix Library 1.0.0
This is a library for the 8x8 Led Matrix by Soldered
|
#include <MD_RobotEyes.h>
Classes | |
struct | animFrame_t |
struct | animTable_t |
Public Types | |
enum | emotion_t { E_NONE , E_NEUTRAL , E_BLINK , E_WINK , E_LOOK_L , E_LOOK_R , E_LOOK_U , E_LOOK_D , E_ANGRY , E_SAD , E_EVIL , E_EVIL2 , E_SQUINT , E_DEAD , E_SCAN_UD , E_SCAN_LR } |
Public Member Functions | |
MD_RobotEyes (void) | |
~MD_RobotEyes (void) | |
void | begin (Led_Matrix *M, uint8_t moduleStart=0) |
void | setAnimation (emotion_t e, bool r, bool b=false) |
void | setBlinkTime (uint16_t t) |
void | setAutoBlink (bool b) |
bool | setText (const char *pText) |
bool | runAnimation (void) |
Protected Types | |
enum | animState_t { S_IDLE , S_RESTART , S_ANIMATE , S_PAUSE , S_TEXT } |
Protected Member Functions | |
void | loadEye (uint8_t module, uint8_t ch) |
void | drawEyes (uint8_t L, uint8_t R) |
uint8_t | loadSequence (emotion_t e) |
void | loadFrame (animFrame_t *pBuf) |
void | showText (bool bInit=false) |
void | dumpSequence (const animFrame_t *pBuf, uint8_t numElements) |
Protected Attributes | |
Led_Matrix * | _M |
uint16_t | _sd |
uint32_t | _timeStartPause |
uint32_t | _timeLastAnimation |
uint16_t | _timeBlinkMinimum |
animState_t | _animState |
bool | _autoBlink |
uint16_t | _scrollDelay |
animTable_t | _animEntry |
int8_t | _animIndex |
bool | _animReverse |
bool | _autoReverse |
emotion_t | _nextEmotion |
const char * | _pText |
Static Protected Attributes | |
static const animFrame_t | seqBlink [] |
static const animFrame_t | seqWink [] |
static const animFrame_t | seqLeft [] |
static const animFrame_t | seqRight [] |
static const animFrame_t | seqUp [] |
static const animFrame_t | seqDown [] |
static const animFrame_t | seqAngry [] |
static const animFrame_t | seqSad [] |
static const animFrame_t | seqEvil [] |
static const animFrame_t | seqEvil2 [] |
static const animFrame_t | seqSquint [] |
static const animFrame_t | seqDead [] |
static const animFrame_t | seqScanUpDown [] |
static const animFrame_t | seqScanLeftRight [] |
static const animTable_t | lookupTable [] |
Robot Eyes Class. This class manages the displayed of animated eyes using LED matrices using the functions provided by the Led_Matrix library.
|
protected |
Emotions enumerated type.
This enumerated type defines the emotion animations available in the class for the eyes display
MD_RobotEyes::MD_RobotEyes | ( | void | ) |
Class Constructor.
Instantiate a new instance of the class.
|
inline |
Class Destructor.
Released any allocated memory and does the necessary to clean up once the object is no longer required.
void MD_RobotEyes::begin | ( | Led_Matrix * | M, |
uint8_t | moduleStart = 0 ) |
Initialize the object.
Initialize the object data. This needs to be called during setup() to initialize new data for the class that cannot be done during the object creation.
Outside of the class, the Led_Matrix library should be initialized and the pointer to the Led_Matrix object passed to the parameter. Also, as the eyes could be in the middle of a string of LED modules, the first 'eye' module can be specified.
/param M Pointer to the Led_Matrix library object. /param moduleStart The first 'eye' LED module. Defaults to 0 if not specified.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool MD_RobotEyes::runAnimation | ( | void | ) |
Animate the display.
This method needs to be invoked as often as possible to ensure smooth animation.
The calling program should monitor the return value for 'true' in order to know when the animation has concluded. A 'true' return value means that the animation is complete.
|
inline |
Set the animation type and parameters.
Set the next animations to the specified. Additionally, set whether the animation should auto reverse the action (eg, blink down then back up again) and whether the animation should be run in reverse.
Animations are generally symmetric, so only half the animation needs to be specified. If an animated expression needs to be held, the animation should be run without auto reverse, which holds the animation at the end point, and then later run the animation in reverse from the last position to return to the idle state.
e | The type of emotion to be displayed, one of the emotion_T enumerated values. |
r | If true, run auto reverse. |
b | If true, start the animation from the end of the sequence. |
|
inline |
Set or reset auto blink mode.
When no animation is running and AutoBlink is set, the eyes will occasionally blink.
b | Set auto blink if true, reset auto blink if false. |
|
inline |
Set the blink time.
When no animation is running and AutoBlink is set, the eyes will occasionally blink. Set the minimum time period between blinks. A blink will occur a random time after this.
t | The minimum time between blinking actions in milliseconds. |
|
inline |
Display a text message.
At the end of the current animation, the text will be scrolled across the 'eyes' and then the eyes are returned to the neutral expression
p | A pointer to a char array containing a nul terminated string. The string must remain in scope while the message is being displayed. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |