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.
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.
05-03-2020 01:42 PM
Hi thanks for the suggestion! so does that mean need to use the state machines?
05-03-2020 02:06 PM
Yes, you have several states. The state machine can be very simple.
05-04-2020 02:47 AM
@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...
05-04-2020 11:03 AM
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. 😉
05-04-2020 11:30 AM
@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.