LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weather Problem

Solved!
Go to solution

The VI has three buttons for the user to check for the Coldest, Hottest and Rainy Day of the week. 

o For simplicity, output the following using an event structure:

o Monday for the Coldest Day

o Tuesday for the Hottest Day

o Wednesday for the Rainy Day

o The VI While Loop counter will only increment when one of the three buttons is pressed.

o After 10 seconds when no button is pressed, the output should default to the Hottest day of the week.

 

 

0 Kudos
Message 1 of 18
(5,031 Views)

Do you have a question? Does the VI work? If not, what are the symptoms?

 

Is this a class assignment? What have you tried?

 

Static pictures of front panels are boring. Show us the diagram! Attach the VI!

0 Kudos
Message 2 of 18
(5,024 Views)

Yes it is! See attached for my attempt!

0 Kudos
Message 3 of 18
(5,021 Views)

wrote:

The VI has three buttons for the user to check for the Coldest, Hottest and Rainy Day of the week. 

o For simplicity, output the following using an event structure:

You've got the event structure, good.

o Monday for the Coldest Day

You need an event for "cold" just like you made for "hot"

o Tuesday for the Hottest Day

You have an event for "hot", just wire up the output.

o Wednesday for the Rainy Day

See comments on coldest day above.

o The VI While Loop counter will only increment when one of the three buttons is pressed.

That's not true if the timeout is wired...

o After 10 seconds when no button is pressed, the output should default to the Hottest day of the week.

Wire the timeout value of 10 seconds (in milliseconds) to the timeout terminal (top left of event structure). The timeout runs automatically when no other events are triggered for the timeout value.

 

 


See my comments in red. It would probably be faster for me to write the program, but I am writing in text so you learn for yourself!

0 Kudos
Message 4 of 18
(5,010 Views)

Attached is the program.

I added the events for Hot, Cold, & Rainy

 

I don't know how to wire the output.

I am not sure what these comments mean:

o The VI While Loop counter will only increment when one of the three buttons is pressed.

That's not true if the timeout is wired...

o After 10 seconds when no button is pressed, the output should default to the Hottest day of the week.

Wire the timeout value of 10 seconds (in milliseconds) to the timeout terminal (top left of event structure). The timeout runs automatically when no other events are triggered for the timeout value.

0 Kudos
Message 5 of 18
(5,004 Views)

Each event can wire a different value to the string you have called "String". Just wire up to the output terminal (the pink terminal on right side of event structure).

 

The blue hourglass at the top left of the event structure is the timeout terminal.

0 Kudos
Message 6 of 18
(5,001 Views)
0 Kudos
Message 7 of 18
(4,984 Views)
  • All buttons should be latch action and of a reasonable type (not toggle switches and such).
  • Put the terminals inside their respective event cases
  • You can combine all event cases into one. A single event case for "all booleans + the timeout" is all you need. Add some logic to see which button got triggered and index into arrays of strings.
  • Your code does not display a day after timeout, just an empty string for the day, so fix that.
0 Kudos
Message 8 of 18
(4,976 Views)
Solution
Accepted by topic author Seacreature2002

Here is a simple example how it could be done with one single event case (no code hidden in other cases!). See if you understand the purpose of every single item on the diagram, a good beginner exercise :D. Yes, every item has a purpose!

 

Weather.png

Message 9 of 18
(4,942 Views)

Hi altenbach,

 

Why start with a timeout of zero?

0 Kudos
Message 10 of 18
(4,932 Views)