11-29-2017 10:59 AM
I have sixteen switches.
I need to read the status of the switches and form a string as per this format :
<S0,S1,S3........S15,> and pass it via a Serial link to a microcontroller which will strip the switch status from the string and do something with it.
I created a small sample with four switches and managed to do what I want.( looks like a college project !) Of course I should have used a FOR loop but never could do it - it has a Concatenation tunnel option but never understood how it works.
Any better method ?
Solved! Go to Solution.
11-29-2017 11:16 AM
Maybe this will give you some ideas:
11-29-2017 11:36 AM - edited 11-29-2017 11:39 AM
Comments:
I was going to attach a Snippet and show you how to do this, but you'll learn far better if I tell you how to do it, and then you do it.
That does it! Very compact, very simple, easy to generalize (for other types of inputs), etc.
Bob Schor
P.S. -- I also like GregoryJ's solution. I tend to stay away from the LabVIEW "Spreadsheet" functions, however ...
11-29-2017 11:37 AM
@MogaRaghu wrote:
I have sixteen switches.
I need to read the status of the switches and form a string as per this format :
<S0,S1,S3........S15,> and pass it via a Serial link to a microcontroller which will strip the switch status from the string and do something with it.
I created a small sample with four switches and managed to do what I want.( looks like a college project !) Of course I should have used a FOR loop but never could do it - it has a Concatenation tunnel option but never understood how it works.
Any better method ?
gregoryj beat me to it. However, from your format descriptor, it looks like you need a trailing comma after the last status. This would be the format string to add that last comma
11-29-2017 07:14 PM
Thanks to all three who responded.
I liked Bob's concept .. it does it quite nicely. Attaching the assignment !! Never really had a an opportunity to use the Boolean-1/0 function. Cute .