Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <OneWire.h>
- #include <DallasTemperature.h>
- // Data wire is plugged into port 2 on the Arduino
- #define ONE_WIRE_BUS 2
- OneWire oneWire(ONE_WIRE_BUS);
- DallasTemperature sensors(&oneWire);
- void setup(void)
- {
- // start serial port
- Serial.begin(9600);
- Serial.println("Dallas Temperatura Demo");
- // Start up the library
- sensors.begin();
- }
- void loop(void)
- {
- // call sensors.requestTemperatures() to issue a global temperature
- // request to all devices on the bus
- Serial.print("Leyendo temperaturas...");
- sensors.requestTemperatures(); // Send the command to get temperatures
- Serial.println(" Listo");
- Serial.print("La Temperatura es: ");
- Serial.println(sensors.getTempCByIndex(0));
- delay(3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement