Hello Dany_bond!
First of all, I would recommender it to use a General VI.
On the start up, make the open connection, and on the Shut down make the close connection. Inside the loop, make a State machine. Like this example:
On the main state put an Event Structure with the actions of Potentiometers' number (0,1,2). In each event send the machine state to his unique state where you send (write in labview, read on Arduino) to Arduino the selector case. Then (maybe in this same case) Read (read in labview, write on Arduino) from Arduino and put the value on some indicator. Finally, return to the main state to again read the value.
Of course this solution only make tha reading of the values one by one. If you want to obtain all the values all the time, just make a while or for cicle to do the previous mentioned.
The state machine ends with a STOP button.
Now in your code you need to make the following:
- After opening the TCP communication, you need to send the case code to Arduino. Use the Write TCP function.
- Then, Arduino recive (read) your number of case and execute the if function and send to LabVIEW. You will recive with the Read TCP Function and execute your conversion code.
- Finally return to the principal state and wait the next action.
I hope this can solve your questions. If not answer here and we will try to help you.
Best regards!
PS. I attach some links that can assist you.
Tutorial of state machine.
http://www.ni.com/tutorial/7595/en/
Help for TCP
http://www.ni.com/white-paper/2710/en/