kartonman

Pixel houses turn on and off

Aug 31st, 2021 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. // Now lets have the house lights come on one by one randomly over a short time from 19:30 and off in the same manner at 07:10 ...
  2. if (isBetweenTimes(19,30,07,10)){
  3. EVERY_N_MILLISECONDS(10) { // Increase no. of ms to turn the lights on more slowly
  4. if (random8() == 0) { // Every 10 ms we have a 1 in 256 chance of lighting an LED
  5. leds[houses[random8(housesLength)]] = CRGB::Yellow;
  6. }
  7. }
  8. }
  9. //...and outside of these hours have them slowly turn off
  10. else {
  11. EVERY_N_MILLISECONDS(10) {
  12. if (random8() == 0) {
  13. leds[houses[random8(housesLength)]] = CRGB::Black;
  14. }
  15. }
  16. }
Add Comment
Please, Sign In to add comment