Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Latest commit

 

History

History
61 lines (49 loc) · 3.83 KB

README.md

File metadata and controls

61 lines (49 loc) · 3.83 KB

107-Arduino-BoostUnits

Arduino Library Badge Compile Examples Arduino Lint keywords.txt Checks General Formatting Checks Spell Check

Arduino library for providing boost::units for the Arduino platform.

This library works for

Example

#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()
{

}