Arduino library for providing boost::units for the Arduino platform.
This library works for
- ArduinoCore-samd:
Arduino Zero,MKR 1000,MKR WiFi 1010,Nano 33 IoT,MKR GSM 1400,MKR NB 1500,MKR WAN 1300/1310✔️ - ArduinoCore-mbed:
Portenta H7,Nano 33 BLE,Nano RP2040 Connect,Edge Control✔️ - arduino-esp32:
ESP32 Dev Module,ESP32 Wrover Module, ... ✔️ - arduino-pico:
Raspberry Pi Pico,Adafruit Feather RP2040, ... ✔️ - ArduinoCore-renesas:
Portenta C33,Uno R4 WiFi,Uno R4 Minima, ... ✔️
#include "Arduino-BoostUnits.h"
using namespace drone::unit;
#define DBG_ENABLE_INFO
#include <107-Arduino-Debug.hpp>
/* ... */
DEBUG_INSTANCE(80, Serial);
/* ... */
void setup()
{
Serial.begin(9600);
while (!Serial) { }
Length const l1 = 2.0 * meters;
Length const l2 = 4.0 * meters;
Time const t = 0.5 * seconds;
DBG_INFO("l1 = %.2f, b = %.2f, t = %.2f", l1.value(), l2.value(), t.value());
Length const l3 = (l1 + l2);
DBG_INFO("l1 + l2 = %.2f", l3.value());
Area const area = l1 * l2;
DBG_INFO("l1 * l2 = %.2f", area.value());
Velocity const velocity = l1 / t;
DBG_INFO("l1 / t = %.2f", velocity.value());
Acceleration const acceleration = velocity / t;
DBG_INFO("velocity / t = %.2f", acceleration.value());
}
void loop()
{
}
