LibrePilot provides header files to use in an arduino programming environment. Using these header files, arduinos can read telemetry data via serial connection, as well as send commands via UAVTalk.
Currently arduino support is available in the "next" branch: https://bitbucket.org/librepilot/librepilot/branch/next
You need to set up a build environment: Developer Manual
In your build environment, use the following commands to generate and show the header files:
A very small library makes it easy to access the objects in the telemetry stream.
The library is currently located at https://github.com/MarcProe/LibrePilot.arduino .
It is not mandatory to use this library, but it gives a good example for how to use the header files.
Currently supported functions:
- Request Object
(void request(unsigned long objId);)
- Receive Object (
boolean receive(unsigned long objId, byte *ret, unsigned int timeout = 100);)
- Send Object (
void send(unsigned long objId, byte* data, int length);)
- Receive multiple Objects (one at a time)
Connect to a flight controller
Mainport and Flexiport can be used to connect an arduino to and make use of serial communication.
This sketch will read the
FlightStatus.Armed field from the flight controller and show the arming state on the RGB LED. Green for Disarmed, blue for Arming, red for Armed.
(See on curcuits.io for BOM)