for what reason there are the same commands four times in a code e.g.
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
for what reason there are the same commands four times in a code e.g.
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
What code would that be ?
Cut-and-paste? We really can't tell without seeing the whole code and know what the application is.
No reason. Since each reading is over writing the variable "distance" the is no program reason for such code.
Hardware: Unlikely but possible is if the sensor needed to "warm up" and the first three were there to perform the "warm up". As I said this is very unlikely.