#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x3F for a 16 chars and 2 line display
void setup() {
Wire.begin();
pinMode(9, OUTPUT);
lcd.init();
lcd.clear();
lcd.backlight(); // Make sure backlight is on
// Print a message on both lines of the LCD.
lcd.setCursor(0,0); //Set cursor to character 2 on line 0
lcd.print("Hello world!");
lcd.setCursor(0,1); //Move cursor to character 2 on line 1
lcd.print("LCD Tutorial ");
}
unsigned int c= 0;
int d = 100;
int i;
int i1 = 0;
String s1 = "[email protected] 07475736915 GIF Wokwi Code PCBWAY Electronics is a scientific and engineering discipline that studies and applies the principles of physics to design, create, and operate devices that manipulate electrons and other electrically charged particles. Electronics is a subfield of physics[1][2] and electrical engineering which uses active devices such as transistors, diodes, and integrated circuits to control and amplify the flow of electric current and to convert it from one form to another, such as from alternating current (AC) to direct current (DC) or from analog signals to digital signals";
String s2 = " hello from s2 again ";
int sLen = s1.length();
int dLen = 16;
void loop(){
sensors.requestTemperatures();
s1 = "Celcuis " + String(int(sensors.getTempCByIndex(0)))+ " Farenhiet " + String(sensors.getTempFByIndex(0)) + " -------";
float c = sensors.getTempCByIndex(0);
if(c >= 36.00){
digitalWrite(9, HIGH);
}else{
digitalWrite(9,LOW);
}
int sLen = s1.length();
lcd.clear();
if(c < 0){
for (i = 0; i<abs(c); i++){
lcd.setCursor(0,0);
lcd.print("Temp -" + String(i)+" Deg");
}
}else{
for(i =0; i<c+1; i++){
lcd.setCursor(0,0);
lcd.print("Temp : " + String(i) +" Deg");
delay(d);
}
}
delay(d*20);
}