Skip to content

Commit 6b269a5

Browse files
authored
Added onEnable() and onDisable() routines
1 parent e244493 commit 6b269a5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

examples/Ex_02_MultiBlink/Ex_02_MultiBlink.ino

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public:
2525
}
2626

2727
protected:
28+
//setup the pins
2829
virtual void setup()
2930
{
3031
pinMode(_pin, OUTPUT);
@@ -38,6 +39,20 @@ protected:
3839
pinMode(_pin, INPUT);
3940
_pinState = LOW;
4041
}
42+
43+
//LEDs should be off when disabled
44+
virtual void onDisable()
45+
{
46+
_pinState = LOW;
47+
digitalWrite(_pin, _pinState);
48+
}
49+
50+
//Start the LEDs on
51+
virtual void onEnable()
52+
{
53+
_pinState = HIGH;
54+
digitalWrite(_pin, _pinState);
55+
}
4156

4257
// Create our service routine
4358
virtual void service()

0 commit comments

Comments
 (0)