RSeries astromech firmware
HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS > Class Template Reference

#include <dome/HoloLights.h>

Detailed Description

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
class HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >

Controls the movement and display functions of a single Holoprojector.

Controls the movement and display functions of a single Holoprojector, by default Holoprojectors are 7 LED Neopixel boards inside a HP to produce a life-like emulation of a hologram projection. Servo control is managed by a ServoDispatcher instance.

Example usage:

HoloLights frontHolo(1);
HoloLights rearHolo(2);
HoloLights topHolo(3, 12);
+ Inheritance diagram for HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >:
+ Collaboration diagram for HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >:

Public Types

enum  HoloID {
  kFrontHolo = 1, kRearHolo = 2, kTopHolo = 3, kRadarEye = 4,
  kOtherHolo = 5
}
 
enum  HoloPosition {
  kDown, kCenter, kUp, kLeft,
  kUpperLeft, kLowerLeft, kRight, kUpperRight,
  kLowerRight, kNumPositions
}
 
enum  HoloColors {
  kOff = 0x000000, kRed = 0xFF0000, kOrange = 0xFF8000, kYellow = 0xFFFF00,
  kGreen = 0x00FF00, kCyan = 0x00FFFF, kBlue = 0x0000FF, kMagenta = 0xFF00FF,
  kPurple = 0x800080, kWhite = 0xFFFFFF
}
 

Public Member Functions

 HoloLights (const int id=0)
 Constructor. More...
 
void begin ()
 
void show ()
 
void setBrightness (uint8_t b)
 
uint8_t getBrightness ()
 
uint16_t numPixels ()
 
void setPixelColor (uint16_t n, uint32_t c)
 
virtual void handleCommand (const char *cmd) override
 Command Prefix: HP. More...
 
virtual void jawaCommand (char cmd, int arg, int value) override
 Subclasses should override this method to handle commands specifying a value. More...
 
virtual void animate () override
 Runs through one frame of animation for this holoprojector instance. More...
 
virtual void selectSequence (int sequence, int durationSec)
 Specify the sequence to animate. More...
 
void assignServos (ServoDispatch *dispatcher, byte hServo, byte vServo)
 Assign ServoDispatcher and servos for horizontal and vertical movement. More...
 
int getID ()
 
virtual void setup () override
 Configures the NeoPixel ring and centers the holoprojector if servos have been assigned. More...
 
void brighter ()
 Increase the brightness of the holoprojector. More...
 
void dimmer ()
 Decrease the brightness of the holoprojector. More...
 
void off ()
 Turn of all LEDs. More...
 
void setColor (int c)
 Set projector to a solid color. More...
 
void resetLEDTwitch ()
 
void resetHPTwitch ()
 
void setHoloPosition (float hpos, float vpos, int speed=0)
 
void moveHP (byte pos, int speed=0)
 Move holoprojector to the specified position. More...
 
void twitchHP (byte randtwitch)
 
void wagHP (byte type)
 
void setLEDTwitchInterval (unsigned minSeconds, unsigned maxSeconds)
 
void setLEDTwitchRunInterval (unsigned minSeconds, unsigned maxSeconds)
 
void setHPTwitchInterval (unsigned minSeconds, unsigned maxSeconds)
 
void dirty ()
 
- Public Member Functions inherited from HoloLEDPCB< DATA_PIN, GRB, 7 >
 HoloLEDPCB ()
 

Member Enumeration Documentation

◆ HoloColors

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
enum HoloLights::HoloColors
Enumerator
kOff 

Off.

kRed 

Red.

kOrange 

Orange.

kYellow 

Yellow.

kGreen 

Green.

kCyan 

Cyan.

kBlue 

Blue.

kMagenta 

Magenta.

kPurple 

Purple.

kWhite 

White.

◆ HoloID

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
enum HoloLights::HoloID
Enumerator
kFrontHolo 

Front holoprojector ID.

kRearHolo 

Rear holoprojector ID.

kTopHolo 

Top holoprojector ID.

kRadarEye 

Other holoprojector ID.

kOtherHolo 

Other holoprojector ID.

