access the Raspberry Pi's GPIO in C++

Thread Starter

daljeet795

Joined Jul 2, 2018
295
Hello, all!

I bought raspberry pi chip and installed raspbian stretch lite on it. The most commonly languages used for raspberry Pi are Python or C ++ language. I can write and run c++ program on raspberry pi and desktop PC. I want to understand how do we access GPIO of Raspberry in C++ language. I have searched a lot on internet before posting to question on forum but I don't understand how to access the Raspberry Pi's GPIO in C++ programming language.

I am very interested to know how do you access the Raspberry Pi's GPIO in C++ programming language. Please share your experience. Your advice can help me a lot.
 

dl324

Joined Mar 30, 2015
18,331
Welcome to AAC!

A quick search turned up this example of using the sysfs interface from C++

It starts by showing how to control GPIOs from the Shell.

There was a reference to using the GPIO registers instead, but I didn't see any examples of how it was done. If you find them, kindly post a reference; I'm trying to figure out how to do this on a different ARM based SBC.

MOD EDIT: Link removed -- target now points to inappropriate content.
 
Last edited by a moderator:
Top