Skip to content

Instantly share code, notes, and snippets.

Stefan Petrick StefanPetrick

Block or report user

Report or block StefanPetrick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@morningdew76
morningdew76 / ColorFromPalette12.ino
Last active Oct 22, 2018
ColorFromPalette12, a 12-bit ColorFromPalette function
View ColorFromPalette12.ino
CRGB ColorFromPalette12(CRGBPalette16 pal, uint16_t index, uint8_t brightness, TBlendType blendType) {
//index is a 12-bit number, range 0-4095
//uint8_t hi4 = lsrX4(index);
//uint8_t lo4 = index & 0x0F;
uint8_t hi4 = (index & 0x0F00) >> 8; //***shift 8 bits to the right instead of 4
uint8_t lo8 = index & 0xFF; //***keep right 8 bytes instead of right 4 bytes
// const CRGB* entry = &(pal[0]) + hi4;
// since hi4 is always 0..15, hi4 * sizeof(CRGB) can be a single-byte value,
@StefanPetrick
StefanPetrick / circular_matrix.ino
Last active Dec 16, 2019
A 2d matrix mapped onto a circular led setup
View circular_matrix.ino
/*
* A FastLED example showing how to
* map a virtual 2d matrix onto a circular led setup
*
* limitations: works so far only up to 255 leds
*
* written by Stefan Petrick 2016
*/
#include "FastLED.h"
You can’t perform that action at this time.