◆ HoloPosition

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
enum HoloLights::HoloPosition
Enumerator
kDown 

Holoprojector position down.

kCenter 

Holoprojector position center.

kUp 

Holoprojector position up.

kLeft 

Holoprojector position left.

kUpperLeft 

Holoprojector position upper left.

kLowerLeft 

Holoprojector position lower left.

kRight 

Holoprojector position right.

kUpperRight 

Holoprojector position upper right.

kLowerRight 

Holoprojector position lower right.

kNumPositions 

Total count.

Constructor & Destructor Documentation

◆ HoloLights()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::HoloLights ( const int  id = 0)
inline

Constructor.

Member Function Documentation

◆ animate()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
virtual void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::animate ( )
inlineoverridevirtual

Runs through one frame of animation for this holoprojector instance.

Implements AnimatedEvent.

Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.

◆ assignServos()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::assignServos ( ServoDispatch dispatcher,
byte  hServo,
byte  vServo 
)
inline

Assign ServoDispatcher and servos for horizontal and vertical movement.

◆ begin()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::begin ( )
inline

◆ brighter()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::brighter ( )
inline

Increase the brightness of the holoprojector.

◆ dimmer()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::dimmer ( )
inline

Decrease the brightness of the holoprojector.

◆ dirty()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::dirty ( )
inline

◆ getBrightness()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
uint8_t HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::getBrightness ( )
inline

◆ getID()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
int HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::getID ( )
inline
Returns
Holo projector ID (kFront, kRear, kTop, kOther)

◆ handleCommand()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
virtual void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::handleCommand ( const char *  cmd)
inlineoverridevirtual

Command Prefix: HP.

DT##C or DT##CS or DT##R or DT##P

D - the HP designator F - Front HP R - Rear HP T - Top HP D - Radar Eye O - Other HP A - All 3 HPs X - Front & Rear HPs Y - Front & Top HPs Z - Rear & Top HPs S - Sequences (See Below)

T - the Sequence Type is either 0-Led Fuctions and 1-Servo Functions

## - the Sequence Value including leading zero if necessary, ie sequence 3 is 03

C - (Optional), the Color integer value from list below:
    Basic Color Integer Values
        1 = Red
        2 = Yellow
        3 = Green
        4 = Cyan (Aqua)
        5 = Blue
        6 = Magenta
        7 = Orange
        8 = Purple
        9 = White
        0 = Random

S - (Optional), Speed setting integer for the Dim Pulse LED function below (0-9)

R - (Optional), Random State for clearing LED displays
    Random State Integer Values
        1 = Use Default Sequences
        2 = Use Random Sequences

P - (Optional), the Position integer value from list below:
    Preset Position Integer Values
        0 = Down
        1 = Center
        2 = Up
        3 = Left
        4 = Upper Left
        5 = Lower Left
        6 = Right
        7 = Upper Right
        8 = Lower Right

D001    - Leia Sequence, Random shades of blue to mimic Leia Hologram
D002C   - Color Projector Sequence, Like Leia above but using color command value
D003CS  - Dim Pulse Sequence, Color slowly pulses on and off
D004C   - Cycle Sequence, using color command value
D005C   - Toggles Color, Simply sets LEDs tp solid color value
D006    - Rainbow Sequence
D007C   - Short Circuit, Led flashes on and off with interval slowing over time
D096    - Clears LED, Disables Auto LED Sequence & "Off Color"
D0971   - Clears LED, Enables Auto LED Sequence,Enables Default Sequences, Disables "Off Color"
D0972   - Clears LED, Enables Auto LED Sequence,Enables Random Sequences, Disables "Off Color"
D098    - Clears LED, Disables Auto LED Sequence, enables "Off Color"
D0991   - Clears LED, Enables Auto LED Sequence,Enables Default Sequences, Enables "Off Color"
D0992   - Clears LED, Enables Auto LED Sequence,Enables Random Sequences, Enables "Off Color"

