Hi everyone, I'm working on a code that schould send a pulse to a camera which starts the data acquisition and then sends back to the arduino a 3.3V signal to say the acquisition is over.
My problem is in the reading of the camera signal by the arduino. The first part works well, the signal is sent but I can't manage to read when the camera signal reaches the arduino.
I'v already tried with digital inputs but did not work better so I tried analog.
Here is my code, if someone knew what's going wrong he would be a savior !
from pyfirmata import *
import time
board = Arduino('COM8')
iter = util.Iterator(board)
iter.start()
CCDpin = board.get_pin('a:1:i')
outpin = board.get_pin('d:13:o')
CCDpin.enable_reporting()
time.sleep(0.5)
test_0_CCD = CCDpin.read()
#envoi du pulse
outpin.write(1)
time.sleep(0.01)
outpin.write(0)
# waiting for the return signal
test_CCD = CCDpin.read()
while(test_CCD == test_0_CCD):
test_CDD = CCDpin.read()
time.sleep(0.5)
I precise that the program runs forever and I know that the arduino receives the cam signal for sure besause it works when I'm using serial comunication with another sketch loaded on the arduino. Nevertheless, I would like to be able to do all this from Python.
The cam signal arrives to the arduino after 2 to 3 sec since the beginning of the acquisition.
Thanks for your help