Passing serial data to javascript via Flask

混江龙づ霸主 提交于 2019-12-05 21:49:34

I've done something similar using Tornado for an Arduino + Raspberry Pi project:

https://github.com/lilspikey/train

Basically I would run a separate thread to read from the serial port and then decode the data, before sending it as JSON data via websockets.

You could probably do something similar. Just store the data you've read somewhere that can later be read by the Flash app. This could be a simple in memory data structure (will need to be threadsafe) or as complex as writing it to a database. You'd need to make sure you removed old data as it gets read by the Flash app, but that would be the crux of it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!