简体   繁体   English

arduino 和树莓派之间基于中断的通信

[英]Interrupt based communication between arduino and raspberry pi

I have 6 Arduinos and 1 raspberry pi B+.我有 6 个 Arduino 和 1 个树莓派 B+。 I need Arduino to communicate with pi based on interrupts.我需要 Arduino 基于中断与 pi 进行通信。 For example, if 1 Arduino has to communicate with pi, it sends interrupt and then pi asks the Arduino to send data.例如,如果 1 Arduino 必须与 pi 通信,它会发送中断,然后 pi 要求 Arduino 发送数据。 On the other hand, Pi can communicate directly without any interrupt.另一方面,Pi 可以直接通信而无需任何中断。

You can configure the Raspberry GPIO pins as Rising/Falling edge interrupts.您可以将 Raspberry GPIO 引脚配置为上升沿/下降沿中断。 Raspberry GPIO 覆盆子 GPIO

Then you can use one of the digital ports in your Arduino to generate Rising or Falling edge so it will trigger the Raspberry interrupt.然后,您可以使用 Arduino 中的一个数字端口生成上升沿或下降沿,以便触发 Raspberry 中断。

If you have several Arduinos and you don't want to waste several Raspberry pins, you can connect all Arduinos to a single GPIO pin of the Raspberry (using pullup resistors so when one Arduino Triggers you will not create a short circuit).如果您有多个 Arduino 并且不想浪费多个 Raspberry 引脚,则可以将所有 Arduino 连接到 Raspberry 的单个 GPIO 引脚(使用上拉电阻,因此当一个 Arduino 触发器不会造成短路)。

You will then need some kind of protocol for the Raspberry to know which Arduino triggered the Interrupt.然后,您将需要某种协议让 Raspberry 知道哪个 Arduino 触发了中断。

Hope this helps希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM