#include #define DATA_PIN 14 // A0 used as digital out #define NUM_LEDS 240 #define BASE_LEDS 60 CRGB leds[NUM_LEDS]; // Thermometer layout — must match ExploringUncertanties.ino const int NUM_SECTIONS = 8; const int LEDS_PER_SECTION = 7; const int ACTIVE_LEDS = NUM_SECTIONS * LEDS_PER_SECTION; // 56 const int START_LED = BASE_LEDS - ACTIVE_LEDS; // 4 const uint8_t DIM_BRIGHTNESS = 12; const uint8_t BRIGHT_BRIGHTNESS = 200; void setMirroredLED(int i, CRGB color) { if (i < 0 || i >= BASE_LEDS) return; leds[i] = color; leds[119 - i] = color; leds[120 + i] = color; leds[239 - i] = color; } CRGB getThermometerColor(int i) { // Lower half → solid blue, upper half → solid red int midpoint = START_LED + ACTIVE_LEDS / 2; // LED 32 return (i < midpoint) ? CRGB(0, 0, 180) : CRGB(180, 0, 0); } void displayTemperature(int sections) { int activeEnd = START_LED + sections * LEDS_PER_SECTION; for (int i = 0; i < BASE_LEDS; i++) { CRGB color; if (i < START_LED) { color = CRGB::Black; } else if (i < activeEnd) { // Active (bright): blue→red gradient uint8_t pos = (uint8_t)map(i, START_LED, BASE_LEDS - 1, 0, 255); color = blend(CRGB(0, 0, 180), CRGB(180, 0, 0), pos); color.nscale8(BRIGHT_BRIGHTNESS); } else { // Inactive (dim): solid blue (lower half) or solid red (upper half) color = getThermometerColor(i); color.nscale8(DIM_BRIGHTNESS); } setMirroredLED(i, color); } FastLED.show(); } void setup() { FastLED.addLeds(leds, NUM_LEDS); FastLED.setBrightness(84); } void loop() { for (int s = 0; s <= NUM_SECTIONS; s++) { displayTemperature(s); delay(1000); } }