This digital clock use thyme to control the segments display and count the time.
Improved version over my first Digital Clock.
Press "1" to increment the hours, "2" to increment the minutes, "9" to start or stop the timer. If you hold "0" you can see the seconds.
Notes:
. Unlike my first version, the clock is stopped after you load up the scene, press "9" to start the clock.
. I've remapped the keys so it doesn't conflict with the Phun tools' key shortcuts.
. The seconds counter is reset if you increment the minutes.
. In case the simulation goes too slow, go to "File -> New Scene" to clean up and "File -> Load Scene..." to load this scene again.
Have phun!
Extras (can be changed anytime in the console):
scene.my.ledon - Color when the LEDs are lit (Default: [0.4, 1.0, 0.4, 1.0] )
scene.my.ledoff - Color when the LEDs are off. (Default: [0.0, 0.25, 0.0, 1.0] )
scene.my.ledbg - Color of the LEDs display background. (Default: {scene.my.ledoff} )
scene.my.secs - Get/Set seconds counter
scene.my.mins - Get/Set minutes counter
scene.my.hours - Get/Set hours counter
scene.my.viewsecs - 0 = Hours:Mins, 1 = Mins.Secs
scene.my.count_dir - 0 = Count Up, 1 = Count Down, 2 = Don't count
scene.my.blinkingdots - 0 = Dots are always lit, 1 = Blink per second.
scene.my.hook_counter - Code that is called per second ( yep, you can hook your own code! ).
Note:
if you modify scene.my.secs, scene.my.mins, scene.my.hours or scene.my.viewsecs in the console, the changes will only be visible after 1 clock count ( ok, ok, you can call scene.my.disp_refresh if you want
).
The View Secs switch (Key "0") will override scene.my.viewsecs .
Example, 12 hours clock:
-----------------------------------
scene.my.hook_counter = {
scene.my.hours >= 12 ? {scene.my.hours = 0} : {};
}
Example, count down:
-------------------------------
Set the number of minutes (you can do this by starting the simulation and press "2" to increment the minutes).
scene.my.count_dir = 1;
scene.my.hook_counter = {
scene.my.viewsecs = 1;
scene.my.hours == 0 && scene.my.mins == 0 && scene.my.secs == 0 ? {
scene.my.count_dir = 2;
scene.my.blinkingdots = 0;
} : {};
}