const int Sensor = A0;
const float Temp_Ref = 20.0;
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
/*
byte customChar[] = {
B00000,
B01110,
B10001,
B10001,
B10001,
B01010,
B11011,
B00000
};
*/
/*byte customChar[] = {
B00000,
B01110,
B01010,
B01110,
B00000,
B00000,
B00000,
B00000
};
*/
byte customChar[] = {
B01110,
B10001,
B10001,
B10001,
B01010,
B01010,
B11011,
B00000
};
void setup() {
pinMode(7, OUTPUT);
Serial.begin(9600);
lcd.createChar(0, customChar);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Ardu Ohmetro 2023");
}
void loop() {
lcd.setCursor(0, 1); // set the cursor to column 0, line 1
int Valor_Sensor = analogRead(Sensor);
int Valor_Sensor2 = analogRead(1);
Serial.print("Valor del Sensor:");
Serial.println(Valor_Sensor);
Serial.println(Valor_Sensor2);
float Tension=(Valor_Sensor/1024.0)*5.0;
Serial.print("Voltaje:");
Serial.println(Tension);
Serial.print("Grados Celsius:");
float Temperatura=(Tension-0.5)*100;
Serial.println(Temperatura);
lcd.print("S=");
lcd.print(Valor_Sensor);
lcd.setCursor(7, 1);
lcd.print("T=");
lcd.print(Temperatura);
lcd.write(byte(0));
lcd.print("C");
if(Temperatura > 50){digitalWrite(7, 1);} else{digitalWrite(7,0);}
delay(2000);//delay para que el display muestre el mensaje
}