Skip to content

Error with multiple ultrasonic distance sensors #213

@enkith

Description

@enkith

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions