#include <Wire.h>
#include <Arduino.h>
#define TDS_PIN 35
// Define PH_PIN
#define PH_PIN 32
void setup() {
Wire.begin(23, 22);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
int16_t tdsValue = analogRead(TDS_PIN);
float voltage = tdsValue * (5 / 4095.0);
int mappedTdsValue = (voltage / 2.3) * 1000;
// Read phValue from PH_PIN
int16_t phValue = analogRead(PH_PIN);
// Covert the phValue to voltagePh
float voltagePh = phValue * (5 / 4095.0);
// find mappedPhValue
int mappedPhValue = (voltagePh / 2.3) * 14;
Serial.print("TDS: ");
Serial.print(mappedTdsValue);
Serial.print(" PH: ");
Serial.println(mappedPhValue);
delay(100);
}