Created
May 24, 2009 09:51
-
-
Save notahat/117044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <AikoEvents.h> | |
using namespace Aiko; | |
class BlinkHandler : public Handler { | |
BlinkHandler(int pin) { | |
pin_ = pin; status_ = LOW; | |
} | |
void init() { | |
pinMode(pin_, OUTPUT); | |
} | |
void handler() { | |
digitalWrite(pin_, status_); | |
status_ = !status_; | |
} | |
private: | |
int pin_; | |
boolean status_; | |
}; | |
BlinkHandler pin1(13); | |
BlinkHandler pin2(12); | |
void setup() { | |
Events.addHandler(pin1, 1000); | |
Events.addHandler(pin2, 600); | |
} | |
void loop() { | |
Events.loop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment