/*
Basic BMP180 pressure / MPU6050 Accel & Gyro Demo
February 2026
*/
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
sensors_event_t a, g, temp;
Adafruit_MPU6050 mpu;
Adafruit_BMP085 bmp;
void setup() {
Serial.begin(115200);
if (!bmp.begin()) {
Serial.println("BMP180 not found!");
while (1);
}
if (!mpu.begin()) {
Serial.println("MPU6050 not connected!");
while (1);
}
Serial.println("MPU6050 ready!");
Serial.println("BMP180 ready!\n");
}
void loop() {
// get data
int32_t pressure = bmp.readPressure();
float altitude = bmp.readAltitude();
float temperature = bmp.readTemperature();
mpu.getEvent(&a, &g, &temp);
// print it out
Serial.print("Temperature:\t");
Serial.print(temperature, 1);
Serial.println(" °C");
Serial.print("Pressure:\t");
Serial.print(pressure / 100.0);
Serial.println(" hPa");
Serial.print("Altitude:\t");
Serial.print(altitude);
Serial.println(" m");
Serial.print("Acceleration:\t");
Serial.print("X: ");
Serial.print(a.acceleration.x);
Serial.print(", Y: ");
Serial.print(a.acceleration.y);
Serial.print(", Z: ");
Serial.print(a.acceleration.z);
Serial.println(" m/s^2");
Serial.print("Rotation:\t");
Serial.print("X: ");
Serial.print(g.gyro.x);
Serial.print(", Y: ");
Serial.print(g.gyro.y);
Serial.print(", Z: ");
Serial.print(g.gyro.z);
Serial.println(" rad/s");
Serial.println();
delay(2000);
}
Loading
bmp180
bmp180