Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
ezeio2:scriptref:start [2019-09-02 21:27] – S andreh | ezeio2:scriptref:start [2019-11-19 01:51] – andreh | ||
---|---|---|---|
Line 45: | Line 45: | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | ||
| '' | | '' | ||
| '' | | '' | ||
Line 65: | Line 64: | ||
=== State machines === | === State machines === | ||
- | A common programming pattern in control applications is to use state machines. PAWN and the ezeio implements strong support for state machines. The following is a typical pattern: | + | A common programming pattern in control applications is to use state machines. PAWN and the ezeio implements strong support for state machines. The following is a typical pattern |
- | < | + | < |
new count = 0; | new count = 0; | ||
Line 73: | Line 72: | ||
main() | main() | ||
{ | { | ||
- | SetTickInterval(500); // set tick interval to 500ms (0.5s) | + | SetTickInterval(100); // set tick interval to 100ms (0.1s) |
state WAITING; | state WAITING; | ||
} | } | ||
Line 96: | Line 95: | ||
state RUNNING; | state RUNNING; | ||
- | | + | |
- | state WAITING; | + | state WAITING; |
} | } | ||
| | ||
Line 109: | Line 108: | ||
@Tick(uptime) < | @Tick(uptime) < | ||
{ | { | ||
- | if( GetField(2) < 100 ) | + | if( GetField(2) < 100 ) // Check if the engine stopped |
- | state WAITING; | + | state WAITING; |
} | } | ||
| | ||
</ | </ | ||