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.

asked May 24, 2019 at 9:52
2
  • 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. Commented May 24, 2019 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 Commented May 24, 2019 at 17:52

1 Answer 1

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/

answered May 24, 2019 at 10:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.