02-03-2017 07:26 PM
Hello there! How would one make LED lights turn on only one at a time? As of right now, I have three LEDs - G, B, Y - and I can have either 1, 2, or 3 of them be turned on at the same time. However, I wanted to make it so that if G is on, and I click to turn on B, then G turns off. If B is on and I click turn on Y, then B turns off. Only one light would be turned on at a time. If only Labview had a switch or slider that can turn on one pin at a time, that would be perfect.
So far, I have looked around and I think I'm seeing two ways I can go about this, 1) to use arrays/case structures (and keep the three-button interface) or 2) make a three-way switch and integrate this switch into my current VI (attached). I'm a beginner and haven't seen examples where case structures are used with Arduino in this way, so any help or advice on how to go about this would be great! Thank you.
02-06-2017 09:52 AM
We can do this with an enum and a case statement as well which is pretty simple to setup. I have included an example of this below, please let me know if this is what you were envisioning.
02-10-2017 01:50 AM
Thank you so much for your reply!
Yes, that is what I'm looking for, but preferably with the user clicking on the round buttons instead of a drop-down box, though I think that would be an easy edit. Where I'm stuck at now is how I can incorporate Arduino commands with this...would the digital write pins be inside the case structure or outside of it?
02-10-2017 02:55 PM
Here is an example using buttons (you must click off of the previous button before you can turn on the next LED). You can implement this with an Arduino by including the digital lines inside of the while loop and connect the digital lines in place of the buttons. Inside of the while loop will allow you to constantly monitor those digital lines.