Enquiry on Arduino and Pi 3 USB Communication

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)

Rather than have a series of separate Python scripts why not just have one Python program that is in constant communication with the Arduino. Then you don't need to disable the auto-reset.

Have a look at this Python - Arduino demo

You may also find some ideas in Serial Input Basics

...R