Checking a bit sequence
cmisztur last edited by cmisztur
I'm working with SX1509 peripheral.
Based on this value '00000000 00000110' from 0x18+0x19 I know that pin 01 and pin 02 caused an interrupt. Now I need to read IO state for pin 01 and pin 02.
Below code works, but can you suggest improvements?
def digitalReadFromInterrupt(self,interruptSource): readResults =  for i in range(15,0,-1): if interruptSource & (1<<i): readResults.append([i,self.digitalRead(i)]) return readResults