Clock

Clock module that calculates the time spent during shooting

1. Module Method

1.1. Get timestamp

Get the timestamp from boot to now, in ms. Similar to the ticks_ms method of the time module

import clock
clock.ticks()

Parameters

no

return value

  • Timestamp from boot to current, in ms

1.2. Sleep

Let the machine sleep for a while, in ms, similar to the sleep_ms method of the time module

Clock.sleep(ms)

Parameters

  • ms: time of sleep

return value

no

2. clock类

The clock module can create the clock class, and the clock class can calculate the frame rate.

2.1. Initialization

clk = clock.clock()

Parameters

no

return value

  • objects of type clock

2.2. Get timestamp

Get the current timestamp

Parameters

no

return value

no

2.3. Calculating frame rate

Parameters

no

return value

  • Frame rate value of int type

3. Routine

import sensor
import image
import lcd
import clock
clock = clock.clock()
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
while True:
    clock.tick()
    img = sensor.snapshot()
    print("fps = ",clock.fps())

results matching ""

    No results matching ""