daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Dec 13th, 2016 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <OneWire.h>
  2. #include <DallasTemperature.h>
  3.  
  4. #define ONE_WIRE_BUS 2
  5.  
  6. OneWire oneWire(ONE_WIRE_BUS);
  7. DallasTemperature sensors(&oneWire);
  8.  
  9. void setup(void)
  10. {
  11.   Serial.begin(9600);
  12.   Serial.println("Dallas Temperature IC Control Library Demo");
  13.   sensors.begin();
  14. }
  15.  
  16.  
  17. void loop(void)
  18. {
  19.   Serial.print(" Requesting temperatures...");
  20.   sensors.requestTemperatures();
  21.   Serial.println("DONE");
  22.  
  23.   Serial.print("Temperature for Device 1 is: ");
  24.   Serial.print(sensors.getTempCByIndex(0));
  25.  
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top