Select list item: List index too large help plzz

#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;

void setup() {

Serial.begin(9600);
delay(10000);//Delay to let system boot

delay(10000);//Wait before accessing Sensor
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
}//end "setup()"

void loop() {
//Start of Program

DHT.read11(dht_apin);
int sensorValue = analogRead(A1);// read the input on analog pin 0:
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
delay(5000);

Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C ");
Serial.print(" TUrbidity ="); // print out the value you read:
Serial.print(voltage);
Serial.println("NTU");

}

this was the code on this it was working perfectly

now with this it gives error
#include <dht.h>

#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;
#define SensorPin 0 // the pH meter Analog output is connected with the Arduino’s Analog
unsigned long int avgValue; //Store the average value of the sensor feedback
float b;
int buf[10],temp;

void setup()
{
pinMode(13,OUTPUT);

Serial.println("Ready");

Serial.begin(9600);
delay(10000);//Delay to let system boot

delay(10000);//Wait before accessing Sensor
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
}//end "setup()"

void loop() {
//Start of Program

DHT.read11(dht_apin);
int sensorValue = analogRead(A1);// read the input on analog pin 0:
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
delay(5000);
{
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{
buf[i]=analogRead(SensorPin);
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 ph=(float)avgValue5.0/1024/6; //convert the analog into millivolt
ph=3.5
ph; //convert the millivolt into pH value

Serial.print(ph,2);
Serial.println(" ");
digitalWrite(13, HIGH);
delay(80000);
digitalWrite(13, LOW);

}

Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C ");
Serial.print(" TUrbidity ="); // print out the value you read:
Serial.print(voltage);
Serial.println("NTU");

}

#include <dht.h>

#define dht_apin A0 // Analog Pin sensor is connected to

dht DHT;
#define SensorPin 0 // the pH meter Analog output is connected with the Arduino’s Analog
unsigned long int avgValue; //Store the average value of the sensor feedback
float b;
int buf[10],temp;

void setup()
{
pinMode(13,OUTPUT);


Serial.begin(9600);
delay(10000);//Delay to let system boot

delay(10000);//Wait before accessing Sensor
pinMode(A0,OUTPUT);
pinMode(A1,OUTPUT);
}//end "setup()"

void loop() {
//Start of Program

DHT.read11(dht_apin);
int sensorValue = analogRead(A1);// read the input on analog pin 0:
float voltage = sensorValue * (5.0 / 1024.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
delay(5000);
{
for(int i=0;i<10;i++) //Get 10 sample value from the sensor for smooth the value
{
buf[i]=analogRead(SensorPin);
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 ph=(float)avgValue <em>5.0/1024/6; //convert the analog into millivolt
ph=3.5</em> ph; //convert the millivolt into pH value

digitalWrite(13, HIGH);
delay(80000);
digitalWrite(13, LOW);

}

Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.print("%|");
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.print("C|");
Serial.print(" TUrbidity ="); // print out the value you read:
Serial.print(voltage);
Serial.print("NTU|");
Serial.print("PH=");
Serial.print(ph,2);
Serial.print(" ");
}

I wonder what the "delay (80000);" is doing there?
You pause the program for 80 seconds.

yeah it gives right values i think so

I don't know this library for PH and I don't know what is this value (ph, 2)? Maybe you just need "serial.print (ph);"

i dont know ;(

Compile the program for arduino and run the test.

Hi

Your Sketch output is slightly incorrect - in your App, the values are expected to be separated by a bar "|" but the Sketch does not do this correctly - the bar must stand-alone so:

INCORRECT "%|" ; CORRECT "|"

The very last line should not be : Serial.print(" ")
It should be Serial.println()

In the App, Set the BT delimiter Block to 10 (= \n and matches the Sketch)

Also, ReceiveText numberOfBytes should be -1 to get the whole data stream.

So, correct blocks:

EDIT: Bluetooth packet size (data size +) is a precious commodity. Do not send anything other than the values and ensure that float/double values are restricted to only the decimal places necessary. The fancy dressing of the values with symbols (e.g. % C F etc) should be done in the App!

"%|" is a valid value. % will be displayed in the application as a unit, | is a sign of division. The bar not have to be stand-alone. On the application side, a uniform text ....% | .... will be created and the program will divide it correctly. As for serial.println (); that is correct.

In my experience it does make a difference Patryk, even though there is no logic published to support it. Same is true for the end-of-data - more reliable if it is a println only, with no value inside, again based on experience.

Better to benefit from the experience of others than to find out the hard way.