bluetooth_test.py 文件源码

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

项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码
def test_send():
    btl = BluetoothLogger(fields=["speed", "rpm", "soc"], password=password)
    btl.start()

    # generate some data and send it
    x = range(1000)
    y = map(lambda v: sin(v * pi / 45) * 5000 + 5000, x)
    speeds = cycle(y)
    print("Sending dummy data")
    while 1:
        try:
            row = map(str, [round(next(speeds), 2), 5000, 50])
            btl.send(",".join(row))
            time.sleep(1)
        except KeyboardInterrupt:
            print("Terminating")
            break
    btl.join()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号