Is there a way to use interrupts when the input pins
change, or is polling my only option?
Polling seems to take a lot of cpu cycles.
I've been able to slow it down with time.sleep()
but I miss inputs.
Can interrupts be added?
Logged In: NO
sorry this ? is for the pyparallel
Logged In: YES
I'm also interested in this - mainly Event on RX. Isn't there any nice way of doing so? I hate bruning CPU cicles by waiting.
I'm using Linux - so maybe there is an OS specific implementation?
This a solution using TIOCMIWAIT syscall.
Not all USB adapter supporti this feature.
It should be integrated in pyserial.
from serial import Serial
from fcntl import ioctl
from termios import (
ser = Serial('/dev/ttyUSB0')
wait_signals = (TIOCM_RNG |
if __name__ == '__main__':
ioctl(ser.fd, TIOCMIWAIT, wait_signals)
print 'RI=%-5s - DSR=%-5s - CD=%-5s - CTS=%-5s' % (