Skip to content

felixthecat8a/Felix8A

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Felix8A

GitHub Release License: MIT GitHub repo file or directory count GitHub repo size GitHub code size in bytes GitHub top language

GitHub Created At GitHub Release Date GitHub commit activity GitHub commits since latest release GitHub last commit

An Arduino Library toolkit for handling 32-bit hexadecimal colors in my projects.

Installation

Install via ZIP file

  1. Download the .zip file of the latest release.
  2. In the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library....
  3. Select the downloaded .zip file.

Updating the Library

To update the library:

  1. Delete the existing Felix8A folder from your libraries directory: Documents > Arduino > libraries > Felix8A
  2. Follow the installation steps above to install the latest version.

Implementation

#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
}

Implementing Felix8A::Time

#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
}

Felix8A::Time As a One-shot Timer

#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!");
  }
}

About

An Arduino Library toolkit for handling 32-bit hexadecimal colors in my projects.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages