Skip to content

Instantly share code, notes, and snippets.

@rveitch
Created September 26, 2017 21:41
Show Gist options
  • Select an option

  • Save rveitch/c3acab292d61b17cb6fa93b19919cccb to your computer and use it in GitHub Desktop.

Select an option

Save rveitch/c3acab292d61b17cb6fa93b19919cccb to your computer and use it in GitHub Desktop.
Particle Temperature Sensor
#include <Adafruit_DHT.h>
#include "Adafruit_DHT.h"
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
dht.begin();
}
void loop() {
delay(60000); // Wait a minute between measurements.
float h = dht.getHumidity();
float f = dht.getTempFarenheit(); // Read temperature as Farenheit
Particle.publish("temp", String::format("%4.1f", f), PRIVATE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment