Skip to content

Instantly share code, notes, and snippets.

@DazWilkin
Created January 4, 2018 05:48
Show Gist options
  • Save DazWilkin/79f8140fc5c71735c5c82ffef0069350 to your computer and use it in GitHub Desktop.
Save DazWilkin/79f8140fc5c71735c5c82ffef0069350 to your computer and use it in GitHub Desktop.
#include "Adafruit_Si7021.h"
Adafruit_Si7021 sensor = Adafruit_Si7021();
double h;
double t;
void setup() {
sensor.begin();
Particle.variable("t", &t, DOUBLE);
Particle.variable("h", &h, DOUBLE);
}
void loop() {
h = sensor.readHumidity();
t = sensor.readTemperature();
Particle.publish("temperature", String::format("%1.2f", t), PRIVATE);
Particle.publish("humidity", String::format("%1.2f", h), PRIVATE);
delay(1800000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment