/*
* Project Thermal-Compare
* Description:
* Author: Nicholas Stone
* Date: 1/29/2017
* Version: 1
*/
#include "OneWire.h"
#include "spark-dallas-temperature.h"
//instances
OneWire oneWire(D0);
DallasTemperature dallas(&oneWire);
//vars
// double tempC = 0.0;
double tempF = 0.0;
void setup() {
//Register
// Particle.variable("tempC", &tempC, DOUBLE);
Particle.variable("tempF", &tempF, DOUBLE);
//start library
dallas.begin();
}
void loop() {
//request conversion
dallas.requestTemperatures();
//get temperature in Celsius and convert to Fahrenheit
tempF = (double)DallasTemperature::toFahrenheit(dallas.getTempCByIndex(0));
delay(5000);
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .