Created
November 24, 2020 09:35
-
-
Save ajangrahmat/b8e8f7fd55800163a7d20fa856373d5f to your computer and use it in GitHub Desktop.
Program Arduino Sederhana untuk Baca Sensor Suhu DS18B20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <OneWire.h> | |
#include <DallasTemperature.h> | |
OneWire pin_DS18B20(4); | |
DallasTemperature DS18B20(&pin_DS18B20); | |
void setup(void) { | |
Serial.begin(9600); | |
DS18B20.begin(); | |
} | |
void loop(void) { | |
DS18B20.requestTemperatures(); | |
Serial.print("Suhu Celsius: "); | |
Serial.print(DS18B20.getTempCByIndex(0)); | |
Serial.print(" - Suhu Fahrenheit: "); | |
Serial.println(DS18B20.getTempFByIndex(0)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment