/* Project: 3x3x3 Mono LED Cube (r3). * File: MVFlashy.cpp * Description: * Movie -- mv_Flashy * Fades all LEDs in and out at random speeds. * * Copyright (C) 2014 Marc Symonds * All rights reserved. * * This software may be used and redistribtued, 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_Flashy() { unsigned long ts; byte y; Light lights[27]; for (y = 0 ; y < 27 ; y++) { lights[y].speed = random(50, 200); lights[y].up = true; lights[y].t = millis() + lights[y].speed; } ts = millis() + DEF_MOVIE_TIME; y = 0; while (millis() < ts) { if (millis() > lights[y].t) { displayFrame[y] += (lights[y].up ? 1 : -1); if (displayFrame[y] == 0 || displayFrame[y] == 7) lights[y].up = !lights[y].up; lights[y].t = millis() + lights[y].speed; } if (++y > 26) y = 0; } df_fadeOut(); }
Recent Comments