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

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate soundcodes

For a schoolproject I'm programming a Compact Rio to control an algae cleaning boat that is autonomous.I want the labview on the compactRio to generate a sound when the battery is almoust empty, the box is full of algae, the boat collided with an object. To hear the difference, their has to be a different morse code for each of the cases, and it also can not be on for too long. 
Does anybody know how to do this?

 

Thanks!

0 Kudos
Message 1 of 9
(2,605 Views)

What part do you not know how to do?

 

Do you have a means of detecting the alarm conditions?

 

Do you know how to generate Morse Code ..- - ..

 

Do you know how to generate the sound? Does your Compact RIO system have a sound output?

 

Do you know how to make a subVI run for a specified time and then stop?

 

Do you know how to ask specific questions which will get you moer helpful answers?

 

Lynn

0 Kudos
Message 2 of 9
(2,586 Views)

I don't know how to generate a morse code, and also don't know how I run a subvi for a period of time on command...

0 Kudos
Message 3 of 9
(2,577 Views)

Use a lookup table for the Morse code.

 

Read the detailed help file for Elapsed Time.vi. Place the VI inside a loop with a short Wait and stop the loop after the Time has Elapsed? output becomes True.

 

I have not used cRIO, so I am not sure what might need to be changed for that.

 

Lynn 

 

 

0 Kudos
Message 4 of 9
(2,572 Views)

Thanks for the reply Lynn!
I now have this. It does the job. For a number of seconds that i set up, the sound goes on and off in the rhythm. But the Elapsedtime from the subvi only counts when every cycle of the flat sequence passed and not every second, in this case every 2.5 seconds.

Is there a way to get this result without flat sequence?

Knipsellabview.PNG

0 Kudos
Message 5 of 9
(2,525 Views)

That question doesn't make sense.

 

The loop will iterate when everything inside of it is complete, which is primarily the 2 second wait followed by the 1/2 second wait.

 

There is no way to get the loop to run at a 1 second rate when the code inside will take 2.5 seconds.

0 Kudos
Message 6 of 9
(2,519 Views)

And now i tested it in a while-loop, because it will be running in a big while loop, and it keeps running if the bool keeps being true.

My goal is that it stops after the amount of time, even if the bool stays on true, in a while loop. And that it can be started again when bool gets false and then true again.

0 Kudos
Message 7 of 9
(2,513 Views)

Then you need to turn off the boolean that drives the case structure so it doesn't run again when your big while loop iterates.

0 Kudos
Message 8 of 9
(2,508 Views)

This does the job!

Knipsellabview.PNG

0 Kudos
Message 9 of 9
(2,501 Views)