如何在 Raspberry Pi 4 上同时读取 4 个传感器
我是树莓派新手,我正在 stm32f4 上编写 FREETOS,感谢 Cube IDE。 我有 4 个传感器(BNO055、MPU9250、MS5611、BME-280)插入带屏蔽的树莓派 4。另外,我将使用传感器数据来控制阀门。 我在 raspi 上研究了多任务处理,但来源还不够。 那么我该如何做这个系统呢?
I am new to raspberry pi, I was coding FREETOS on stm32f4 thanks for cube IDE.
I have 4 sensors (BNO055,MPU9250, MS5611, BME-280) plugged to raspberry pi 4 with shield. Also, I will do control of the valves with sensors data.
I do research about multitasking on raspi but sources is not enough.
So how I can do this system?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Linux 有两种形式的多任务。多处理(同时运行多个独立链接的可执行文件)和多线程(单个进程内的多个执行线程)。多线程与您在 FreeRTOS 中可能熟悉的多任务处理最相似,并且最有可能是您在这里需要的。
多线程的基本 API 是 pthreads(或 POSIX 线程),尽管您可能会考虑对线程的特定语言支持,例如 C++
std::thread
el al:例如:https://en.cppreference.com/w/cpp/thread。Linux has two forms of multi-tasking. Multiprocessing (running multiple independently linked executables simultaneously), and multi-threading (multiple threads of execution within a single process). Multi-threading is most similar to the multi-tasking you are perhaps familiar with in FreeRTOS and most likley what you need here.
The basic API for multi-threading is pthreads (or POSIX threads), although you might consider language specific support for threads such as C++
std::thread
el al: for example: https://en.cppreference.com/w/cpp/thread.