Introduction to C Programming for the Raspberry Pi

Learn how to develop your practical Raspberry Pi projects using the C Language
4.4 (14 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
1,865 students enrolled
Take This Course
  • Lectures 39
  • Length 3 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 12/2016 English

Course Description

This Course is about learning the fundamentals about the C language to get you started with making physical projects with the Raspberry Pi developed in C. 

This Course is for Hobbyists, people who want to make prototypes or are interested to make a carrier change.

Reasons for joining the course could be:

  • You don't like Python, the default language for the Raspberry Pi, and you are looking for an alternative language.
  • You're curios about the C language and think, it would be a fun way to learn C and make Raspberry Pi projects at the same time.
  • You have heard that the default Industry Language for embedded systems is C and want to know if this could be a carrier for you.

After this course, you'll know what Compiler you need and how to work with it from different working environments, like the command line, the IDE Geany and Netbeans and how to get everything to work.

You'll learn how to get electronic components to work with C. The projects we will do are independent from each other and can easy be customised or combined which each other for your own needs. 

All the examples are easy enough for beginners.

So, let's summarize what you will get from this course:

You will learn to get your development environment right, this goes from knowing what to use and installing to configuration.

Most of the time, I will code before your eyes, which will make it easy for you to understand how things are done.

The examples and the provided Source Code will give you confidence. 

You will also become familiar with using sensors or other electronic components to make physical projects that are developed in C.

What are the requirements?

  • A Raspberry Pi and some electronic components are needed. A computer, like a PC with Windows or Linux or a Mac Computer.
  • Students should have some experience with making physical projects with one of the Raspberry Pi's. Some basic programming skills for example with Python.

What am I going to get from this course?

  • Setting up the Development Environment for programming in C.
  • Develop Physical Raspberry Pi Projects developed in the C language.

Who is the target audience?

  • Everybody who is interested to make Raspberry Pi projects using the C Language

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introduction

Get to know the instructor for this course and an overview of the course.


In this lesson, you'll learn what hardware is used in this course. 


In this lesson, you'll learn what Operation System and Software is used in this course.

Section 2: Setting up the environment

In this lesson, we will do the whole process from writing the code, compiling, running and debugging the program from the command line.


In this lesson, we will use the IDE Geany to write, compile and debug the code and run the program.


In this lesson, we will start with the installation and configuration of the IDE Netbeans. We will connect Netbeans to the Raspberry Pi, write code, compile the code and run the program.

4 questions

What do you need to make C programs that run on the Raspberry Pi?

Section 3: Introduction to the C Language

In this lesson, I will talk about what we are doing in this section.


In this lesson, we'll look at the building blocks of a C Program to answer the question, what are C Programs are made of.


In this lesson, you'll learn how to write text on the screen and how to read user input from the keyboard.

1 question

Which statement can print \n on the screen?


In this lesson, you'll learn, how to add comments to the Source Code.


In this lesson, you'll learn how to declare and use variables.


In this lesson, you'll learn, what different kind of mathematical operations are used in the C language.

1 question

#include <studio.h>

int main()


   int i = 100, j = 9, k;

   i =  i/10;

   k = i - j;

   printf("%d - %d = %d\n" , i, j, k);

   return 0;



In this lesson, you'll learn, how to use the datatype char that is used for declaring characters and strings.


In this lesson, you'll learn, how to declare and use constants in your program.


In this lesson, you'll learn about the different types of arrays, how to declare and use them.


In this lesson, you'll get an overview over the different kind of conditions that are used in C.


In this lesson, we'll make a countdown program to demonstrate the advantage of the fflush() function.

Using fflush(stdout) from the stdio.h we are able to flush the named stream, stdout in this case. 


In this lesson, you'll learn, how pointers are declared and used in a C program.


In this lesson, we'll make use of pointers to declare files. You'll also learn, how to create, open, close, read and write to files.

1 question


int main ()
   FILE *fp;
   fp = fopen("source.txt", "r");
   return 0;

In this lesson, you'll learn, how the system function can be used to call extern programs from your C program.


Learn how to write your own functions.

Section 4: Physical projects

In this tutorial you'll learn how to setup the library wiringPi. The library is needed to get access to the GPIO pins on the Raspberry Pi.


In this lesson, we will use the library wiringPi to do our first physical project, the Blinking LED.


Adding 2 Led's to the countdown program

We'll take the countdown program we did earlier as a starting point. This means that you need to load this code into your IDE to work from there.


In this lesson, we will light up a LED after pressing a button.


In this lesson, we'll create a program that counts every time we press a button.


In this lesson, will will let the buzzer make a sound after pressing a button. (Door Bell)


In this lesson, we will first test the tilt sensor with a LED, than replace the LED with a buzzer to make ourself a prototype of a bicycle alarm.


In this lesson, we will read the humidity and temperature from the DHT11 sensor and print the value on the screen.


In this lesson, we will gradually increase and decrease the luminance of an LED with PWM (Pulse-width modulation) technology, which looks like breathing.  


In this lesson, we will take pictures with the RaspiCam using the system() function. The system() function let us use the pre-installed camera programs raspistill (picture taking) and raspivid (video taking).

1 question

Add a text to the Source Code that prints on the screen 5 seconds before the camera starts to take (a) picture(s).


to pause 5 seconds, you can use:


1 question

The program takes only a picture after the Button has pressed.


Take the inspiration from the Source Code "Control LED by Button".


In this lesson, we'll write a test program for the PIR sensor.


The LED goes on after the PIR sensor has been triggered.

In this lesson, we'll combine code from the PIR sensor getting started lessen and the adding a LED to it.

Make the code from the lesson "PIR sensor - Getting started" available in an editor or IDE, so that you can take this code as starting point.


Configuration of the I2C Interface. Project example: BMP180, Getting the Barometer sensor up and running.


Distance measurement

In this lesson, we'll write a program to measure the distance and print the result in cm and inch. This code is a very good base for all kind of projects where you wanna use an ultrasonic sensor.

Lab Exercise: People Counter with Ultrasonic
Section 5: Conclusion

In this summary, I will give you some recommendations for going further in C development.

Section 6: Bonus Lectures

Installation of MonoDevelop on the Raspberry Pi


In this lesson, we'll take several Arduino example sketches and convert them into C code for the Raspberry Pi.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Barbara Hohensee, System Development & System Design at eMaker Studio

As a former System- and Network Administrator at DaimlerChrysler R&D I had a close connection to hardware, network, Operation Systems and system development. Several years ago I took the next step and went into the embedded system development and IoT. My preferred prototyping platforms are Raspberry Pi and Arduino. I like development itself and to teach development skills.

Ready to start learning?
Take This Course