Skip to content
New issue

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

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

Already on GitHub? # to your account

Error with multiple ultrasonic distance sensors #213

Open
enkith opened this issue Nov 11, 2024 · 0 comments
Open

Error with multiple ultrasonic distance sensors #213

enkith opened this issue Nov 11, 2024 · 0 comments

Comments

@enkith
Copy link

enkith commented Nov 11, 2024

I tried to use two ultrasonic distance sensors with Ottoblockly. This is obviously intended, as I can number my ultrasonic sensors.
Unfortunately, an error occured. The C-code reveals the problem. The code generated by the 'ultrasonic pins' block creates a function named 'ultrasound_distance_simple()'. This function is created with the same name by every 'ultrasonic pins' block. Hence the error code, that there are multiple declaration of the same function.
I'm adding screenshots.

I see two possible solutions to this:

  1. Add a number to the function name e.g. 'ultrasound_distance_simple_1()'
  2. More elegantly: don't hardcode the pin numbers in the 'ultrasound_distance_simple()' function. Instead, give the pins as an input to the function when using it. And obviously don't add the function again when it's already there.

ultrasonic_problem_2
ultrasonic_problem_1

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

No branches or pull requests

1 participant