Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LiquidCrystal_PCF8574.h>
- #include <OneWire.h>
- #include <DS18B20.h>
- #define ONEWIRE_PIN 3
- #define SENSORS_NUM 2
- const byte address[SENSORS_NUM][8] PROGMEM = {
- 0x28, 0xFF, 0xA0, 0xD0, 0x47, 0x16, 0x3, 0x95,
- 0x28, 0xFF, 0x73, 0x12, 0x47, 0x16, 0x3, 0xBB
- };
- OneWire onewire(ONEWIRE_PIN);
- DS18B20 sensors(&onewire);
- LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
- int show;
- void setup()
- {
- int error;
- Serial.begin(115200);
- Serial.println("LCD...");
- while (! Serial);
- Serial.println("Dose: check for LCD");
- // See http://playground.arduino.cc/Main/I2cScanner
- Wire.begin();
- Wire.beginTransmission(0x27);
- error = Wire.endTransmission();
- Serial.print("Error: ");
- Serial.print(error);
- if (error == 0) {
- Serial.println(": LCD found.");
- } else {
- Serial.println(": LCD not found.");
- } // if
- lcd.begin(16, 2); // initialize the lcd
- show = 0;
- Serial.begin(9600);
- sensors.begin();
- sensors.request();
- } // setup()
- void loop()
- {
- lcd.setBacklight(255);
- if (sensors.available())
- {
- float temperature0 = sensors.readTemperature(FA(address[0]));
- float temperature1 = sensors.readTemperature(FA(address[1]));
- lcd.home(); lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print(F("Zasilanie "));
- lcd.print(temperature0);
- lcd.print(F("C"));
- lcd.setCursor(0, 1);
- lcd.print(F("Powrot "));
- lcd.print(temperature1);
- lcd.println(F("C"));
- delay(5000);
- sensors.request();
- }
- } // loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement