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

A unified sensor abstraction layer used by all 107-system sensor libraries.

License

Notifications You must be signed in to change notification settings

107-systems/107-Arduino-Sensor

Repository files navigation

107-Arduino-Sensor

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

A unified sensor abstraction layer used by all 107-system sensor libraries.

This library works for

Example

#include <107-Arduino-Sensor.hpp>
/* ... */
class DummyPressureSensor : public drone::PressureSensorBase
{
public:

  DummyPressureSensor()
  : drone::PressureSensorBase("BMP388",
                              0.0    * drone::unit::pascal,
                              1000.0 * drone::unit::pascal,
                              25.0   * drone::unit::hertz,
                              [](drone::unit::Pressure const pressure)
                              {
                                Serial.print("[ASYNC] p = ");
                                Serial.print(pressure.value());
                                Serial.println(" Pascal");
                              })
  { }
  virtual ~DummyPressureSensor() { }

  virtual void get(drone::unit::Pressure & val) override { val = drone::unit::Pressure(1023.0 * drone::unit::pascal); }
  void onExternalEvent() { onSensorValueUpdate(drone::unit::Pressure(65.8 * drone::unit::pascal)); }
};
/* ... */
DummyPressureSensor pressure_sensor;
/* ... */
void setup()
{
  Serial.begin(9600);
  while (!Serial) { }

  Serial.println(pressure_sensor);

  drone::unit::Pressure pressure_val = 0.0 * drone::unit::pascal;
  Serial.print("[SYNC] p = ");
  Serial.print(pressure_val.value());
  Serial.println(" Pascal");
  Serial.println();


  pressure_sensor.onExternalEvent();
}

void loop()
{

}

About

A unified sensor abstraction layer used by all 107-system sensor libraries.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages