I tried to communicate between Arduino and python using Firmata. I am using Arduino mega and I want to write a blink program. At first, I Uploaded the standard Firmata program on my Arduino: and then I tried to run this python program:
import pyfirmata
import time
board = pyfirmata.Arduino('/dev/ttyACM0')
while True:
board.digital[13].write(1)
time.sleep(1)
board.digital[13].write(0)
time.sleep(1)
But I got this error
SerialException: could not open port '/dev/ttyACM0': FileNotFoundError(2, 'The system cannot find the path specified.', None, 3)
can you help me with this problem?
If you are using Linux, then you'll have to find out on which device was the board connected. As you've mentioned, you can upload sketch from Arduino IDE, so you must've select correct "port" device. Or you can disconnect and connect Aruduino and run dmesg
command to show what happened in system (few last lines will contain something like /dev/ttyUSB or similar)
On Windows you have to use "COMn" (again look for the correct port in Arduino IDE for correct port name)