Chapter 5Programming on the Raspberry Pi

This chapter describes several different programming options for the Raspberry Pi (RPi), including scripted and compiled languages. An external LED control program is provided in most of the languages so that you can investigate each language's structure and syntax. The advantages and disadvantages of each language type are discussed along with example uses. The chapter then focuses on the C/C++ and Python programming languages, describing their principles, and why object-oriented programming (OOP) is appropriate for the development of scalable embedded systems applications. The chapter details how you can interface directly to the Linux kernel using the GNU C library and finishes with a discussion on how the computational performance of Python code can be greatly improved. A single chapter can only scratch the surface on this topic, so this one focuses on physical programming with the RPi.

Equipment Required for This Chapter:
  • A terminal connection to the RPi (see Chapter 2)
  • LEDs, resistors, breadboard, hook-up wires, and a FET (BS270) or transistor (BC547) (see Chapter 4)

See www.exploringrpi.com/chapter5/ for further details on this chapter.

Introduction

As discussed in Chapter 3, embedded Linux is essentially “Linux on an embedded system.” If your favorite programming language is available under Linux, it is also likely to be available for the RPi. So, is your favorite language suitable for programming the RPi? That depends on ...

Get Exploring Raspberry Pi now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.