LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting with a button

Hello,
 
I'm new to labview and i stuck with my program!
 
I want to control a for loop with a button. so i want every time i press the button the loop count is increased by 1.
 
Thnx
0 Kudos
Message 1 of 21
(4,418 Views)

Hello Robin,

do you really need a for-loop? I have here a VI with the same function.

Regards ThomasD

 

0 Kudos
Message 2 of 21
(4,403 Views)

Well... it's seems the best solution, but i have no experience with labview ( just one week), so probably there is a much better solution to this problem.

I want the user to input some data. When the user presses the save button the data is stored in an array(4 columns with 4 data entries). The user can input some more data and when he presses the save button again, the data is stored on the second row of the array.

The whole purpose of this is: I want to make a thermostate to control the temperature in a room. The user can give in start time, end time, temperature and day of the week. The user can set the thermostate to control the temperature by day and time.

My idea about this is: Save the data in an array and compare this to the system time/date. Based on that he must put the heating on or off... please help, i still can't get it working.

Sorry for my english.. i try to make the best of it 😉

0 Kudos
Message 3 of 21
(4,395 Views)
A couple of things:
1) I would suggest sending the data in a cluster instead of an array (actually, it is best for an array of clusters).  It is more straight forward to read sets of data (single element of array then unbundle).
2) Why limit the number of time steps?  If I want the temperature to change every hour, why not allow such a thing?
3) Thermostats are usually continuous (i.e. the stop time from the first step is the start time of the second step, etc.)

The two vis attached are two suggestions as to how to start your program.

Message Edited by Robert.Bedford on 09-22-2005 07:59 AM

Download All
Message 4 of 21
(4,386 Views)

Thnx for the help! I really appreciate it 

The first example is very nice. But the program stops after 4 entries.

The second example looks better, altough i cant get it working. It just doesnt do anything at all. Can someone please fix this for me ? Thnx!

 

0 Kudos
Message 5 of 21
(4,371 Views)
I never really tried to see if it worked.  The attached works, and I have a counter to help you know that the thing is going.  The results are not delivered to the output array until the "stop" button is hit.

Furthermore, I try to guess the next values for start time and day.
Message 6 of 21
(4,363 Views)
Thank you very much!! I'll see if i can work it out now!
0 Kudos
Message 7 of 21
(4,360 Views)
I think it works pretty good now, but i'm stuck again. I want to compare current time/day with the time/days that are saved in the array. I tried something with a for loop. I have attached the file i'm working with. Someone has an solution for this ?
0 Kudos
Message 8 of 21
(4,346 Views)
The reason the second "for" loop isn't working is that you are feeding the output array to it before it has been populated.  This is an easy fix (wire the output of the population loop that I made to the input of the for loop that you made).
It is somewhat more difficult to convert the relative time (time relative to the 12:00 midnight) to an absolute time (relative to 12 midnight, Jan 1 1904).  I did this in the attached file.

Message 9 of 21
(4,325 Views)
Thank you very very much!! I really appreciate your help!
 
Can you explain how the code in the last flat sequence works? I understand that you substract the system time from the time set in the array. How does it exactly work ?
 
I will try to finish the code now! thank you very much 
0 Kudos
Message 10 of 21
(4,316 Views)