Processing-like framework for Pebble Smartwatch. Let's sketch a watchface with code!
int cl = WHITE;
void setup() {
noLoop();
}
void draw() {
fill(cl);
rect(25, 25, 50, 50);
}
void keyPressed() {
if (cl == WHITE) {
cl = BLACK;
} else {
cl = WHITE;
}
redraw();
}
void keyReleased() {
}
The keyPressed() function is called when a key is pressed. The key that was pressed is stored in the keyCode variable. If you use this function, you have to define "ENABLE_KEY_EVENT" at settings.h and declare also keyReleased() at sketch.c.
keyPressed()
void
keyCode
keyReleased()