element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Piface Digital 2  - InterruptEnableException
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 5 replies
  • Subscribers 675 subscribers
  • Views 744 views
  • Users 0 members are here
  • pi
  • raspberry_pi
Related

Piface Digital 2  - InterruptEnableException

Former Member
Former Member over 10 years ago

Hi all

I am VERY new to Raspberry pi and linux in general, so please excuse the noob questions.

 

I have followed the Piface Digital 2 installation instructions to the letter, however receive an interrupt error on line 213 of the Interrupts.py script when I try to run the blink.py script. I am using python 2 by default, but have tried to run the blink.py script under both python 2 and 3. I have attached response in both versions.

At first I thought the problem may relate to the SPI driver, but I have enabled the port and tested it by bridging the MOSI and MISO pins and running spidev_test.c. I receive the correct response.

 

Starting blink.py (or any of the other example programs) with python 2 gives the following result

 

image

 

Starting blink.py with python 3 gives the following result

 

image

 

Any help would be greatly appreciated.

 

Kind regards

Simon

  • Sign in to reply
  • Cancel
Parents
  • piface
    0 piface over 10 years ago

    Hi,

     

    This error is due to changes in the new version of Raspbian. The latest package (>v4.1.2)  for python-pifacecommon should fix it. There might be a slight delay as it makes it way through the mirrors, but once that happens, doing a

     

    sudo apt-get update

    sudo apt-get install python{,3}-pifacecommon

    should fix it.

    Regards

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to piface

    Hi Andrew

     

    I finally received the Pi2 and as you predicted the pifacecommon update resolved the problem.

     

    I can now run blink1 and all is fine. I then tried to create a very basic script which set up the input interrupts as per the example and then switch an output on and off based on the status of an input. (When input 1 is pressed then turn on Output 1). This works fine using the GPIO, but not with piface. I have included the script below. I receive an Attribute error: 'int' object has no attribute 'chip'. I am well out of my depth here and no doubt I am making a very obvious error. Your help would be greatly appreciated.

     

     

     

    from time import sleep

    import pifacedigitalio

     

    DELAY = 0.5  # seconds

    pfd = pifacedigitalio.PiFaceDigital() # creates a PiFace Digtal object

     

    def switch_pressed(event):

        event.chip.output_pins[event.pin_num].turn_on()

     

    def switch_unpressed(event):

        event.chip.output_pins[event.pin_num].turn_off()

     

     

    if __name__ == "__main__":

        pifacedigital = pifacedigitalio.PiFaceDigital()

     

        listener = pifacedigitalio.InputEventListener(chip=pifacedigital)

        for i in range(4):

            listener.register(i, pifacedigitalio.IODIR_ON, switch_pressed)

            listener.register(i, pifacedigitalio.IODIR_OFF, switch_unpressed)

        listener.activate()

     

     

        while switch_pressed(1) ==1 :

            pfd.leds[1].turn_on()

        else:

            pfd.leds[1].turn_off()

     

    while True:     #check program is still running by flashing led 3

        pfd.leds[2].toggle()     # toggle third LED

        sleep(DELAY)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 10 years ago in reply to piface

    Hi Andrew

     

    I finally received the Pi2 and as you predicted the pifacecommon update resolved the problem.

     

    I can now run blink1 and all is fine. I then tried to create a very basic script which set up the input interrupts as per the example and then switch an output on and off based on the status of an input. (When input 1 is pressed then turn on Output 1). This works fine using the GPIO, but not with piface. I have included the script below. I receive an Attribute error: 'int' object has no attribute 'chip'. I am well out of my depth here and no doubt I am making a very obvious error. Your help would be greatly appreciated.

     

     

     

    from time import sleep

    import pifacedigitalio

     

    DELAY = 0.5  # seconds

    pfd = pifacedigitalio.PiFaceDigital() # creates a PiFace Digtal object

     

    def switch_pressed(event):

        event.chip.output_pins[event.pin_num].turn_on()

     

    def switch_unpressed(event):

        event.chip.output_pins[event.pin_num].turn_off()

     

     

    if __name__ == "__main__":

        pifacedigital = pifacedigitalio.PiFaceDigital()

     

        listener = pifacedigitalio.InputEventListener(chip=pifacedigital)

        for i in range(4):

            listener.register(i, pifacedigitalio.IODIR_ON, switch_pressed)

            listener.register(i, pifacedigitalio.IODIR_OFF, switch_unpressed)

        listener.activate()

     

     

        while switch_pressed(1) ==1 :

            pfd.leds[1].turn_on()

        else:

            pfd.leds[1].turn_off()

     

    while True:     #check program is still running by flashing led 3

        pfd.leds[2].toggle()     # toggle third LED

        sleep(DELAY)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube