Tobias Müller ced9fb271d initial commit | 11 달 전 | |
---|---|---|
.. | ||
examples | 11 달 전 | |
extras | 11 달 전 | |
src | 11 달 전 | |
LICENSE.txt | 11 달 전 | |
README.md | 11 달 전 | |
keywords.txt | 11 달 전 | |
library.properties | 11 달 전 |
Arduino library for the Maxim Integrated DS18B20 1-Wire temperature sensor. This library is very simple and intuitive to use, and supports auto-discovering sensors with an optional high/low condition or manually addressing individual sensors.
For example, we can get the temperature from every sensor on the wire with just a few lines of code:
#include <DS18B20.h>
DS18B20 ds(2);
void setup() {
Serial.begin(9600);
}
void loop() {
while (ds.selectNext()) {
Serial.println(ds.getTempC());
}
}
See the included examples for more.
This library uses the OneWire library, so you will need to have this installed. Install it using the Library Manager in the Arduino IDE or download the latest release from GitHub.
In the OneWire.h file set ONEWIRE_SEARCH
to 0 since the search functionality is also implemented in this library (don't do this if you need the search functionality for other 1-Wire devices). CRC must be enabled (choose whichever algorithm you prefer). This may save some space on your Arduino.
The resistor shown in all the circuit diagrams is 4.7k Ohm pullup resistor.