From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi need explanation of this question

Solved!
Go to solution

Hi thanks for the suggestion! so does that mean need to use the state machines?

0 Kudos
Message 11 of 15
(573 Views)

Yes, you have several states. The state machine can be very simple.

0 Kudos
Message 12 of 15
(567 Views)

@gavinng wrote:

Hi thanks for the suggestion! so does that mean need to use the state machines?


You never need a state machine.

 

You could use a state machine to get the behavior you want.

 

There are (many, many) alternatives. I prefer a state pattern, but that's OO (and therefor very difficult 😉). For a small thing like this, I probably put everything in a class that keeps it's own state...

0 Kudos
Message 13 of 15
(544 Views)

wiebe@CARYA wrote:

@gavinng wrote:

Hi thanks for the suggestion! so does that mean need to use the state machines?


You never need a state machine.

 


I agree, but it depends a little bit how broad the term is defined. (Something that retains a start tick across iterations and can be in several states (LED Skipped? Button pressed? 200ms elapsed? 1000ms elapsed? ) could already be called a (very primitive) state machine. 😉

0 Kudos
Message 14 of 15
(526 Views)
Solution
Accepted by gavinng

@altenbach wrote:

wiebe@CARYA wrote:

@gavinng wrote:

Hi thanks for the suggestion! so does that mean need to use the state machines?


You never need a state machine.

 


I agree, but it depends a little bit how broad the term is defined. (Something that retains a start tick across iterations and can be in several states (LED Skipped? Button pressed? 200ms elapsed? 1000ms elapsed? ) could already be called a (very primitive) state machine. 😉


Agreed.

 

Just trying to convey that a state machine is an option. Any solution should be a means to an end. Not something you feel like you need to (or, worse, are told to) use.

Message 15 of 15
(519 Views)