help me, I've been stuck here for a month. i just want a correct value
i got value of ph =5 for ph 7
and got ph=7 for ph 4
here my code
im using esp8266
void loop() {
//String myData = String(analogRead(A0));
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{
buf[i]=analogRead(A0);
delay(10);
}
for(int i=0;i<9;i++) //sort the analog from small to large
{
for(int j=i+1;j<10;j++)
{
if(buf[i]>buf[j])
{
temp=buf[i];
buf[i]=buf[j];
buf[j]=temp;
}
}
}
avgValue=0;
for(int i=2;i<8;i++) //take the average value of 6 center sample
avgValue+=buf[i];
float phValue=(float)avgValue5.0/1023/6; //convert the analog into millivolt
phValue=3.5phValue; //convert the millivolt into pH value
phValue=phValue-4;
//String myData = String(analogRead(A0))
void loop() {
//String myData = String(analogRead(A0));
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{
buf[i]=analogRead(A0);
delay(10);
}
for(int i=0;i<9;i++) //sort the analog from small to large
{
for(int j=i+1;j<10;j++)
{
if(buf[i]>buf[j])
{
temp=buf[i];
buf[i]=buf[j];
buf[j]=temp;
}
}
}
avgValue=0;
for(int i=2;i<8;i++) //take the average value of 6 center sample
avgValue+=buf[i];
float phValue=(float)avgValue*5.0/1023/6; //convert the analog into millivolt
phValue=3.5*phValue; //convert the millivolt into pH value
phValue=phValue-4;
//String myData = String(analogRead(A0))
Blynk.virtualWrite(V0, phValue);
Blynk.run();
}