Content deleted Content added
m Adding {{WikiProject banner shell}} (Task 19) |
syntaxhighlight & fix lint |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
{{WikiProject banner shell|class=
{{WikiProject Computing |importance=Low}}
}}
==Removed text==
Line 37 ⟶ 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 53 ⟶ 55:
state = !state;
}
</syntaxhighlight>
<ref>https://www.arduino.cc/en/Reference/AttachInterrupt</ref>
|