-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemperature.ino
32 lines (26 loc) · 943 Bytes
/
temperature.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
This Arduino sketch controls a personal weather station and use an ethernet shield to upload data to wunderground.com.
Details about the weather station can be found at http://www.avanux.de/space/Arduino/Wetterstation.
*/
//////////////
// Libraries
//////////////
#include <OneWire.h>
#include <DallasTemperature.h>
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(temperaturePin);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
void setupTemperature()
{
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
}
void loopTemperature()
{
sensors.requestTemperatures();
temperature = sensors.getTempCByIndex(0);
#ifdef INFO_WS
Serial.print(F("Temperature="));
Serial.println(temperature);
#endif
}