10-22-2022 07:27 AM
I need to control the temperature of two controlers (T1 and T2) of an Arduino. They must be controlled using an On-Off control and the user must insert the SetPoint for equipment 1 and equipment 2. I developed the following code on arduino:
The user inserts, on the Serial Monitor, setpoint 1 and setpoint 2. My problem is how to import both that data to labview. I tried controlling just T1 (and, so, the user should just insert setpoint 1) and used the following labview code:
10-22-2022 03:34 PM
You've got an Arduino that can read (on command) from two sensors and return values from each sensor. You need to look at these two values and make a Boolean decision for each of them.
Since I "know" LabVIEW, and "not so much" Arduino, I'd divide the Task into two parts:
So I'd structure my Arduino code (actually, I'd get an EE student to help me with this -- what do I know about an Arduino?) to start running and "listen" on a Serial Port for the letter "S" (for "Sample"). When the Arduino sees this, it reads its two Sensors, and without altering or otherwise processing the numbers, sends them out on the Serial Port and listens for another command that "does something" (maybe "H1 On", or "H2 Off", if you've got two Heaters to control).
The LabVIEW part almost writes itself. In my simple model, I need to start the Arduino first. LabVIEW sends (using VISA) an "S", waits for a String from the Arduino (however you decide to package the information from the Sensors, remembering that you can send the numeric data without needing to do arithmetic in the Arduino), LabVIEW converts the numeric data into, say, Temperature(s), compares it with "criteria", then sends a Command to do something (like turning on Heater 1 and turning off Heater 2). LabVIEW does this in a While Loop with a Wait (ms) clock to govern the speed, and a "Stop" button that sends the "Quit" command to Arduino, then exits LabVIEW.
Let LabVIEW do the "heavy lifting". Let the Arduino read its sensors, send/receive data using its Serial Line, and turn on/off its digital ports.
Bob Schor