Hi Guys,
it’s my first project with thinger, I want to send the value of PH to the thinger. I am using an ESP8266 MCU V2 and a PH4502C sensor.
const int analogInPin = A0;
int buf[10];
int temp=0;
unsigned long int inValue;
void setup() {
Serial.begin(9600);
}
void loop() {
for(int i=0; i<10;i++){
buf[i]= analogRead(analogInPin);
delay(10);
}
for(int i=0; i<9; i++){
for(int j=i+1;j<10;j++){
temp= buf[i];
buf[i]=buf[j];
buf[j]=temp;
}
}
inValue=0;
for(int i=2; i<8; i++){
inValue= inValue + buf[i];
}
float PHVol= (float)inValue1003.3/1024/6;
Serial.print("Voltaje mv =");
Serial.println(PHVol);
float PH= -0.0554*PHVol +22.236;
Serial.print("PH =");
Serial.println(PH);
delay(1000);
}
I already managed to send the reading of the dht22 sensor, but I can’t adapt it to send the ph reading, Please help