Skip to content

Using C

William Stevens edited this page Jul 16, 2018 · 2 revisions

This Wiki page details how to use C or C++ to control a Flipper board.

Install libflipper

To use Flipper from Python you will need to install libflipper.

Navigate to the root of the repository and run the install command. If you already ran an install from the top level repository you can skip this step as libflipper will already be installed.

make install-libflipper

Make the LED turn blue

main.c

#include <flipper.h>

int main(int argc, char *argv[]) {

    flipper_attach(); // Attach a Flipper board
    led.rgb(0, 0, 10); // Turn the LED blue

    return 0;
}

and build

gcc -o main main.c -lflipper

Turning on an IO pin

main.c

#include <flipper.h>

int main(int argc, char *argv[]) {

    flipper_attach(); // Attach a Flipper board
    gpio.enable(IO_4, 0); // Set IO4 as an output
    gpio.write(IO_4, 0); // Set IO4 HIGH

    return 0;
}

and build

gcc -o main main.c -lflipper

Clone this wiki locally