Shorten VAR Byte Statements?
Humanoido
Posts: 5,770
VAR
...
byte state30
byte state31
byte state32
byte state33
byte state34
byte state35
byte state36
byte state37
byte state38
byte state39
...
The program has a lot of these statements.
Is there any way to shorten it, to one statement?
Thanks in advance.
Humanoido
...
byte state30
byte state31
byte state32
byte state33
byte state34
byte state35
byte state36
byte state37
byte state38
byte state39
...
The program has a lot of these statements.
Is there any way to shorten it, to one statement?
Thanks in advance.
Humanoido
Comments
But, based on how you've named your variables, I suspect an array would be a better solution.
-Phil
-Phil
con
#0 {start at zero}
st_idle {cons with no val increment by 1}
st_wakeup
st_lookaround
st_verify_id
st_approach
st_bite
I can't really imagine what you would be doing with separate state vars enumerated like that. The whole point of a state machine is to have as few state vars as possible so you can avoid pathological or unanticipated combination states.