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 Wiring pi is defunct.
  • 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 Suggested Answer
  • Replies 14 replies
  • Answers 1 answer
  • Subscribers 657 subscribers
  • Views 3708 views
  • Users 0 members are here
  • c
  • gpio
  • wiringpi
  • raspberry_pi
  • raspberry-pi
  • raspberrypi
Related

Wiring pi is defunct.

SensoredHacker0
SensoredHacker0 over 1 year ago

I used to love using the Wiring Pi library in C for programing the IO of the Raspberry pi.
I haven't used a PI for a project in a while, and I guess in that time developer of WiringPi has
stopped supporting the library.
I tried using version 2.52 on a raspberry pi 4, but it says something like the hardware isn't listed in /proc/cpuinfo.

So I guess I cant use wiringPi. what C libraries would you use for programing GPIO in C on a rasperry Pi 4?
Ive looked around the internet, and I see some various options, but Im not sure what code works with which boards, etc.

  • Sign in to reply
  • Cancel
Parents
  • shabaz
    0 shabaz over 1 year ago

    WiringPi certainly does work with Pi 4, I have used it myself on Pi 4. 

    However, it is not maintained (the author doesn't wish to maintain it anymore), so it won't work with Pi 5 at all (unless someone adapts it, which the original author I think doesn't have an interest in pursuing). There is a list of alternatives (some are for Python, but there are some listed for C) here: https://raspberrypi.stackexchange.com/questions/117591/controlling-raspberry-pi-gpio-with-c-and-python

    However, I've not tried any alternative personally on Pi 4. With C, I've only used WiringPi on Pi 4.

    I suspect some people (those that need it for, say, a job and thus have the time - several days of effort to do it properly) are directly programming registers (i.e. do a mmap, followed by writing/reading the registers that are mapped) for the particular Pi they are using, and effectively creating their own API. I've had to do that myself on some platforms (e.g. BeagleBone Black), but it's a lot of effort to initially do, and to maintain. 

    In summary, if it's only Pi 4 that interests you, and you wish to use C programming, then WiringPi should work. Otherwise, if you may eventually want Pi 5 support too, you'd need to choose a different library (e.g. pigpio, but there are various options at that link), which today may not work for Pi 5 but at least has a chance of being supported eventually, if it is actively being maintained currently, or create your own.

    If you don't need fast GPIO, then there are other options (e.g. using /sys/class/gpio) but those are slower. Not every application will need speed, so that may be a possibility. 

    Yet another possibility is to use SPI or I2C (e.g. SPI or I2C GPIO expander) and avoid the WiringPi and its alternatives altogether since you'd be using the normal Linux i2cdev or spidev API, which will always be supported (unless something better comes along one day).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to shabaz
    shabaz said:
    there are other options (e.g. using /sys/class/gpio)

    I use those, if I don't need fast IO. 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago in reply to Jan Cumps

    I suspect often people don't need the speed, but simply want DigitalIn/DigitalOut style API functions like a microcontroller's libraries may offer, or Arduino even, and probably they would not mind if the underlying implementation used /sys/class/gpio. 

    Even if slower IO is fine, sometimes an OCD gets the better of me and makes me want to implement it using registers, but it's a lot of work!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • shabaz
    0 shabaz over 1 year ago in reply to Jan Cumps

    I suspect often people don't need the speed, but simply want DigitalIn/DigitalOut style API functions like a microcontroller's libraries may offer, or Arduino even, and probably they would not mind if the underlying implementation used /sys/class/gpio. 

    Even if slower IO is fine, sometimes an OCD gets the better of me and makes me want to implement it using registers, but it's a lot of work!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to shabaz

    As an exercise, I created a little C++ GPIO lib:  C++ gpio library for Raspberry Pi - Pt 1: Design and How To Use 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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