#include <FastLED.h>
#define NUM_LEDS 30
#define DATA_PIN 2
#define setBrightnes 255
CRGB LEDs[NUM_LEDS];
CRGB colorCRGB = CRGB::Red;
CHSV colorCHSV = CHSV(255, 255, 255);
volatile int colorMODE = 0;
void setup() {
FastLED.delay(3000);
// Check if you're LED strip is a RGB or GRB version (third parameter)
FastLED.addLeds<WS2812, DATA_PIN, GRB>(LEDs, NUM_LEDS);
}
void loop() {
displaySegments(0, 7);
displaySegments(7, 6);
displaySegments(16, 8);
displaySegments(23, 0);
FastLED.show();
}
void displaySegments(int startindex, int number) {
byte numbers[] = {
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b01100011, // º 10
0b00111001, // C(elcius) 11
0b01011100, // º lower 12
0b00000000, // Empty 13
0b01110001, // F(ahrenheit) 14
};
for (int i = 0; i < 7; i++) {
LEDs[i + startindex] = ((numbers[number] & 1 << i) == 1 << i) ? (colorMODE == 0 ? colorCRGB : colorCHSV) : CRGB::Black;
}
}