element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 Problems
  • 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
  • Replies 78 replies
  • Subscribers 676 subscribers
  • Views 8519 views
  • Users 0 members are here
  • raspberry_pi
  • piface
  • raspberry_pi_accessories
Related

PiFace Problems

keithtowns
keithtowns over 12 years ago

Am I missing something? I have two PiFace and 3 Raspberry Pi. I followed the instructions the get the PiFace working but have yet to succeed. I have tried the image provided as well as updating an existing Raspian image to no avail. I have also tried all my Pi and the two PiFace in all the combinations. I almost gave up but also tried a different power supply and SD card. None of the above got the emulator to switch on the LEDs and I could not do it through Python. Any ideas? I've spent hours on this, please tell me I've missed something. Thanks.

  • Sign in to reply
  • Cancel
  • keithtowns
    keithtowns over 12 years ago in reply to Former Member

    Hi Thomas

     

    THAT FIXED IT!

     

    Both PiFace came with the jumpers set in the other position - THANK YOU! (and why would they do that?)

     

    I believe that Scratch needs an updated version to work with PiFace, is there anywhere I can download it from using my current version of Raspian?

     

    Thanks

     

    Keith

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to keithtowns

    Ah-ha! That's brilliant news! The jumper switches tell PiFace what number it is. With both set to 0, you tell PiFace that it's board 0. By default the Python module addresses board 0 so that's why it wasn't working when you had it set to whatever-else.

     

    I don't think you need an updated version of Scratch, you just need to enable Mesh. Here are some old instructions (I'll be honest, they need improving image). If you have any trouble then start a new thread and I'll try to help when I can.

     

    Good luck, and have fun!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Thomas,

     

    I just installed the new Python3 version of pifacedigitalio following the directions on github: https://github.com/piface/pifacedigitalio. I'm using the latest version of Raspbian (2013-02-09) with all of the latest updates installed (via apt) and the latest firmware (via hexxeh's rpi-update script).

     

    For some reason, my system is not setting up the permissions properly for the /dev/spidev* files. Output of 'ls -al /dev/spi*' is below:

     

    pi@raspberrypi ~ $ sudo ls -al /dev/spi*

    crw------- 1 root root 153, 0 Dec 31  1969 /dev/spidev0.0

    crw------- 1 root root 153, 1 Dec 31  1969 /dev/spidev0.1

     

    I'm getting ready to just add manual udev rules to set the permissions, but I wanted to check as to why they aren't being setup automatically. Does the new Python3 version of the Piface Python IO library setup not handle permission setup yet?

     

    Thanks,

    Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Ah, so I haven't! I'll add this to the install script tomorrow, it must have slipped my mind since I was already working on a machine that had the permisions set up.

     

    For now, try running the spidev-setup script here.

     

    Thanks for the heads-up!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Yea, I just manully ran the old script and got it working. Thanks of the confirmation. With that sorted out, both the io library and emulater seem to be working properly.

     

    -Andy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    I've updated the pifacedigitalio install script to update the spi permissions. Everything should work now, I might also add auto un-blacklisting the spi kernel module later.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 12 years ago in reply to jealderson1

    Joe

    Not sure if you are the man or not.

     

    Your download and instruction has an issue at :-

    image

    It seems the python script subtracts 1 so you need to use 1 to 8

    ie pfio.digital_write(1,1) # turn on

     

    or pfio.digital_write(1,0) # turn off

     

     

    cheers

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Thomas, I'm new to R-Pi and Pi-Face. I thus far have everything working quite well with your pifacedigitalio; but have an issue on the interrupts. Once I have called wait_for_input with loop=True I would like to be able to exit gracefully from the interrupt routine. Currently I try to set loop=false with one of the inputs but that does not work (I think for obvious reasons). Any help on how I can exit gracefully after receiving the interrupt I need?

     

    Thank you

    Sven

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Sven,

    Currently the interrupt handler only supports looping forever or exiting after one interrupt. It should also handle a keyboard interrupt gracefully (Ctrl+C).

     

    For some reason I never thought of the use-case where you might want to exit the loop only from a certain interrupt. I've updated the code so that instead of using a loop variable to determine whether the loop should continue waiting for inputs, it decides based on the return value of the callback. If a callback returns True, wait_for_input keeps waiting for interrupts. If False, wait_for_input should return.

     

    I've updated this in a new branch called dev_interrupt_return but I haven't tested it yet (I'm in the middle of exams, I can test later in the week). The branch is here if you want to test the new version for me. Inspect the README for new interrupt instructions.

     

    How are you finding the interrupts on pifacedigitalio by the way? I tried to make it as simple as possible but I've not had much feedback! In particular, how is the spartan README? I was going for brief, but informative.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to Former Member

    Hi Thomas,

     

    Firstly, apologies for disturbing your exams. I will most certainly test the new branch. At the moment the interrupts are doing the job I need them to do and when I hit input [1] I have simply put in a rather crude sys.exit(). It works for now. I kind of like the readme, it forces you to think about the situation.

     

    Interestingly, the solution you proposed with the boolean return from the callback is exactly what I tried but I could not quite get it to work.

     

    Thanks for your quick response, I'll let you know how it goes.

     

    Cheers

    Sven

     

    Edit:

    I got it working. I had to make some small changes to your code, I added the following in call_mapped_input_functions():

     

    if int_bit == 0:

        keep_waiting = True

        continue

     

    and I also added the following at the end of the function:

    return keep_waiting.

     

    These may not be the most elegant solutions but for now it is working. Thanks again for your help.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<>
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