Start programming you Pi

Here I describe the steps needed to start writing simple c programs on your raspberry pi. I did my experiments using a raspberry pi 3b+, you can use whatever model you like. If you don’t have a bootable SD card ready, please first follow the steps provided in this post. I installed ubuntu mate on my SD-card to start programming my pi, you can choose whatever OS you like, as long as it’s linunx based to make use of the instructions given here.

Get gcc running

After having your linux booted on your pi, open a console and make sure, you have a working installation of gcc (i.e. by typing gcc at the command prompt). If gcc is not installed, follow the instructions provided here or follow these steps:

$ sudo apt update

Now install the build-essential package:

$ sudo apt install build-essential

If you want the manual pages to be installed, issue the following command as well:

$ sudo apt-get install manpages-dev

Now make sure, that you can run gcc from your terminal window by typing the gcc-command:

$ gcc --version

Get the library wiringPi

wiringPi is a PIN based GPIO access library written in C for the BCM2835, BCM2836 and BCM2837 SoC devices used in all Raspberry Pi. Descriptions can be found here, however the related git-repository does currently not work, but I found another repo on github providing the code. I therefore recommend to proceed with the following steps instead:

First install git on your system, if not yet available.

$ sudo apt-get install git-core

Then cd to a directory in your home directory, where you want to build checkout the library to and run the build command. To checkout the wiringPi, issue the command:

$ git clone https://github.com/WiringPi/WiringPi.git

If the URL provided doesn’t work, get it from here instead. After issuing the git clone command, you have a directory ‘WiringPi’ available. cd to the directory and run the build command:

$ ./build

Now you are ready to code your pi using gcc and wiring pi. In the next post I will show you how we can connect and program a LED 8×8 Matrix Display using c programming language and the wiringPi library.