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

Library doesn't work with new Seead Ultrasonic Distance Ranger V2 #69

Open
benpaddlejones opened this issue Jul 14, 2023 · 7 comments
Open
Labels

Comments

@benpaddlejones
Copy link

Describe the bug
Code loads, Serial monitor prints line statements but measurement value is always 0

Code to reproduce

#include <Ultrasonic.h>

Ultrasonic myUltrasonicSensor(5);
int distance;

void setup() {
  Serial.begin(9600);
}

void loop() {
  // Pass INC as a parameter to get the distance in inches
  distance = myUltrasonicSensor.read();
  
  Serial.print("Distance in CM: ");
  Serial.println(distance);
  delay(1000);
}

Wiring
Connected to a Seead Senor Shield

Expected behavior
As Sensor is moved distance value should show distance to object

Error message
none

Context (please complete the following information):

  • OS: [e.g. Windows x64]
  • IDE version: [e.g. Arduino 1.8.5]
  • Sensor: [e.g. HC-SC04]
  • Library version [e.g. 2.1.0]
@benpaddlejones
Copy link
Author

Ths is the Library the unit uses: https://github.com/Seeed-Studio/Seeed_Arduino_UltrasonicRanger

@ErickSimoes
Copy link
Owner

Hello, @benpaddlejones!

Thank you very much for sharing this issue.

Could you give me a link to the sensor you are using? If that's what I'm thinking, unfortunately I don't have any here with me to test.

However, Seed itself provides a library for ultrasound that uses a strategy to measure distance very similar to this one.
Could you try this library and tell me if the sensor is behaving correctly with it?

Thank you very much!

@benpaddlejones
Copy link
Author

Hi Erick
Sensor is version 2.0 listed in the Seead documentation here: https://wiki.seeedstudio.com/Grove-Ultrasonic_Ranger/

Yes it works perfectly with the Seead library (same link you shared) and sample code provided in the documentation.

Happy to help with any testing my end.

Be great if you can solve as I would rather just use one library for both our schools Seead Grove ultrasonic senors and generic 4 pin ultrasonic senors.

Ben

@ErickSimoes
Copy link
Owner

Great, Ben!

This week I'm going to see if I can get one of these sensors in the lab where I work, but I already bought one of these and now I'm going to wait for it to arrive to do the necessary tests and adjustments (it may take a while due to the delivery time here to Brazil).

As soon as I update it, I'll let you know here.

Thanks!

@ErickSimoes
Copy link
Owner

@benpaddlejones, would you be able to test version 2.1.0 of the library?

I think the addition of a delay() could be causing this issue you are experiencing.

@benpaddlejones
Copy link
Author

Hi Erick
I can confim 2.1.0 works perfectly using the example code in the library.
Ben

@benpaddlejones
Copy link
Author

Hi Erick
Did your sensor arrive in the post or still on the way?
Ben

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

No branches or pull requests

2 participants