Skip to content

Instantly share code, notes, and snippets.

@gfwilliams
Created January 29, 2021 08:59
Show Gist options
  • Save gfwilliams/561c21ef3c8cfe8add236d264c9fb677 to your computer and use it in GitHub Desktop.
Save gfwilliams/561c21ef3c8cfe8add236d264c9fb677 to your computer and use it in GitHub Desktop.
Bangle.js button test
function draw() {
c = c=>g.setColor(c?"#ff0000":-1);
c(BTN4.read());g.fillRect(0,0,100,239);
c(BTN5.read());g.fillRect(100,0,200,239);
c(BTN1.read());g.fillRect(200,0,239,79);
c(BTN2.read());g.fillRect(200,80,239,159);
c(BTN3.read());g.fillRect(200,160,239,239);
}
[BTN1,BTN2,BTN3,BTN4,BTN5].forEach(b=>setWatch(draw,b,{repeat:1,edge:0}));
draw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment