Hi, I am new to Arduino and I am currently working on a project to control robot remotely. I am using pi 3 and Arduino UNO (mount with Adafruit Motor Shield v2.3). The communication between pi 3 and arduino is done over usb. I intend to send different commands (by executing python script at different instances to write to ttyACM0) to Arduino to control the motor. I have disabled Arduino auto reset by placing 10uF capacitor between Reset and GND pin. I am able to execute the first python script. However, when i try to write another value (executing the same python script of different value) to ttyACM0, there are no response from Arduino. I tried on both Arduino Serial Monitor and python 2.7 IDE, arduino could response promptly to various command.
In my python script, i have the following:
import serial
import sys
command = sys.argv[1]
ser = serial.Serial('/dev/ttyACM0', 9600)
ser.write(command)
I will be executing this script of various value to send value to arduino.
Attached are my code for Arduino.
Is there anything I should add to resolve this issue?
Final_Code.ino (3.84 KB)