abhi143 wrote: ↑Sun Jun 10, 2018 6:51 am
I am not too good but I am not too bad in c++ programming. I did practice on GCC compiler for basic learning . I have programmed node mcu esp8266 using arduino ide in c++ language.
That's why I was looking for the example
As a user of Arduino (Mega, Due, esp8266) and the Raspi I daresay that there are worlds in between the simplified Arduino Sketch C++ and "real" C++ for Linux. As already stated, there is no all-in-one IDE and API to Pi like Arduino for microprocessors.
[spoiler]
(actually there is a way to install the Arduino framework for the Pi, i.e. to use the Pi like an Arduino microprocessor:
https://github.com/me-no-dev/RasPiArduino,
but I wouldn't recommend that ftm, because it is no widely used).
[/spoiler]
IMO you should start with simple C programs, featured by wiringPi for GPIO control, and it wouldn't harm if you compile them by the g++ compiler from the start, not by gcc. It will also introduce possibilities to use integrated C++ code additionally, right from the beginning or perhaps anytime in the future (that's how I am doing).
For the very 1st steps I would advise you to start with this tutorial on C for the Raspi (revised edition):
http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf
and then proceed to examples given on wiringPi tutorial websites.
Just to mention:
AFAIK, the Arduino API functions digitalRead, digitalWrite and analogWrite (actually pwm write for digital pins) are basically also implemented by C functions, not C++, whilest they can be wrapped by the general Arduino Wiring C++ classes.
The same would it be if you use the comparable Raspi C functions digitalRead, digitalWrite and (soft)PwmWrite ("analogWrite") of the wiringPi C API libs, also wrappable by C++.
PS,
BTW, as already written before, wiringPi is already pre-installed in Raspbian, but you mentioned that you installed it a 2nd time.
Did you do that by apt-get install or a different way? (re-installing by the wrong command may cause malfunctions!)