hi, thankx for the reply.. yes, i already try to read each sensor individually and code it without using any library.. the result still same.
#define trigPin 23
#define echoPin 22
#define trigPin1 24
#define echoPin1 25
#define trigPin2 26
#define echoPin2 27
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
pinMode(trigPin1, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin1, INPUT);// set the echo pin to input (recieve sound waves)
pinMode(trigPin2, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin2, INPUT);// set the echo pin to input (recieve sound waves)
long duration, distance; // start the scan
digitalWrite(trigPin, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trigPin, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin,HIGH,10000);
distance = (duration/2) / 29.1;// convert the distance to centimeters.
Serial.print ("Distance is " );
Serial.println ( distance);
delay(2000);
long duration1, distance1; // start the scan
digitalWrite(trigPin1, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trigPin1, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPin1, LOW);
duration1 = pulseIn(echoPin1,HIGH,10000);
distance1 = (duration1/2) / 29.1;// convert the distance to centimeters.
Serial.print ("Distance1 is " );
Serial.println ( distance1);
delay(2000);
long duration2, distance2; // start the scan
digitalWrite(trigPin2, LOW);
delayMicroseconds(2); // delays are required for a succesful sensor operation.
digitalWrite(trigPin2, HIGH);
delayMicroseconds(10); //this delay is required as well!
digitalWrite(trigPin2, LOW);
duration2 = pulseIn(echoPin2,HIGH,10000);
distance2 = (duration2/2) / 29.1;// convert the distance to centimeters.
Serial.print ("Distance2 is " );
Serial.println ( distance2);
}
void loop() {
// put your main code here, to run repeatedly:
}