I know that there have been some QQ on this in the past but have not found a definitive answer to the problem of the sample PiFace IRQ code apparently not working with switch events.
I have tried this with two Pi 3Bs and two PiFaces.
Other sample code works but the following example (given on Examples — PiFace Control and Display (CAD) 2.0.6 documentation ) displays the start text but doesn't update with button presses:
import pifacecad
def update_pin_text(event):
event.chip.lcd.set_cursor(13, 0)
event.chip.lcd.write(str(event.pin_num))
cad = pifacecad.PiFaceCAD()
cad.lcd.write("You pressed: ")
listener = pifacecad.SwitchEventListener(chip=cad)
for i in range(8):
listener.register(i, pifacecad.IODIR_FALLING_EDGE, update_pin_text)
listener.activate()