D101P   - Sends HP to a Preset Position
D102    - Enables RC Control on HP (Left/Right)
D103    - Enables RC Control on HP (Up/Down)
D104    - Sends HP to a Random Position
D105    - Wags HP Left/Right 5 times
D106    - Wags HP Up/Down 5 times
D198    - Disables Auto HP Twitch
D199    - Enables Auto HP Twitch

  S1    - Leia Mode (Front HP in Down Position, Leia LED Sequence, all other HPs disabled)*
  S2    - Play R2 Cartoon [OLED]
  S3    - Play Deathstar Plans movie [OLED]
  S4    - Clear all LEDs, Disable Auto HP Twitch, Disable Auto LED Sequence, Disables Off Color
  S5    - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ default seqs.),
          Disables Off
  S9    - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ random seqs.),
          Disables Off Color
  S7    - Clear all LEDs, Disable Auto HP Twitch, Disable Auto LED Sequence, Enables Off Color
  S8    - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ default seqs.),
          Enables Off Color
  S9    - Clear all LEDs, Enable Auto HP Twitch, Enable Auto LED Sequence (w/ random seqs.),
          Enables Off Color

Runtime values can be added to any command string by appending a pipe (|) followed by a numeric value indicating the desired time in seconds you wish the sequence to run.

e.g. A007|25 would run the Rainbow Sequence on all 3 HPs for 25 seconds then clear each one, returning to the system's last known auto twitch mode.

Implements CommandEvent.

Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.

◆ jawaCommand()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
virtual void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::jawaCommand ( char  cmd,
int  arg,
int  value 
)
inlineoverridevirtual

Subclasses should override this method to handle commands specifying a value.

Reimplemented from JawaEvent.

◆ moveHP()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::moveHP ( byte  pos,
int  speed = 0 
)
inline

Move holoprojector to the specified position.

◆ numPixels()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
uint16_t HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::numPixels ( )
inline

◆ off()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::off ( )
inline

Turn of all LEDs.

◆ resetHPTwitch()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::resetHPTwitch ( )
inline

◆ resetLEDTwitch()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::resetLEDTwitch ( )
inline

◆ selectSequence()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
virtual void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::selectSequence ( int  sequence,
int  durationSec 
)
inlinevirtual

Specify the sequence to animate.

Reimplemented in HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.

◆ setBrightness()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setBrightness ( uint8_t  b)
inline

◆ setColor()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setColor ( int  c)
inline

Set projector to a solid color.

1 = Red 2 = Yellow 3 = Green 4 = Cyan (Aqua) 5 = Blue 6 = Magenta 7 = Orange 8 = Purple 9 = White 0 = Random

◆ setHoloPosition()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setHoloPosition ( float  hpos,
float  vpos,
int  speed = 0 
)
inline

◆ setHPTwitchInterval()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setHPTwitchInterval ( unsigned  minSeconds,
unsigned  maxSeconds 
)
inline

◆ setLEDTwitchInterval()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setLEDTwitchInterval ( unsigned  minSeconds,
unsigned  maxSeconds 
)
inline

◆ setLEDTwitchRunInterval()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setLEDTwitchRunInterval ( unsigned  minSeconds,
unsigned  maxSeconds 
)
inline

◆ setPixelColor()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setPixelColor ( uint16_t  n,
uint32_t  c 
)
inline

◆ setup()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
virtual void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::setup ( )
inlineoverridevirtual

Configures the NeoPixel ring and centers the holoprojector if servos have been assigned.

Implements SetupEvent.

Reimplemented in HoloOLED< DATA_PIN, RGB_ORDER, NUM_LEDS >, and HoloDisplay< DATA_PIN, RGB_ORDER, NUM_LEDS >.

◆ show()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::show ( )
inline

◆ twitchHP()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::twitchHP ( byte  randtwitch)
inline

◆ wagHP()

template<uint8_t DATA_PIN, uint32_t RGB_ORDER = GRB, uint16_t NUM_LEDS = 7>
void HoloLights< DATA_PIN, RGB_ORDER, NUM_LEDS >::wagHP ( byte  type)
inline

The documentation for this class was generated from the following file:
HoloLights
Controls the movement and display functions of a single Holoprojector.
Definition: HoloLights.h:57