Fig. 1: GPIOs of Raspberry Pi header (main header)
Fig. 1: GPIOs of Raspberry Pi header (main header)

It has almost been 40 years or more and still C language is ruling the world. Also, it has been the first choice of embedded engineers. It is simple to learn and a comfort zone for many who have already learnt it and do not want to switch to a new language. So let us develop applications on Raspberry Pi using this language.

For electronics enthusiasts, the main area of interest is the general-purpose input/output (GPIO) port of Raspberry Pi. It is a generic pin on a chip and its status (that is, input/output (I/O) or logic levels) can be controlled/programmed through software. GPIO pins have great importance in the embedded world as you can interface lower-level peripherals and control them by manipulating at bit level.

Being a hardware resource, GPIOs require assembly languages (which are specific to that controller) to control them. If one wants to use a higher level programming language to control them then additional header/library files are needed, which will map functionality from higher level languages to Assembly language.

Raspberry Pi supports a number of programming languages such as C, C++, Ruby, Perl, Python, Java and PHP but, to access GPIO, all of them require additional libraries.

Due to availability of cross compilers for C, it is possible to program microcontrollers with different architectures without learning individual Assembly languages. Accessing I/Os, bit manipulations and direct hardware control is possible in C with simplicity like higher level languages at the same time.

Raspberry Pi is not an exception in the world of embedded systems. Thanks to Gordon Henderson who developed C library (called WiringPi) for Raspberry Pi to facilitate its GPIO access using C language.

About GPIOs of Raspberry Pi
The Raspberry Pi has a 26-pin GPIO connector. There are eight GPIO pins which can be programmed as either digital outputs or inputs. One of these pins can be designated for PWM output too.



Please enter your comment!
Please enter your name here