【问题标题】:time.time () in python vs MicroPythonpython 与 MicroPython 中的 time.time()
【发布时间】:2020-11-27 05:52:27
【问题描述】:

我正在尝试使用 micro python 在 pyboard 上运行 python 代码。但是 Python 中的 time.time() 以秒为单位返回浮点时间。例如:12345678.12345678 在 micro python 中它只返回以秒为单位的时间。 例如:12345678 micro python 中是否有一种方法可以提供与 python 相同的准确性?它适用于python,但不适用于微型python。循环在 micro python 中第一次迭代后停止,条件不满足。

当真时:

# GAUGE DATA
if start_reading:
    t0 = time.time()
    while time.time() - t0 <1:
        data = ser_gauge.readline()
        print(data)
        if len(data) > 0:
            command = data

【问题讨论】:

标签: python micro


【解决方案1】:

嵌入式软件通常没有浮点精度来显示亚秒级精度

time.time() docs micropython

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-10
    • 2021-11-20
    • 2011-09-02
    • 1970-01-01
    • 2021-02-03
    • 1970-01-01
    相关资源
    最近更新 更多