
Items required:
- Arduino Nano
- BMP280
- Jumper Wire
Circuit Diagram:
Video Example:
Coming Soon
Coming Soon
Software:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# This sample codes is for testing the BMP280. | |
# Editor : ProjectHub | |
# Date : 2020.06.06 | |
# Ver : 1.0 | |
# Product: pH meter | |
*/ | |
#include <Wire.h> | |
#include <SPI.h> | |
#include <Adafruit_BMP280.h> | |
Adafruit_BMP280 bmp; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println(F("BMP280 test")); | |
if (!bmp.begin()) { | |
Serial.println(F("Could not find a valid BMP280 sensor, check the wiring!")); | |
while (1); | |
} | |
/* Default settings from datasheet. */ | |
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. */ | |
Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */ | |
Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */ | |
Adafruit_BMP280::FILTER_X16, /* Filtering. */ | |
Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */ | |
} | |
void loop() { | |
Serial.print(F("Temperature = ")); | |
Serial.print(bmp.readTemperature()); | |
Serial.println(" *C"); | |
Serial.print(F("Pressure = ")); | |
Serial.print(bmp.readPressure()); | |
Serial.println(" Pa"); | |
Serial.print(F("Approx altitude = ")); | |
Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */ | |
Serial.println(" m"); | |
Serial.println(); | |
delay(2000); | |
} |
Updated Library:
No comments:
Post a Comment