Timer Camera Use With UIFlow

Driver Installation

Connect the device to the PC. If the port cannot be recognized normally, the user can manually install the FTDI driver to fix the problem. Take the win10 environment as an example, download the driver file that matches the operating system, unzip it, and install it through the device manager. (Note: In some system environments, the driver needs to be installed twice for the driver to take effect. The unrecognized device name is usually M5Stack or USB Serial. Windows recommends using the driver file to install directly in the device manager (custom Update), the executable file installation method may not work properly). Click here to download FTDI driver

For MacOS users, please tick System Preferences -> Security and Privacy -> General -> Allow downloadable apps from the following locations -> App Store and Approved Developer Options .

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

wifiCfg.auto_connect()

ticks_ms = 0
old_tick = 0

scr = lv.scr_act()
scr.clean()

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
            try:
                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})
                    img.set_src(img_dsc)
                    del img_dsc
            except (KeyboardInterrupt, Exception) as e:
                print('Speaker caught exception {} {}'.format(type(e).__name__, e))
                break
        else:
            pass
    else:
        wifiCfg.auto_connect()
On This Page