Last active
May 19, 2017 16:17
-
-
Save cyberparra/566320439e17c82eed3610653dff85a8 to your computer and use it in GitHub Desktop.
Timer15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let posY = 0 | |
let posX = 0 | |
let expiretime = 0 | |
let TimerValue = 0 | |
let setTimer = 0 | |
input.onButtonPressed(Button.A, () => { | |
setTimer = 0 | |
TimerValue = 0 | |
expiretime = 0 | |
posX = 0 | |
posY = 0 | |
setTimer += 1 | |
if (setTimer == 5) { | |
setTimer = 0 | |
basic.showLeds(` | |
. . # . . | |
. . # . . | |
# # # # # | |
. . # . . | |
. . # . . | |
`) | |
} | |
if (setTimer == 1) { | |
basic.showLeds(` | |
. . # # # | |
. . # # # | |
# # # # # | |
. . # . . | |
. . # . . | |
`) | |
} else if (setTimer == 2) { | |
basic.showLeds(` | |
. . # # # | |
. . # # # | |
# # # # # | |
. . # # # | |
. . # # # | |
`) | |
} else if (setTimer == 3) { | |
basic.showLeds(` | |
. . # # # | |
. . # # # | |
# # # # # | |
# # # # # | |
# # # # # | |
`) | |
} else if (setTimer == 4) { | |
basic.showLeds(` | |
# # # # # | |
# # # # # | |
# # # # # | |
# # # # # | |
# # # # # | |
`) | |
} | |
TimerValue = setTimer * 15 | |
expiretime = TimerValue * 60 / 25 | |
}) | |
input.onButtonPressed(Button.B, () => { | |
basic.showLeds(` | |
# # # # # | |
# # # # # | |
# # # # # | |
# # # # # | |
# # # # # | |
`) | |
for (let i = 0; i < 5; i++) { | |
for (let i = 0; i < 5; i++) { | |
basic.pause(expiretime * 1000) | |
led.unplot(posX, posY) | |
posX += 1 | |
} | |
posX = 0 | |
posY += 1 | |
} | |
basic.showIcon(IconNames.No) | |
for (let i = 0; i < 10; i++) { | |
led.enable(false) | |
basic.pause(100) | |
led.enable(true) | |
basic.pause(100) | |
} | |
}) | |
input.onButtonPressed(Button.AB, () => { | |
basic.clearScreen() | |
basic.showNumber(expiretime) | |
}) | |
led.setBrightness(255) | |
setTimer = 0 | |
TimerValue = 0 | |
expiretime = 0 | |
posX = 0 | |
posY = 0 | |
basic.showLeds(` | |
. . # . . | |
. . # . . | |
# # # # # | |
. . # . . | |
. . # . . | |
`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Timer15 is a countdown that has four possible timer sets:
15, 30, 45, or 60 minutes
After booting, a cross on display appears, and you can set your timer pressing the A button. Each time you press A button, the timer increases by 15 minutes till reaching 60 minutes
timer set at 15min

timer set at 30min

timer set at 45min

timer set at 60min

To start the timer press button B. At the beginning all 25 the leds are turned on, and after a specific amount of time depending on the timer setting, a led goes off
When the timer expires an X appears on the screen (blinking at the beginning then fixed)