Typo in the tutorial DistanceSensor
agy-why opened this issue · 1 comments
Dear SparkFun,
First I want to thank you for your work, and your contribution to the maker community. You products are great and this KIT is again a perfect example.
Nevertheless, I found a misleading typo in the comment of the DistanceSensor .ino file.
float getDistance()
{
float echoTime; //variable to store the time it takes for a ping to bounce off an object
float calculatedDistance; //variable to store the distance calculated from the echo time
//send out an ultrasonic pulse that's 10ms long
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
...The call delayMicroseconds(10) delay for 10 microseconds, however the comment says: "an ultrasonic pulse that's 10ms long"
it should be "10us", nothing bad, but it maybe misleading for non-physicists.
Thank you again, and I wish you a nice day,
Yori
After more careful readings of the datasheet of HC-SR04 the comment "send out an ultrasonic pulse that's 10ms long" is actually not correct.
According to the datasheet: https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf , a series of 8 impulsions at 40 kHz are triggered when a signal longer than 10us is send to the trig INPUT. When the echo is received an impulse is send to echo OUTPUT proportional to the two-way-ranging measured duration.
I'd suggest to correct this misleading comment and add the link to the datasheet in the source code for more details.
Thank you again,
Yori