Book Image

Banana Pro Blueprints

By : Tony Zhang
Book Image

Banana Pro Blueprints

By: Tony Zhang

Overview of this book

This book follows a tactical plan that will guide you through the implementation of Banana Pro and its configurations. You will then learn the various programming languages used with Banana Pi with the help of examples. In no time at all, you’ll be working on a wireless project that implements AirPlay servers, hotspots, and so on. Following this, you’ll develop a retro-style arcade kiosk game. Then we’ll move on to explore the multimedia features of Banana Pro by designing and building an enclosure for it. After this, you’ll learn to build a remote-controlled smart car and we’ll examine how to control a robotic arm. The book will conclude with the creation of a home sensor system that has the ability to expand or shrink to suit any home.
Table of Contents (15 chapters)
Banana Pro Blueprints
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

C/C++


Most Banana Pro programs found on the Internet are C/C++ programs. The main reasons for this are speed critical applications: interpreters, such as Python, are much slower compared to compiled programs such as C/C++ ones. In this section, we will have a closer look at the Linux C/C++ compiler called GNU Compiler Collection (GCC). GCC includes frontends for both the C and C++ compiler as well as libraries for these languages. We install the C and C++ compiler with the following command:

sudo apt-get install gcc g++ make

Additionally, we install make, a utility that helps the compiling and linking of C/C++ files. We again start with a very simply "Hello world!" example, which we call hello.c:

nano hello.c

We can then add the following content:

#include <stdio.h>

int main(void)
{
    puts("Hello world!");
    return 0;
}

In the preceding example, we include standard input/output headers (stdio.h). The main entry point of the program has no arguments (void) and returns an integer...