first commit
This commit is contained in:
31
NANO_DALLAS/NANO_DALLAS.ino
Normal file
31
NANO_DALLAS/NANO_DALLAS.ino
Normal file
@@ -0,0 +1,31 @@
|
||||
// Ethercard REL example
|
||||
#include <OneWire.h>
|
||||
#include <EEPROM.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
#define STATIC 0 // set to 1 to disable DHCP (adjust myip/gwip values below)
|
||||
|
||||
float temp;
|
||||
char temp_str[10];
|
||||
|
||||
#define ONE_WIRE_BUS 4
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(1); // necessary for my system
|
||||
sensors.requestTemperatures();
|
||||
temp = (sensors.getTempCByIndex(0));
|
||||
dtostrf(temp, 6, 2, temp_str);
|
||||
|
||||
Serial.println(temp);
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
Reference in New Issue
Block a user