MCH2022 badge?
go to

Timer rev. 1 (by Pixtxa)


Stopwatch and countdown timer for card10

If variables.json is present, you can switch the app or shutdown your card10 without loosing your timer data, but the app needs to be running to execute the alarm. If variables.json is deleted, the app won't write data to flash and runs a little smoother (if the file is empty, the app will fill it, so you can recreate it easily).

The counters are based on the system time, so changing it will result in also changing the timers. So be sure to start your timer after setting the correct system time (or don't change it until your $pizza is done).

Picture of Card10 running the app:


  • Top: MIN:SEC
  • Left: clock time
  • Right: DAYS+HOURS (Stopwatch) or the countdown time that you have set
  • Bottom: Bar from start-time to 00:00 (only in timer mode) + battery info
  • Colors:
    • Blue: Stopwatch mode
    • Green: Timer mode
    • Yellow: Alarm mode (blinking stopwatch when timer reached 00:00, automatically deactivates after 99:59 minutes)


  • TOP_RIGHT: START/STOP (long press to switch back to your main app)

If alarm is active, you can set the clock back to 00:00 with one of the bottom buttons, START/STOP will reuse the time displayed in bottom right corner.

Auto switch app

If you want to switch automatically to your Timer, include the following lines to your app's startup:

import os
import ujson
import utime

if 'timer' in os.listdir('/apps'):
    if 'variables.json' in os.listdir('/apps/timer'):
        f = open('/apps/timer/variables.json', 'r')
            variables = ujson.loads(
            if "mode" and "runstamp" in variables:
                if variables["mode"] == 1:
                    SWITCHTOTIMER = variables["runstamp"]                

And also include this two lines somwhere in the main while-loop:

if SWITCHTOTIMER > 0 and SWITCHTOTIMER <= utime.time_ms()+3000:

The +3000 mean switching 3 seconds (=3000 ms) before alarm goes off, so you can see the countdown.

Project is based on which was based on and somebody named lortas made the battery rendering code or so. And some other projects and helped also.

Thanks to the card10 and hatchery team and all others for making this possible and all the nice people I've met at CCCamp2019.

Pixtxa is not good at programming, so the code isn't nice and bugs may be included. Testing before release was done in under 5 minutes, so, yeah, I hope it works...

Category: utility
Status: working
Vote Comment Date
No votes yet :(
  • card10: working
  • No dependencies found
Dependants Author: Pixtxa

File Last edited Size 2019-11-20 01:46:05 14.39 KiB 2019-11-20 14:34:25 2.82 KiB
variables.json 2019-11-20 01:46:05 75 B 2019-11-20 14:25:31 780 B