11-28-2014 12:13 PM
Hello everyone! I'm working on an engineering project where I read in a sound input and if it's on high volume, a red led connected to a MyDaq box lights up, if it's on low, the green LED lights up, and both will be off if there's no sound input. I posted a screenshot of how my vi currently looks. The problem I'm having is, I want to set the range that will be considered as the low volume, and a range considered as the high volume on my case structures. I'm not sure exactly how to do that. I currently have an "In range" function there where I set the max and min values. THe problem with this is, it outputs a dynamic data that I cannot connect to the appended array. Any help would be great. Thanks!
11-28-2014 02:29 PM - edited 11-28-2014 02:29 PM
Hallo victoria,
welcome to the forum!
I currently have an "In range" function there where I set the max and min values.
No, you don't have. You have two comparison functions…
THe problem with this is, it outputs a dynamic data
Where do you have DDT?
I want to set the range that will be considered as the low volume, and a range considered as the high volume on my case structures.
Why do you multiply your sound signal with 1000 and compare later on with a value of 1000? Why not skip the multiplication and compare with 1?
Why do you have two case structures when the first comparison is ">1000" and the other one is "<1000"? Why not just one comparison with ">=1000" (which includes the value 1000 too)?
The way your VI looks right now gives way to suggest to take all those free online LabVIEW courses offered by NI on their website!
11-29-2014 12:34 AM - edited 11-29-2014 12:35 AM
Thanks for your response. I'm new to labview (which isn't really an excuse) and we just went through the real basic stuff for this course. That's why my code just looks like a mess. I'm just trying to use the case selector because I thought it'd be more efficient, since, if I think of it in written code, they're kind of like if-else statements, right? I thought I needed to multiply by a thousand because I am measuring the amplitude of sound input. Whenever I test it out, the numbers are really small. I just figured it'd be easier to multiply it by a thousand and set the range with bigger numbers. I'm also trying to get an LED to light up on a range of volume. That's why I need two comparisons. Like, if the volume is between the range of 2000 to 3000, the green LED lights up, and if it's between 1000 to 2000, then the red LED lights up. If the signal is equal to zero, then no light turns on. Anyway, I scrapped the whole idea of using case selectors because I don't have time to learn my way through it and finish on time. I attached a new version of my VI. It's a more simplified version. I don't know how to connect the LED boolean indicators into my array and into the DAQ Assistant (it's not on the vi yet but I do need one so the program knows to read the output into the LED's on my myDaq box. Sorry for the trouble! Thanks for any advice you can give.
12-01-2014 10:53 AM
Hi Victoria,
I believe what you are trying to do may be more difficult without case structures. If you take a look at the example that is posted at the link I've included, you can see how setting ranges in case structures allows you to take action on a floating point number.
Based on the input range, you can turn on a boolean LED indicator: Red for values between 1000-1999, Green for 2000-3000, and a third case for the 0/Default. The KB article above explains how you need to adjust the floating point numbers to get the integer values needed for the case structure.