User Manual
Software Code
Open Arduino IDE.
Install the Grove Barometer Sensor library: Navigate to Sketch -> Include Library ->
Manage Libraries… and Search for the keyword “Grove BMP280” in the Library
Manager, then install.
Copy the following code, click Verify to check for syntax errors. Verify that there are no
errors, and you can upload the code.
In this program, acceleration information is sent from the sensor to Seeeduino via I2C
bus and then Seeeduino printed them onto the serial monitor. Open the serial monitor
to check the result.
//Air pressure detection
#include "Seeed_BMP280.h"
#include <Wire.h>
BMP280 bmp280;
void setup() {
Serial.begin(9600);
if (!bmp280.init()) {
Serial.println("Device not connected or broken!");
}
}
void loop() {
float pressure;
//get and print temperatures
Serial.print("Temp: ");
Serial.print(bmp280.getTemperature());
Serial.println("C"); // The unit for Celsius because original arduin
o don't support speical symbols
//get and print atmospheric pressure data
Serial.print("Pressure: ");
Serial.print(pressure = bmp280.getPressure());
Serial.println("Pa");
//get and print altitude data
Serial.print("Altitude: ");
Serial.print(bmp280.calcAltitude(pressure));
Serial.println("m");
Serial.println("\n");//add a line between output of different times.
delay(1000);
}
52
Grove Beginner Kit For Arduino®










