I have recebntly started a project where I need to connect an arduino and another device through serial. And I have setup a simple serial connection betwee python and arduino. I can setup the connection through the python terminal and it works just fine. When I type :
arduino.write("1"), It receives the data only once. However, When I run this code:
import serial arduino = serial.Serial('/dev/ttyACM0', 115200, timeout=.1) while True: arduino.write("1")
it writes properly, howver when I stop it using Ctrl-C, it doesn't stop sending and keeps sending to the arduino. Stops sending when I open a serial. connection using the python terminal again.
I have no idea what is causing this or how I can fiz it. Would reallly appreciate some help. Thanks in advance: