Created
May 18, 2018 15:56
-
-
Save arduinothai/4067d1ba1f747677e7fa08c932bd8e76 to your computer and use it in GitHub Desktop.
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
#include <Wire.h> | |
#include <SPI.h> | |
#include <Adafruit_Sensor.h> | |
#include <Adafruit_BMP280.h> | |
Adafruit_BMP280 bmp; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println(F("BMP280 test")); | |
if (!bmp.begin(0x76)) { | |
Serial.println(F("Could not find a valid BMP280 sensor, check wiring!")); | |
while (1); | |
} | |
} | |
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)); // this should be adjusted to your local forcase | |
Serial.println(" m"); | |
Serial.println(); | |
delay(2000); | |
} | |
// ที่มา https://github.com/adafruit/Adafruit_BMP280_Library |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment