SHARE
TWEET

Untitled

a guest Feb 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <OneWire.h>
  2. #include <DallasTemperature.h>
  3. #include <LiquidCrystal_I2C.h>
  4.  
  5. LiquidCrystal_I2C lcd(0x27, 16, 2);
  6.  
  7. const int pinCidlaDS = 2;
  8. OneWire oneWireDS(pinCidlaDS);
  9. DallasTemperature senzoryDS(&oneWireDS);
  10.  
  11. void setup(void) {
  12.   lcd.begin(16,2);
  13.   lcd.init();
  14.   lcd.backlight();
  15.   Serial.begin(9600);
  16.   senzoryDS.begin();
  17. }
  18.  
  19. void loop(void) {
  20.   senzoryDS.requestTemperatures();
  21.   Serial.print("Teplota cidla DS18B20: ");
  22.   float teplota = (senzoryDS.getTempCByIndex(0));
  23.   Serial.print(teplota);
  24.   Serial.println(" stupnu Celsia");
  25.   lcd.setCursor(6, 0);
  26.   lcd.print("PEKLO");
  27.   lcd.setCursor(0, 1);
  28.   lcd.print("Teplota: ");
  29.   lcd.setCursor(9, 1);
  30.   lcd.print(teplota);
  31.   lcd.setCursor(14, 1);
  32.   lcd.print((char)223);
  33.   lcd.setCursor(15, 1);
  34.   lcd.print("C");
  35.   delay(1000);
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top