3

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.

  • I doubt the sense hat needs all the GPIO. Have you identified which are spare? Perhaps the UART is available? The question would then be how do I physically connect to those GPIO. – joan May 24 at 11:14
  • please be clear in what you are asking ... an int usually 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 at 17:52
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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.