Skip to content

Commit

Permalink
Add status led
Browse files Browse the repository at this point in the history
  • Loading branch information
Spartan2909 committed Sep 27, 2022
1 parent d596fa2 commit d976d18
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
radio.setGroup(0);
let active = false;
let statusLed = true;

input.onButtonPressed(Button.A, function() {
const setLed = () => {
if (active && statusLed) {
led.plot(0,0);
} else {
led.unplot(0,0);
}
}

input.onButtonPressed(Button.A, () => {
active = !active;
})
setLed();
if (active) {
basic.showString("On");
} else {
basic.showString("Off");
}
});

input.onButtonPressed(Button.B, () => {
statusLed = !statusLed;
led.plot(0, 0);
basic.pause(1000);
setLed();
});

loops.everyInterval(200, () => {
loops.everyInterval(snore.intervalSize, () => {
if (active) {
snore.recordVol();
snore.recordAccel();
snore.sendData();
}
});

loops.everyInterval(200, () => {if (active){snore.sendData}});
loops.everyInterval(snore.intervalSize, () => {if (active){snore.sendData()}});

0 comments on commit d976d18

Please sign in to comment.