i have projects i can do only with python so i wanna connect the card to the computer somehow using some library that i can give through it instructions to arduino card via the usb cable.
i have projects i can do only with python so i wanna connect the card to the computer somehow using some library that i can give through it instructions to arduino card via the usb cable.
Hi Yahya,
There are many tutorials on this subject. For example, the following link discusses using USB serial between Python on a Raspberry Pi and an Arduino. https://roboticsbackend.com/raspberry-pi-arduino-serial-communication/
It would be helpful if you described what you are trying to do with Python and the Arduino. If you are using the Uno, here is a simple Python library and the associated Arduino program that you can use as an example and modify https://github.com/dbarattini/ArduPy. Note: this is not ArduPy from Seeed Studios which uses CircuitPython. This is a basic Python library that provides some base functionality but would be easy to adapt. You can modify the pinout if you are using a different board. Requires that you have Python and PySerial installed on your host computer.
Upload the ardupy/ardupy.ino sketch to your Arduino Uno
Create a new python project and import ardupy
Learn from these examples:
You can also use ArduPy to comunicate directly to arduino
There is the Firmata approach.
https://pypi.org/project/pyFirmata2/
https://playground.arduino.cc/Interfacing/Firmata/
There is also book by Andrew Pratt on this subject available from Elektor publishing which may be of interest:
https://www.elektor.com/python-3-programming-and-guis
The Arduino slave sketch and program examples are available in the downloads section.