Skip to content

Compiling your application

Neil Kolban edited this page Dec 18, 2015 · 1 revision

In order to use the Arduino library, you will need to write a C++ application that contains two functions:

#include <Arduino.h>

void setup() {
  // Setup code
}

void loop() {
  // Loop code
}

To compile your code, you will need to execute the following:

g++ -MD -o <yourApp> <yourFile.cpp> -L<Install/lib> -larduino -lpthread

Breaking this down we have:

  • -MD - ??
  • -L<Install/lib> - Tells the linker where to look for the arduino library
  • -larduino - Tells the linker to link with the arduino library
  • -lpthread - Tells the linker to link with the Raspbian pthread library
Clone this wiki locally