Does anyone know how do I get Arduino and Python talking to each other? I would essentially like to write my code and export it somehow to the arduino-uno.
-
Other than with pyserial?– Ignacio Vazquez-AbramsMay 9 '18 at 17:02
-
No, can I use Pyserial?– DatalinkMay 9 '18 at 17:13
-
1For a python interpreter running on a microcontroller you need quite a lot of ressources (flash, SRAM, speed,..). Consider to either change the board to something like an ESP8266, ESP32 or Feather M0, or live with C/C++ and the smaller boards. The Arduino Uno simply can't run it on 2KB RAM and 32kB Flash.– Maximilian GerhardtMay 9 '18 at 18:15
-
So how would I get Python to interact with Arduino?– DatalinkMay 9 '18 at 19:10
-
1'Arduino' is a framework, a set of library functions which you can use to make your microcontroller do something, so to say. When you use the language Python with MicroPython or CircuitPython, you're using that new framework. Then it's not running an Arduino Core anymore.– Maximilian GerhardtMay 9 '18 at 19:22
You can not run python on an UNO. If you want to use python on a microcontoller you should look into boards supported by MicroPython or Circuit Python
The Arduino communicates with the PC (and vice-versa) normally using Serial. You can use the PySerial module in your python code to open the Arduino's serial port and read and write data, and the Serial
object in your Arduino code likewise.
What that data is, and what it means, though is up to you to decide upon and program.