great job... i use the library in my project and test my robot.

i have 15 SRF05 sonar sensors on the bot. I set pingSpeed 200ms, and pingInterval 35ms, but sometimes i get big value or negative value.

`#include <NewPing.h>`

#define MAX_DISTANCE 200

NewPing sonar0(41, 42, MAX_DISTANCE);

NewPing sonar1(43, 44, MAX_DISTANCE);

NewPing sonar2(45, 20, MAX_DISTANCE);

NewPing sonar3(21, 22, MAX_DISTANCE);

NewPing sonar4(23, 24, MAX_DISTANCE);

NewPing sonar5(25, 26, MAX_DISTANCE);

NewPing sonar6(27, 28, MAX_DISTANCE);

NewPing sonar7(29, 30, MAX_DISTANCE);

NewPing sonar8(31, 32, MAX_DISTANCE);

NewPing sonar9(34, 33, MAX_DISTANCE); //10

NewPing sonar10(35, 36, MAX_DISTANCE); //11

NewPing sonar11(37, 38, MAX_DISTANCE);

NewPing sonar12(39, 40, MAX_DISTANCE);

NewPing sonar13(50, 51, MAX_DISTANCE);

NewPing sonar14(52, 53, MAX_DISTANCE);

#define pingSpeed 100

#define pingInterval 35

#define SONAR_NUM 15

unsigned long pingTimer[SONAR_NUM];

void setup()

{

Serial.begin(115200);

pingTimer[0] = millis() + pingSpeed;

for(int i = 0; i < SONAR_NUM - 1; i++) {

pingTimer[i+1] = pingTimer[i] + pingInterval;

}

}

void loop()

{

int cm[15];

unsigned long time = millis();

if (millis() >= pingTimer[0]) {

pingTimer[0] += pingSpeed;

cm[0] = sonar0.ping_cm();

}

if (millis() >= pingTimer[1]) {

pingTimer[1] = pingTimer[0] + pingInterval;

cm[1] = sonar1.ping_cm();

}

if (millis() >= pingTimer[2]) {

pingTimer[2] = pingTimer[1] + pingInterval;

cm[2] = sonar2.ping_cm();

}

if (millis() >= pingTimer[3]) {

pingTimer[3] = pingTimer[2] + pingInterval;

cm[3] = sonar3.ping_cm();

}

if (millis() >= pingTimer[4]) {

pingTimer[4] = pingTimer[3] + pingInterval;

cm[4] = sonar4.ping_cm();

}

if (millis() >= pingTimer[5]) {

pingTimer[5] = pingTimer[4] + pingInterval;

cm[5] = sonar5.ping_cm();

}

if (millis() >= pingTimer[6]) {

pingTimer[6] = pingTimer[5] + pingInterval;

cm[6] = sonar6.ping_cm();

}

if (millis() >= pingTimer[7]) {

pingTimer[7] = pingTimer[6] + pingInterval;

cm[7] = sonar7.ping_cm();

}

if (millis() >= pingTimer[8]) {

pingTimer[8] = pingTimer[7] + pingInterval;

cm[8] = sonar8.ping_cm();

}

if (millis() >= pingTimer[9]) {

pingTimer[9] = pingTimer[8] + pingInterval;

cm[9] = sonar9.ping_cm();

}

if (millis() >= pingTimer[10]) {

pingTimer[10] = pingTimer[9] + pingInterval;

cm[10] = sonar10.ping_cm();

}

if (millis() >= pingTimer[11]) {

pingTimer[11] = pingTimer[10]+ pingInterval;

cm[11] = sonar11.ping_cm();

}

if (millis() >= pingTimer[12]) {

pingTimer[12] = pingTimer[11]+ pingInterval;

cm[12] = sonar12.ping_cm();

}

if (millis() >= pingTimer[13]) {

pingTimer[13] = pingTimer[12]+ pingInterval;

cm[13] = sonar13.ping_cm();

}

if (millis() >= pingTimer[14]) {

pingTimer[14] = pingTimer[13]+ pingInterval;

cm[14] = sonar14.ping_cm();

for(int i = 0; i < 15; i++) {

Serial.print("Ping");

Serial.print(i);

Serial.print(": ");

Serial.print(cm[i]);

Serial.print("cm");

}

Serial.println();

}

}

The ping12 result like this :

Ping12: 3328cm

Ping12: 12288cm

Ping12: -24544cm

my code is not simple and clean, and i'd like to know how to use NewPing to slove 15 sonar sensors problem