From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

programming ultrasonic sensors

I have to make a code that should recognize shapes placed in front of a lego robot using two ultrasonic sensors placed vertically ;D. I think both sensors should send the signals at the same time and based on the time reception of the echos, it should be possible for the program to choose different cases. I hope my drawing helps somewhat ;D so the three object will have a different shape. Can anyone give me some clue how to start to write such code? I really have to do this, any advice, beg you.

and this.pngthis.png

0 Kudos
Message 1 of 4
(6,050 Views)

I would not use both sensors at the same time but start #2 when #1 is known.Otherwise you don't know which timing belongs to which sensor.

Do you have one sensor working?

 

greetings from the Netherlands
Message 2 of 4
(6,033 Views)
That seems like a better concept. I will try this this evening. So I should compare the output value from both sensors and each result give a different case. I'm sure problems will appear so I'll come here again. I have two sensors working but one is nxt and one ev3. I'll get another ev3. Thanks
0 Kudos
Message 3 of 4
(6,026 Views)

Hello, So I managed to write a code which recognizes two shapes, (and I need 3) , these two I can below:

pasteit.png

I did the comparison of the signals from two ultrasonic sensors, with two cases, by simple comparison block. Like this:

paste on forum.png

Can I create a third case for the flat shape. It would be when sensors detect echo from both sensors at the same time (more or less). Or maybe there is another way. For example when the echo doesnt return,( I could create something that absorbs ultrasound maybe) Can anyone help me?

 

0 Kudos
Message 4 of 4
(5,974 Views)