Last active
October 16, 2017 15:03
-
-
Save dustynrobots/8a7a5e7b0ff744c30959a8664388df83 to your computer and use it in GitHub Desktop.
Lab3_TeaTime_Part4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TEA TIME! | |
// Libraries for the DS18B20 Temperature Sensor | |
#include <OneWire.h> | |
#include <DallasTemperature.h> | |
// PINS-------------------------------------- | |
// One-Wire Temperature Sensor | |
#define ONE_WIRE_BUS 2 // Blue Stripe is data | |
// initialize a ledPin here | |
// initialize a pin for the power switch tail here | |
// LIBRARY STUFF ---------------------------- | |
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) | |
OneWire oneWire(ONE_WIRE_BUS); | |
// Pass our oneWire reference to Dallas Temperature. | |
DallasTemperature sensors(&oneWire); | |
// CONSTANTS & VARIABLES---------------------------------- | |
// initialize any variables or constants you want to hold the temperature value, etc. | |
// SETUP ------------------------------------------------------------ | |
void setup(void) { | |
// initialize all digital pins | |
sensors.begin(); // start up the DS18B20 One Wire Temperature Sensor | |
Serial.begin(9600); // this lets us write stuff to the serial monitor | |
} | |
// LOOP ------------------------------------------------------------ | |
void loop(void) { | |
/* | |
Use this function call to the library to enable the sensor to give you temperatures: | |
sensors.requestTemperatures(); | |
Now to get an actual temperature you can use: | |
sensors.getTempFByIndex(0); | |
You may want to assign this to a variable, something like: | |
float temperature = sensors.getTempFByIndex(0); | |
*/ | |
// now add some logic to get the LED to turn on and power switch tail to turn off at | |
// your table's specific tea temperature | |
} //close loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment