Skip to content

Listener/interrupt Not working on Version 1 Piface #28

@monroel

Description

@monroel

Hello,

I am having trouble getting the simple listener examples to work. I am using latest version of Raspbian on an original Raspberry Pi board with the original (version 1?) of the piface, with Python 3.

The piface emulator works just fine on inputs and outputs, and simple input and output examples work fine as well, so I know that the code is communicating with the piface board:

import pifacedigitalio
pfd = pifacedigitalio.PiFaceDigital() # creates a PiFace Digtal object
pfd.leds[1].turn_on() # turn on/set high the second LED
print(pfd.input_pins[0].value)
0

The last statement properly prints a 1 when run while the input 0 switch is pressed.

However, when I try the following listener example, nothing works when input 0 switch is pressed:

import pifacedigitalio

def toggle_led0(event):
... event.chip.leds[0].toggle()
...
pifacedigital = pifacedigitalio.PiFaceDigital()
listener = pifacedigitalio.InputEventListener(chip=pifacedigital)
listener.register(0, pifacedigitalio.IODIR_FALLING_EDGE, toggle_led0)
listener.activate()

Have googled this and been unable to come up with anything. Do I need to explicitly enable interrupts or some other feature? Would really appreciate some help with this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions