Talk:Event-driven finite-state machine: Difference between revisions

Content deleted Content added
Criticized code sample and supplied an appropriate example
syntaxhighlight & fix lint
 
(4 intermediate revisions by 4 users not shown)
Line 1:
{{WikiProject banner shell|class=Start|1=
{{WikiProject Computing |importance=Low}}
}}
 
==Removed text==
I removed the following from the article, as it appears to be unencyclopeadic, and/or confusing or strange:
Line 35 ⟶ 39:
==Code is not event-driven==
The code shown is not event-driven. Event-driven involves two things: the client 1) registers its interest in certain or all events and 2) implements a method or handler where information about events is received. The Arduino IDE reference has quite a good example of this: the client declares its interest in events received via pin 13 and supplies the method blink() which should be called each time an event occurs. Note that the loop() function does nothing but log the current state.
<syntaxhighlight lang="text">
<code>
int pin = 13;
volatile int state = LOW;
Line 51 ⟶ 55:
state = !state;
}
</syntaxhighlight>
</code>
<ref>https://www.arduino.cc/en/Reference/AttachInterrupt</ref>
 
{{reflist-talk}}