I'm currently using a RPI2 b running linux to check for when a pulse is received from an arduino (3.3v). Something to note is that I'm also reading data from uart and writing it to a file at the same time.
On boot I start my script using screen.
I collect my uart data into a queue and then write into a file when available. Every time I receive a pulse I add a mark into a queue that is writing,when available, to the same file as the data collected from uart.
The pulse is held high for 30ms.
Below is my setup code.
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) def pulsed(channel): state.pulsequeue.put(chr(254)) GPIO.add_event_detect(17,GPIO.RISING, callback=pulsed)
For some reason I'm not recording every pulse all of the time. I've checked this by incrementing a variable each time I enter the pulsed loop and comparing it to the number of times the arduino actually sends the pulse. I'm sure that the arduino is actually sending the pulse.
Is there a chance there is a problem with the duration of my pulse or am I just catching an exception where the interrupt is taking lower priority than one of the other operations happening?