From 8b4a325e49ea45258c6b11e7893484098e395ac9 Mon Sep 17 00:00:00 2001 From: Blue Fox Date: Sun, 5 Jun 2022 09:52:06 +0200 Subject: [PATCH] Created a flashlight module --- flashlight.trailsense.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 flashlight.trailsense.js diff --git a/flashlight.trailsense.js b/flashlight.trailsense.js new file mode 100644 index 0000000..d750b64 --- /dev/null +++ b/flashlight.trailsense.js @@ -0,0 +1,23 @@ +(() => { + +function callbackFill(direction) { + if(direction == 1) { + g.setColor(255,255,255); + } else { + g.setColor(255,0,0); + } + g.fillRect(0, 0, g.getHeight(), g.getWidth()); +} + +function drawFace() { + g.setColor(255,255,255); + g.fillRect(0, 0, g.getHeight(), g.getWidth()); + Bangle.on("swipe", callbackFill); +} + +function stop() { + Bangle.removeListener("swipe", callbackFill); +} + +return { drawFace:drawFace, stop:stop }; +})();