Note
Functions and classes in pifacedigitalio.core have been imported into the main namespace. pifacedigitalio.digital_write() is the same as pifacedigitalio.core.digital_write().
Listens for events on the input port and calls the mapped callback functions.
>>> def print_flag(event):
... print(event.interrupt_flag)
...
>>> listener = pifacedigitalio.InputEventListener()
>>> listener.register(0, pifacedigitalio.IODIR_ON, print_flag)
>>> listener.activate()
A PiFace Digital board.
Attribute : | input_pins – list containing pifacecommon.mcp23s17.MCP23S17RegisterBitNeg. |
---|---|
Attribute : | input_port – See pifacecommon.mcp23s17.MCP23S17RegisterNeg. |
Attribute : | output_pins – list containing pifacecommon.mcp23s17.MCP23S17RegisterBit. |
Attribute : | output_port – See pifacecommon.mcp23s17.MCP23S17Register. |
Attribute : | leds – list containing pifacecommon.mcp23s17.MCP23S17RegisterBit. |
Attribute : | relays – list containing pifacecommon.mcp23s17.MCP23S17RegisterBit. |
Attribute : | switches – list containing pifacecommon.mcp23s17.MCP23S17RegisterBit. |
Example:
>>> pfd = pifacedigitalio.PiFaceDigital()
>>> pfd.input_port.value
0
>>> pfd.output_port.value = 0xAA
>>> pfd.leds[5].turn_on()
Stops interrupts on all boards. Only required when using digital_read() and digital_write().
Parameters: |
---|
Returns the value of the input pin specified.
Note
This function is for familiarality with users of other types of IO board. Consider accessing the input_pins attribute of a PiFaceDigital object:
>>> pfd = PiFaceDigital(hardware_addr)
>>> pfd.input_pins[pin_num].value
0
Parameters: | |
---|---|
Returns: | int – value of the pin |
Returns the value of the input pullup specified.
Note
This function is for familiarality with users of other types of IO board. Consider accessing the gppub attribute of a PiFaceDigital object:
>>> pfd = PiFaceDigital(hardware_addr)
>>> hex(pfd.gppub.value)
0xff
>>> pfd.gppub.bits[pin_num].value
1
Parameters: | |
---|---|
Returns: | int – value of the pin |
Writes the value to the input pin specified.
Note
This function is for familiarality with users of other types of IO board. Consider accessing the output_pins attribute of a PiFaceDigital object:
>>> pfd = PiFaceDigital(hardware_addr)
>>> pfd.output_pins[pin_num].value = 1
Parameters: |
---|
Writes the value to the input pullup specified.
Note
This function is for familiarality with users of other types of IO board. Consider accessing the gppub attribute of a PiFaceDigital object:
>>> pfd = PiFaceDigital(hardware_addr)
>>> hex(pfd.gppub.value)
0xff
>>> pfd.gppub.bits[pin_num].value = 1
Parameters: |
---|