Last active
January 17, 2018 11:54
-
-
Save TakehikoShimojima/d24cc9b3d415de4735f2d2c6bf63b94e to your computer and use it in GitHub Desktop.
ESPr DeveloperとBME280のテストプログラム 5秒毎に温度、湿度、気圧を測定し、シリアルモニタに出力する
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
/* | |
* BME280で5秒毎に温度、湿度、気圧を測定し、シリアルモニタに出力する | |
*/ | |
#include <ESP8266WiFi.h> | |
#include <SPI.h> | |
#include "BME280_SPI.h" | |
#define BME_CS 15 | |
#define PERIOD 5 | |
BME280 bme280; | |
void setup() | |
{ | |
Serial.begin(115200); | |
delay(10); | |
Serial.println("Start"); | |
bme280.begin(BME_CS); | |
} | |
void loop() | |
{ | |
double temp, humid, pressure; | |
temp = bme280.readTemperature(); | |
humid = bme280.readHumidity(); | |
pressure = bme280.readPressure(); | |
Serial.print("temp: "); | |
Serial.print(temp); | |
Serial.print(", humid: "); | |
Serial.print(humid); | |
Serial.print(", pressure: "); | |
Serial.println(pressure); | |
delay(PERIOD * 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment