Device Functions
get_rtime
int days;
int hours;
int minutes;
int seconds;
int milliseconds;
main {
milliseconds += get_rtime();
if(milliseconds >= 1000) { // Check if we have 1000 or more milliseconds passed
milliseconds -= 1000 // Subtract 1000 from the milliseconds value, this ensures accuracy as the timing may not be precise
seconds++; // Increment the seconds counter
}
if(seconds == 60) { // Check if 60 seconds has passed (1 minute)
seconds = 0; // Reset the seconds counter to 0
minutes++; // Increment the minutes counter
}
if(minutes == 60) { // Check if 60 minutes has passed (1 hour)
minutes = 0; // Reset the minutes counter to 0
hours++; // Increment the hours counter
}
if(hours == 24) { // Check if 24 hours has passed (1 day)
hours = 0; // Reset the hours counter to 0
days++; // Increment the days counter
}
set_val(TRACE_1, milliseconds); // Output the milliseconds to TRACE_1
set_val(TRACE_2, seconds); // Output the seconds to TRACE_2
set_val(TRACE_3, minutes); // Output the minutes to TRACE_3
set_val(TRACE_4, hours); // Output the hours to TRACE_4
set_val(TRACE_5, days); // Output the days to TRACE_5
}get_slot
load_slot
get_ctrlbutton
vm_tctrl
set_rgb
set_hsb
Last updated

