main.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:aws-iot-python 作者: vjammar 项目源码 文件源码
def stopwatch(hexUID, name):
    start = time.time()
    time.clock()
    elapsed = 0
    while elapsed < maxRaceTime and GPIO.input(laserPin) != GPIO.LOW:
        elapsed = time.time() - start
        millis = int(round(elapsed * 1000))
        hours, millis = divmod(millis, 3600000)
        minutes, millis = divmod(millis, 60000)
        seconds, millis = divmod(millis, 1000)
        s = "%02i:%02i:%03i" % (minutes, seconds, millis)
        with canvas(disp) as draw:
                draw.text((0, 0), "Timer:", font=defaultFont, fill=255)
                draw.text((0, 20), s, font=timerFont, fill=255)
    color(100, 0, 0, 0)
    publishRaceTimes(hexUID, name, elapsed)

# Function to plubish the race times for the current user.
# It takes the hexUID, name and completionTime
# and publishes them to the AWS IoT topic.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号