LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read temperature and control fan different delay using arduino

i have sensor lm 35, and connect to arduino uno for input  temperature, and read delay is 1000 ms ( 1 second)

then i if temperature greater than 28 degree celcius, fan will running until 50 % (127 of value, 100 % mean 255)

i want fan running in delay 100 ms every 1 increment until 127, so fan will running at 50% after ,127 x 100 ms = 12.7 second,

the problem is, if  i am use while loop, i must use 2 of them, but time delay make my vi error, and i want they displayed in 2 waveform chart, the temperature and fan power

0 Kudos
Message 1 of 3
(2,898 Views)
0 Kudos
Message 2 of 3
(2,893 Views)

Hi tuvss,

 

When you click the broken Run arrow it should display a list of errors, and if you select the error in that window and hit "Show Error" it will take you what is throwing edit-time errors. One that you will see is that the VI you sent has an indicator connected to an indicator. 

 

The second error is due to the fact that you don't have anything wired into the case selector (the question mark) of your case structure. In other words, you have an "if" statement with no conditional statement. You would need to wire in some sort of boolean so that the code can decide which case is running (or a control so you can choose with a buttom push).

 

As a side question, you send a double data type array wire from the right loop to the left loop. What is the purpose of that?

 

One thing to be aware of as well is that you cannot pass data between loops that are running in parallel with just a wire. This is because data is not passed out of a loop until it finishes. There are options to deal with this, the best of which is the Producer/Consumer architecture (http://www.ni.com/white-paper/3023/en/) which would allow both of your loops to run at the same time and pass buffered data between the loops so you don't lose any.

 

I hope this helps!

Rahul B.
0 Kudos
Message 3 of 3
(2,812 Views)