Coin Acceptor; Connecting to Arduino Uno w/ Raspberry 3 useing pyserial.

The following is the source code I am working with in the arduino IDE, I need to adapt this code, so that when a pulse is sent, the program will continue waiting for a pulse till a certain amount of time has passed. In python, Whenever the user decides to make a desposit, pyserial, will open the usbPort connected with the Arduino Uno, and thus calling the arduino Uno code below.

What is currently happening, is that when I run a python test script, nothing occurs until the ground from the Coin Acceptor, which is connected to the GND port on the arduino is pulled out .25 is continuously added and printed out to the screen with each addition.
import serial
ser = serial.Serial(’/dev/ttyACM0’, 9600)

while True:
print ser.readline()


This Python - Arduino demo should help get you started.

Be sure not to close the Serial port until your Python program is completely finished with the Arduino because the Arduino norrmally resets when the serial port is opened.

If you do need to be able to close the serial port it may be simplest to communicate with the Arduino using a USB-TTL cable connected directly to Rx Tx and GND.