Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TakehikoShimojima/ea6f621e8a65f7201e3080ce69b82b91 to your computer and use it in GitHub Desktop.
Save TakehikoShimojima/ea6f621e8a65f7201e3080ce69b82b91 to your computer and use it in GitHub Desktop.
void loop()
{
int t = millis();
float temp, humid, pressure;
// BME280で温度、湿度、気圧を測定する
temp = (float)bme280.readTemperature();
humid = (float)bme280.readHumidity();
pressure = (float)bme280.readPressure();
// 温度、湿度を渡して、CO2、TVOCの値を測定する
readCCS811(humid, temp);
// 温度、湿度、気圧、CO2、TVOCの値をAmbientに送信する
ambient.set(1, String(temp).c_str());
ambient.set(2, String(humid).c_str());
ambient.set(3, String(pressure).c_str());
ambient.set(4, CO2);
ambient.set(5, TVOC);
ambient.send();
t = millis() - t;
t = (t < PERIOD * 1000) ? (PERIOD * 1000 - t) : 1;
delay(t);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment