An Arduino Library toolkit for handling 32-bit hexadecimal colors in my projects.
- Download the .zip file of the latest release.
- In the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library....
- Select the downloaded .zip file.
To update the library:
- Delete the existing Felix8A folder from your libraries directory: Documents > Arduino > libraries > Felix8A
- Follow the installation steps above to install the latest version.
#include <Felix8A.h>
const uint32_t colorArray[] = {
Felix8A::Color::RED,
Felix8A::Color::ORANGE,
Felix8A::Color::GREEN,
Felix8A::Color::BLUE,
Felix8A::Color::WHITE
};
const Felix8A::Palette ColorPalette(colorArray);
const int numColors = ColorPalette.size();
void setup() {
// setup code
}
void loop() {
// code
}#include <Felix8A.h>
unsigned long lastUpdate = 0;
const unsigned long timeInterval = 1000;
void setup() {
// setup code here
}
void loop() {
if (Felix8A::Time::every(timeInterval, lastUpdate)) {
// loop code here
}
/* similar behavior */
// if (Felix8A::Time::after(timeInterval, lastUpdate)) {
// // loop code here
// Felix8A::Time::reset(lastUpdate); // reset the timer
// }
}inside functions
void myFunction {
if (!Felix8A::Time::after(3000, lastUpdate)) {
return;
}
// code
}#include <Felix8A.h>
unsigned long startTime = 0;
bool done = false;
void setup() {
Serial.begin(115200);
Felix8A::Time::reset(startTime);
}
void loop() {
if (!done && Felix8A::Time::after(3000, startTime)) {
done = true;
Serial.println("3 seconds passed!");
}
}