Skip to content

Instantly share code, notes, and snippets.

Created April 9, 2016 22:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// This #include statement was automatically added by the Particle IDE.
#include "OneWire/OneWire.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"
double tempF = 0.0;
int tempSensorPin = D2;
OneWire oneWire(tempSensorPin);
DallasTemperature sensors(&oneWire);
void setup() {
//Particle.variable("tempf", tempF);
void loop() {
tempF = sensors.getTempFByIndex(0);
if ( tempF > -50 && tempF < 150) // might want to guard against a spurious high value as well
Particle.publish( "Temp F", String(tempF,DEC) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment