Skip to content

Commit

Permalink
Removed button controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Spartan2909 authored Nov 8, 2022
1 parent 7832bff commit fca985c
Showing 1 changed file with 7 additions and 36 deletions.
43 changes: 7 additions & 36 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
radio.setGroup(0);
let active = false;
let statusLed = true;
let time = 0;

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(snore.intervalSize / snore.bpMeasuresPerInterval, () => {
if (active) {
time += snore.intervalSize / snore.bpMeasuresPerInterval
snore.recordBP();
if (time == snore.intervalSize) {
snore.recordVol();
snore.recordAccel();
snore.sendData();
time = 0;
}
time += snore.intervalSize / snore.bpMeasuresPerInterval
snore.recordBP();
if (time == snore.intervalSize) {
snore.recordVol();
snore.recordAccel();
snore.sendData();
time = 0;
}
});

0 comments on commit fca985c

Please sign in to comment.