Timer Camera Use With UIFlow

Driver Installation

Before using TimerCAM series products, please visit the driver CP210X driver download page , and download the matching driver according to the operating system used.

Download M5Burner

According to your operating system, click the button below to download the corresponding M5Burner firmware burning tool. Unzip and open the application

Note: after installation of MacOS users, please put the application into the application folder, as shown in the figure below.

Note: For Linux users, please switch to the unzipped file path and run the application in the terminal.

Burning firmware

Open M5Burner-->Connect the device to the computer-->Select the corresponding port-->Switch to TIMERCAM option-->Select the appropriate version and click download-->Configure the appropriate parameters-->Click Burn to flash-->Waiting for the pop-up window successful indicates that the burning is complete

Get Token

-->ClickGet Token-->waiting for pop-up window Token, the displayed string is token. It can also be obtained by scanning the QR code or opened directly in the browser.

UIFlow Program

At present, the development of UIFlow blockly of TimerCamera is in progress, but you can still get pictures in uiflow by the following methods. The following example sends the pictures to M5 core host for display

The URL filled in HTTP is the generated token QR code (browser address), which is manually added "lcd.image (0, 0, req.content )" The acquired image will be displayed on the screen.

Core2 Example

import urequests
import time
import wifiCfg
import lvgl as lv


ticks_ms = 0
old_tick = 0

scr = lv.scr_act()

img = lv.img(scr)

while True:
    if wifiCfg.is_connected():
        ticks_ms = time.ticks_ms()
        if time.ticks_diff(ticks_ms, old_tick) > 40000:
            old_tick = ticks_ms
                req = urequests.get("http://api.m5stack.com:5003/timer-cam/image?tok=xxxxxxxxxYOUR-TOKENxxxxxxxxx&width=320&high=240&decode=png")
                if (req.status_code) == 200:
                    print("Len: " + str(len(req.content)))
                    img_dsc = lv.img_dsc_t({
                                        "data_size": len(req.content),
                                        "data": req.content})
                    del img_dsc
            except (KeyboardInterrupt, Exception) as e:
                print('Speaker caught exception {} {}'.format(type(e).__name__, e))
On This Page