Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in the tutorial DistanceSensor #33

Open
agy-why opened this issue Feb 7, 2021 · 1 comment
Open

Typo in the tutorial DistanceSensor #33

agy-why opened this issue Feb 7, 2021 · 1 comment

Comments

@agy-why
Copy link

agy-why commented Feb 7, 2021

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

@agy-why
Copy link
Author

agy-why commented Feb 8, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant