Skip to content

Instantly share code, notes, and snippets.

@notahat
Created May 24, 2009 09:51
Show Gist options
  • Save notahat/117044 to your computer and use it in GitHub Desktop.
Save notahat/117044 to your computer and use it in GitHub Desktop.
#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