vmu931.py 文件源码

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

项目:PyVMU 作者: JosephRedfern 项目源码 文件源码
def _send_message(self, message, update_status=True):
        """
        Sends a message to the VMU931 device, with 5ms delay between each character. 

        :param message: Message to send to device
        :param update_status: Update sensor status after message send (defaults to True)
        """
        byte_message = message.encode('ascii')

        # bytes must be sent with 1ms+ interval to be recognised by device.
        for c in byte_message:
            bs = bytes([c])
            self.ser.write(bs)
            logging.debug("Sent {}".format(bs))
            time.sleep(0.01)
        time.sleep(0.05)

        if update_status:
            self.request_status()
            time.sleep(0.100)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号