Content deleted Content added
Christian75 (talk | contribs) Assessment (Low): banner shell, +Computing (Rater) |
syntaxhighlight & fix lint |
||
Line 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">
int pin = 13;
volatile int state = LOW;
Line 55:
state = !state;
}
</syntaxhighlight>
<ref>https://www.arduino.cc/en/Reference/AttachInterrupt</ref>
|