#include #include #define col 16 #define lin 2 #define ende 0x27 int pHSense = A0; int samples = 10; float adc_resolution = 1024.0; LiquidCrystal_I2C lcd(ende,col,lin); void setup() { Serial.begin(9600); lcd.init(); lcd.backlight(); lcd.clear(); delay(100); } float ph (float voltage) { return 7 + ((2.5 - voltage) / 0.18); } void loop() { lcd.setCursor(0, 0); Serial.println("Valor ph"); int measurings=0; for (int i = 0; i < samples; i++) { measurings += analogRead(pHSense); delay(10); } float voltage = 5 / adc_resolution * measurings/samples; Serial.print("pH= "); Serial.println(ph(voltage)); lcd.setCursor(0, 1); lcd.print(ph(voltage)); delay(3000); lcd.clear(); }