/* Project: 3x3x3 Mono LED Cube (r3). * File: MVTwinkleAll.cpp * Description: * Movie -- mv_TwinkleAll * All LEDs are randomly faded in an out. * Similar to mv_Flashy, but with a subtle difference. * * Copyright (C) 2014 Marc Symonds * All rights reserved. * * This software may be used and redistributed, with or without * modification, as long as it is understood that this software * is provided as-is without any explicit or implied warranties * of merchantablity or fitness of purpose. */ #include "Arduino.h" #include "Movies.h" #include "DisplayFrame.h" void mv_TwinkleAll() { unsigned long ts; byte x; byte m[27]; ts = millis() + DEF_MOVIE_TIME; for (x = 0 ; x < 27 ; x++) m[x] = (displayFrame[x] == MAXBRIGHTNESSLEVEL); while (millis() < ts) { for (x = 0 ; x < 27 ; x++) { if (m[x]) { if (random(10) > 6) { if (--displayFrame[x] == 0) m[x] = false; } } else { if (random(10) > 4) { if (++displayFrame[x] >= MAXBRIGHTNESSLEVEL) m[x] = true; } } } delay(50); } df_fadeOut(); }
Recent Comments