//code for a line clock #include #define NUM_LEDS 12 #define DATA_PIN 4 // Change this to match your LED strip's data pin #define BRIGHTNESS 60 CRGB leds[NUM_LEDS]; uint8_t pos = 0; bool toggle = false; int hour=17; int minute=54; int second=0; void setup() { FastLED.addLeds(leds, NUM_LEDS); FastLED.setBrightness(BRIGHTNESS); } void loop() { uint8_t ledRed = (hour * NUM_LEDS) / 24; leds[ledRed] = CRGB::Red; uint8_t ledBlue =(minute * NUM_LEDS) / 60; leds[ledBlue] = CRGB::Blue; uint8_t ledGreen =(second * NUM_LEDS) / 60; leds[ledGreen] = CRGB::Green; FastLED.show(); //compute next time second++; if( second == 60 ) { second=0; minute++; } if( minute ==60 ) { minute=0; hour = (hour++ ) % 24; } // clear this led for the next time around the loop leds[ledRed] = CRGB::Black; leds[ledBlue] = CRGB::Black; leds[ledGreen] = CRGB::Black; delay(1000); }