I'm working on Serial communication between the Raspberry Pi and the Arduino, with the Raspberry Pi serving as master. I connected, using a logic level shifter, Arduino's Rx (Software Serial was used for Arduino) to Raspberry Pi's Tx, and the Pi's Rx to the Arduino's Tx.
After this, I ran a code from the Arduino which would just send a number to the Pi, I ran the Python code below to basically read data received from the Arduino.
import serial
import time
from time import sleep
if name == 'main':
ser = serial.Serial('/dev/ttyACM0', 38400, timeout = 100)
ser.flush
while True:
if ser.in_waiting > 0:
line = ser.readline().decode('utf-8').rstrip()
print(line, flush = True)
if float(line) == 600:
ser.write(b"200\n")
However, when I ran it, I just got the error that the ACM0 was not found in the directory. What was I supposed to do?