![]() |
RSeries astromech firmware
|
#include <dome/NeoPixelPSI.h>
NeoPixelPSI by Darren Poulson daz@r 2djp .co.u k
NeoPixelPSI are very simple and cheap boards, in reality just a string of neopixels on a disk. This class will configure them to act as standard PSIs for R2.
For more info:
https://r2djp.co.uk/category/electronics/neopixel-psi/
Example Code:
Public Types | |
enum | EffectValue { kNormalVal = 0 } |
enum | Sequence { kNormal = 0 , kSolid = 1 , kHeart = 2 , kMalf = 3 } |
enum | PSIID { kFrontPSI = 1 , kRearPSI = 2 } |
Public Member Functions | |
virtual void | setup () override |
Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More... | |
NeoPixelPSI (int psi_pin, int psi_size=5) | |
Constructor. More... | |
void | selectEffect (long inputNum) |
Select the specified effect using a 32-bit integer. More... | |
virtual void | handleCommand (const char *cmd) override |
Command Prefix: PS. More... | |
void | setSequence (Sequence seq=kNormal, uint8_t speedScale=0, uint8_t numSeconds=0) |
Select the specified effect sequence. More... | |
virtual void | animate () |
Subclasses must implement this function to run through a single frame of animation/activity. More... | |
void | set_brightness (int bright) |
Set the brightness of the PSI. More... | |
virtual void | set_color (int c, int r, int g, int b) |
set the colors of the PSI More... | |
void | set_speed (int s) |
Set the speed the swipe effect moves at. More... | |
void | set_delay (int d) |
Set the delay between swipes. More... | |
void | set_stickiness (int s) |
Set the 'stickiness'. More... | |
![]() | |
AnimatedEvent () | |
Default Constructor. More... | |
void | setLoopDoneCallback (AnimatedLoopDone loopProc) |
Public Attributes | |
Adafruit_NeoPixel | leds |
Additional Inherited Members | |
![]() | |
static void | process () |
Calls animate() for each created AnimatedEvent subclass. More... | |
enum NeoPixelPSI::PSIID |
|
inline |
Constructor.
Pass the pin number for the PSI and optionally the size of the PSI (for denser pixel counts)
|
inlinevirtual |
Subclasses must implement this function to run through a single frame of animation/activity.
Subclasses should not call delay() or otherwise block.
Implements AnimatedEvent.
|
inlineoverridevirtual |
Command Prefix: PS.
Implements CommandEvent.
|
inline |
Select the specified effect using a 32-bit integer.
|
inline |
Set the brightness of the PSI.
Send a value from 0-255 to set the brightness, the higher the number the brighter it is
Don't set 255 straight away, these can be bright. Typical value is between 20-50
|
inlinevirtual |
set the colors of the PSI
|
inline |
Set the delay between swipes.
Set how many ms between swipes. The actual value will be between
and
*4
|
inline |
Set the speed the swipe effect moves at.
Lower the number, the faster the swipe. This is in ms Typical value is around 75
|
inline |
Set the 'stickiness'.
To simulate the original PSI 'sticking' halfway through a swipe, you can set the percentage chance of the swipe halting for a period (as set in set_delay()).
Default: 0 Range: 0-100
|
inline |
Select the specified effect sequence.
|
inlineoverridevirtual |
Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.
Implements SetupEvent.
Adafruit_NeoPixel NeoPixelPSI::leds |