Here I’ll walk you through how to change a few aspects of your Astropixel setup so you can fine tune the settings to your liking.
First step, you will need to have your Arduino IDE setup and ready. There are 1000’s of tutorials out there on installing libraries and configuring it, so I will just give the bare info needed here. If you need more help, feel free to reach out to me.
The main library needed is the ReelTwo library. You can download the zip file from the releases page on github. You will also need to make sure the IDE is setup to program ESP32 boards. Other libraries you will need to install through the library manager are:
HPs by default come on at a random time between 45 and 180 seconds, for between 5 and 25 seconds at a time. To tweak those settings you can just use:
Where with setLEDTwitchInterval sets the min and max times between the lights coming on, and setLEDTwitchRunInterval sets the min and max amount of time the LEDs are on for.
For the PSIs you can create a new definition. The PSIs use the LogicEngine code, the same as the main Logics.
LogicEngineSettings LogicEngineFrontPSICustom( LogicEngineDefaults::FRONT_FADE, LogicEngineDefaults::FRONT_HUE, LogicEngineDefaults::FRONT_DELAY, LogicEngineDefaults::FRONT_PSI_PAL, LogicEngineDefaults::FRONT_BRI, LogicEngineDefaults::sequence(LogicEngineDefaults::PSICOLORWIPE,LogicEngineDefaults::kRed)); AstroPixelFrontPSI<> frontPSI(LogicEngineFrontPSICustom, 4);
The simplest change you can make is to the colours used. This is set in the LogicEngineDefaults::sequence(LogicEngineDefaults::PSICOLORWIPE,LogicEngineDefaults::kRed)); section. Change the kRed to a different value.
|Primary Colour||Secondary Colour|
Logics are configure using a set of values much like the PSIs:
static LogicEngineSettings LogicEngineFLDCustom( LogicEngineDefaults::FRONT_FADE, LogicEngineDefaults::FRONT_HUE, LogicEngineDefaults::FRONT_DELAY, LogicEngineDefaults::FRONT_PAL, LogicEngineDefaults::FRONT_BRI, LogicEngineDefaults::sequence(LogicEngineDefaults::NORMAL));
The hue setting rotates the selected palette around a colour wheel using a value between 0 and 255. So by combining this with a palette you can make various different colours of lights. In general the order is:
red -> yellow -> green -> cyan -> blue -> violet -> pink -> red
For instance, if you set the palette to 2 (monotone red) and then set the hue to around 220, you will get a nice R2-KT colour.
DELAY and FADE
These effect the transition of the hues.
There are 5 palettes to currently choose from.
- 0 – Default front colours
- 1 – Default rear colours
- 2 – Monotone red
- 3 – Dual colour red and yellow
- 4 – blue and red
- 5 – yellow and green
This is just the brightness of the display as a value between 0 and 255. The defaults are normally ok but you can tweak them. Beware of both heat and power consumption if you raise it too high.
Also, the last option is for the default sequence that the display will run. This was needed to make the PSI default to the swipe, but could also be used to have the logics do a different effect constantly such as a line swiping left and right (cylon droid?!)
For any of the Logic Engine based systems such as the PSIs or Logics, you can pass a parameter to the template. So instead of:
AstroPixelRLD<> RLD(LogicEngineRLDDefault, 3);
You can pass the new pin number in the <>. Like this:
AstroPixelRLD<2> RLD(LogicEngineRLDDefault, 3);
This means you can even run more than one set of a type of logics, etc. So if you have an R7 or R8 dome, they need two front logics. You can run one off the default pin, and a second set off another custom pin.
The pins for holos can be changed just in the definition parameters.
I have made a bunch of other pins available on the breakout board so you can use it for more than just the standard Astropixels parts. For instance you could drive a bad motivator, magic panel, or even a periscope from it. The ESP32 supplied has plenty of room for expansion of the code, with the basic sketch only taking up 25% of the program storage space and 6% of the dynamic memory!
The extra pins are:
- AUX 1 – Pin 2
- AUX 2 – Pin 4
- AUX 3 – Pin 5
- AUX 4 – Pin 18
- AUX 5 – Pin 19
You can either use the code already in the ReelTwo library, or just expand the basic sketch with your own functions. If you think the code will be useful for others tho, you could also expand ReelTwo with more functions and push it back in for others to use.