Id like to get a simple integer from my pi over to my Arduino (live, so while both are running and with Minimum latency), but I cant use any Pins because im already using all of them because I use a sense hat. If I could get this simple int from like 1-10 over to my pi, I could tell my adruino what to do when int=1 so thats not a Problem, I just dont know how to get data over there.
Asked
Active
Viewed 291 times
3
1 Answers
6
You can connect the Arduino to the Raspberry Pi with an USB cable. That gives you a serial connection. On the Raspberry side, you can use a library like pyserial. On the Arduino side, you can read bytes with
char x = Serial.read();
There's a tutorial at https://www.instructables.com/id/Interface-Python-and-Arduino-with-pySerial/
bb1950328
- 171
- 3
intusually consists of 2 bytes and could be 4 bytes .... a value of 1 to 10 could be represented with a single byte – jsotola May 24 '19 at 17:52