1234567891011121314151617181920212223242526272829303132333435 |
- #include <OneWire.h>
- #include <DallasTemperature.h>
- #define ONE_WIRE_BUS 2
- #define ONE_WIRE_PULLUP 3
- OneWire oneWire(ONE_WIRE_BUS);
- DallasTemperature sensors(&oneWire, ONE_WIRE_PULLUP);
- void setup(void)
- {
-
- Serial.begin(9600);
- Serial.println("Dallas Temperature IC Control Library Demo");
-
- sensors.begin();
- }
- void loop(void)
- {
-
-
- Serial.print("Requesting temperatures...");
- sensors.requestTemperatures();
- Serial.println("DONE");
-
- for(int i=0;i<sensors.getDeviceCount();i++) {
- Serial.println("Temperature for Device "+String(i)+" is: " + String(sensors.getTempCByIndex(i)));
- }
- }
|