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

Arduino library for interfacing with the BMP388 barometric pressure sensor which can be used for inferring altitude information.

License

Notifications You must be signed in to change notification settings

107-systems/107-Arduino-BMP388

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

107-Arduino-BMP388

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

Arduino library for interfacing with the BMP388 barometric pressure sensor which can be used for inferring altitude information.

This library works for

Example

#include <SPI.h>
#include <107-Arduino-BMP388.h>
/* ... */
static int const BMP388_CS_PIN  = 2;
static int const BMP388_INT_PIN = 6;
/* ... */
using namespace drone;
/* ... */
ArduinoBMP388 bmp388([](){ digitalWrite(BMP388_CS_PIN, LOW); },
                     [](){ digitalWrite(BMP388_CS_PIN, HIGH); },
                     [](uint8_t const d) -> uint8_t { return SPI.transfer(d); },
                     [](unit::Pressure const pressure)
                     {
                         Serial.print(pressure.value() / 100.0);
                         Serial.print(" hPa / ");
                         Serial.print(ArduinoBMP388::convertPressureToAltitude(pressure).value());
                         Serial.println(" m");
                     },
                     [](unit::Temperature const temperature)
                     {
                         Serial.print(temperature.value() + 273.15);
                         Serial.println(" °C");
                     });
/* ... */
void setup()
{
  Serial.begin(9600);
  while(!Serial) { }

  SPI.begin();
  pinMode(BMP388_CS_PIN, OUTPUT);
  digitalWrite(BMP388_CS_PIN, HIGH);

  pinMode(BMP388_INT_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(BMP388_INT_PIN), [](){ bmp388.onExternalEventHandler(); }, FALLING);

  bmp388.begin(BMP388::OutputDataRate::ODR_12_5_Hz);
}

void loop()
{

}

About

Arduino library for interfacing with the BMP388 barometric pressure sensor which can be used for inferring altitude information.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages