Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h> // Comes with Arduino IDE
- #include <LiquidCrystal_I2C.h>
- #include <OneWire.h>
- #include <DallasTemperature.h>
- // Data wire is plugged into port 2 on the Arduino
- #define ONE_WIRE_BUS 2
- // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
- OneWire oneWire(ONE_WIRE_BUS);
- // Pass our oneWire reference to Dallas Temperature.
- DallasTemperature sensors(&oneWire);
- LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
- void setup()
- {
- Serial.begin(9600);
- sensors.begin();
- lcd.begin(16,2);
- lcd.backlight();
- }
- void loop()
- {
- sensors.requestTemperatures(); // Send the command to get temperatures
- lcd.setCursor(0,0); //Start at character 4 on line 0
- lcd.print("In: ");
- lcd.print(sensors.getTempCByIndex(0),1);
- lcd.write(223);
- lcd.print("/ ");
- lcd.print(sensors.getTempCByIndex(1),1);
- lcd.write(223);
- lcd.setCursor(0,1); //Start at character 4 on line 0
- lcd.print("Out: ");
- lcd.print(sensors.getTempCByIndex(2),1);
- lcd.write(223);
- delay(300);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement