GY-63_MS5611/libraries/DS18B20_RT/examples/DS18B20_minimum/DS18B20_minimum.ino

40 lines
688 B
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: DS18B20_minimum.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.0.1
// PURPOSE: most minimal sketch
2021-12-17 05:59:45 -05:00
// URL: https://github.com/RobTillaart/DS18B20_RT
2021-01-29 06:31:58 -05:00
//
// WARNING: this sketch does not wait for isConversionComplete()
2021-12-17 05:59:45 -05:00
// and therefore temperature read is probably incorrect
2021-01-29 06:31:58 -05:00
// but it is fast and maybe accurate enough...
2021-12-17 05:59:45 -05:00
2021-01-29 06:31:58 -05:00
#include <OneWire.h>
#include <DS18B20.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DS18B20 sensor(&oneWire);
void setup(void)
{
Serial.begin(115200);
Serial.println(__FILE__);
sensor.begin();
}
void loop(void)
{
sensor.requestTemperatures();
Serial.println(sensor.getTempC());
2021-12-17 05:59:45 -05:00
}
// -- END OF FILE --