From 1f7e0b0f79d6b6a7677c3184c4e877446ac2adf9 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 29 Mar 2016 21:14:27 -0700 Subject: [PATCH 1/4] smoothly transition back to non-tilted --- sim/simsvg.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sim/simsvg.ts b/sim/simsvg.ts index 63b56ff1..03314b88 100644 --- a/sim/simsvg.ts +++ b/sim/simsvg.ts @@ -683,9 +683,15 @@ svg.sim.grayscale { case 'radiopacket': this.flashAntenna(); break; } } + let tiltDecayer = 0; this.element.addEventListener("mousemove", (ev: MouseEvent) => { let state = this.board; if (!state.accelerometer.isActive) return; + + if (tiltDecayer) { + clearInterval(tiltDecayer); + tiltDecayer = 0; + } let ax = (ev.clientX - this.element.clientWidth / 2) / (this.element.clientWidth / 3); let ay = (ev.clientY - this.element.clientHeight / 2) / (this.element.clientHeight / 3); @@ -695,6 +701,7 @@ svg.sim.grayscale { let z2 = 1023*1023 - x * x - y * y; let z = Math.floor((z2 > 0 ? -1 : 1)* Math.sqrt(Math.abs(z2))); + console.log(`move: ${ax} ${y} ${z}`) state.accelerometer.update(x,y,z); this.updateTilt(); }, false); @@ -702,8 +709,25 @@ svg.sim.grayscale { let state = this.board; if (!state.accelerometer.isActive) return; - state.accelerometer.update(0,0,-1023); - this.updateTilt(); + if (!tiltDecayer) { + tiltDecayer = setInterval(() => { + let accx = state.accelerometer.getX(MicroBitCoordinateSystem.RAW); + accx = Math.floor(Math.abs(accx) * 0.85) * (accx > 0 ? 1 : -1); + let accy = state.accelerometer.getY(MicroBitCoordinateSystem.RAW); + accy = Math.floor(Math.abs(accy) * 0.85) * (accy > 0 ? 1 : -1); + let accz = -Math.sqrt(Math.max(0, 1023*1023 - accx*accx - accy*accy)); + if (Math.abs(accx) <= 24 && Math.abs(accy) <= 24) { + clearInterval(tiltDecayer); + tiltDecayer = 0; + accx = 0; + accy = 0; + accz = -1023; + } + console.log(`leave: ${accx} ${accy} ${accz}`) + state.accelerometer.update(accx, accy, accz); + this.updateTilt(); + }, 50) + } }, false); this.pins.forEach((pin, index) => { From 850c313c5dd0a4befd2027f331e25d35e6224260 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 29 Mar 2016 21:17:57 -0700 Subject: [PATCH 2/4] batch replace onButtonPressed(Button... --- docs/device/reactive.md | 8 +++---- docs/lessons/counter/quiz-answers.md | 4 ++-- docs/lessons/counter/quiz.md | 4 ++-- docs/lessons/guess-the-number/quiz-answers.md | 2 +- docs/reference/basic/forever.md | 2 +- docs/reference/blocks-vs-js.md | 4 ++-- docs/reference/control/in-background.md | 6 ++--- docs/reference/game/change-score-by.md | 2 +- docs/reference/game/clear.md | 2 +- docs/reference/game/game-library.md | 2 +- docs/reference/game/score.md | 2 +- docs/reference/game/start-countdown.md | 2 +- docs/reference/js/collections.md | 4 ++-- docs/reference/js/event-handler.md | 10 ++++----- docs/reference/js/game-library.md | 2 +- .../js/game-library/add-point-to-score.md | 2 +- .../js/game-library/change-score-by.md | 2 +- docs/reference/js/game-library/score.md | 2 +- .../js/game-library/start-countdown.md | 2 +- .../js/lessons/2-player-pong/quiz-answers.md | 2 +- .../js/lessons/boolean-fun/challenges.md | 10 ++++----- .../reference/js/lessons/bop-it/challenges.md | 8 +++---- .../js/lessons/bop-it/quiz-answers.md | 2 +- docs/reference/js/lessons/break/challenges.md | 8 +++---- .../reference/js/lessons/button/challenges.md | 12 +++++----- .../js/lessons/clear-screen/challenges.md | 10 ++++----- .../js/lessons/compare-machine/challenges.md | 8 +++---- docs/reference/js/lessons/counter/activity.md | 4 ++-- .../js/lessons/counter/challenges.md | 6 ++--- .../js/lessons/guess-the-number/activity.md | 6 ++--- .../js/lessons/guess-the-number/challenges.md | 6 ++--- .../js/lessons/jailbreak/challenges.md | 8 +++---- .../js/lessons/jailbreak/quiz-answers.md | 2 +- .../js/lessons/line-of-fire/quiz-answers.md | 2 +- .../js/lessons/love-meter/activity.md | 6 ++--- .../js/lessons/love-meter/challenges.md | 8 +++---- .../js/lessons/love-meter/quiz-answers.md | 2 +- .../js/lessons/night-light/activity.md | 2 +- .../js/lessons/night-light/challenges.md | 6 ++--- .../js/lessons/number-psych/quiz-answers.md | 4 ++-- .../js/lessons/offset-image/challenges.md | 10 ++++----- .../js/lessons/offset-image/quiz-answers.md | 2 +- docs/reference/js/lessons/pong/activity.md | 4 ++-- .../reference/js/lessons/pong/quiz-answers.md | 4 ++-- .../reference/js/lessons/return/challenges.md | 6 ++--- .../challenges.md | 22 +++++++++---------- .../challenges.md | 22 +++++++++---------- .../lessons/rock-paper-scissors/challenges.md | 4 ++-- .../lessons/rotating-animation/challenges.md | 4 ++-- .../lessons/rotation-animation/challenges.md | 4 ++-- .../js/lessons/runaway-pacman/quiz-answers.md | 4 ++-- .../js/lessons/screen-wipe/activity.md | 2 +- .../js/lessons/screen-wipe/challenges.md | 10 ++++----- .../js/lessons/set-brightness/challenges.md | 12 +++++----- .../reference/js/lessons/smiley/challenges.md | 4 ++-- .../js/lessons/speed-button/challenges.md | 10 ++++----- .../js/lessons/speed-button/quiz-answers.md | 4 ++-- .../reference/js/lessons/speed-button/quiz.md | 4 ++-- .../js/lessons/the-hat-game/challenges.md | 4 ++-- .../js/lessons/the-hat-game/quiz-answers.md | 2 +- .../js/lessons/transformers/challenges.md | 6 ++--- .../js/lessons/transformers/quiz-answers.md | 2 +- .../js/lessons/truth-or-dare/activity.md | 8 +++---- .../js/lessons/truth-or-dare/challenges.md | 6 ++--- .../js/lessons/typing-game/challenges.md | 12 +++++----- .../reference/js/lessons/yes-no/challenges.md | 6 ++--- docs/reference/js/reactive.md | 8 +++---- docs/reference/js/serial-library.md | 2 +- 68 files changed, 187 insertions(+), 187 deletions(-) diff --git a/docs/device/reactive.md b/docs/device/reactive.md index 7b28fd30..e6280bca 100644 --- a/docs/device/reactive.md +++ b/docs/device/reactive.md @@ -52,7 +52,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u ``` export function countButtonPresses() { - input.onButtonPressed("A", () => { + input.onButtonPressed(Button.A, () => { count = count + 1 }) basic.forever(() => { @@ -65,7 +65,7 @@ export function countButtonPresses() { The program above contains three statements that execute in order from top to bottom. The first statement ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count = count + 1 }) ``` @@ -132,14 +132,14 @@ As a result, you can easily add a new capability to the micro:bit by just adding ``` export function countButtonPressesWithReset() { - input.onButtonPressed("A", () => { + input.onButtonPressed(Button.A, () => { count = count + 1 }) basic.forever(() => { basic.showNumber(count, 150) }) count = 0 - input.onButtonPressed("B", () => { + input.onButtonPressed(Button.B, () => { count = 0 }) } diff --git a/docs/lessons/counter/quiz-answers.md b/docs/lessons/counter/quiz-answers.md index 0d56e96c..9ba015dc 100644 --- a/docs/lessons/counter/quiz-answers.md +++ b/docs/lessons/counter/quiz-answers.md @@ -24,7 +24,7 @@ We create a **variable**, `count` to keep track of the current count. The number ``` let count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count, 150) }) @@ -40,7 +40,7 @@ We are only pressing on button pressed once. So the number to display on the mic ``` count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) diff --git a/docs/lessons/counter/quiz.md b/docs/lessons/counter/quiz.md index eb7dfdf6..7d350225 100644 --- a/docs/lessons/counter/quiz.md +++ b/docs/lessons/counter/quiz.md @@ -28,7 +28,7 @@ let count = 0 ``` let count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) @@ -42,7 +42,7 @@ input.onButtonPressed("A", () => { ``` count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) diff --git a/docs/lessons/guess-the-number/quiz-answers.md b/docs/lessons/guess-the-number/quiz-answers.md index 9521567d..a4390964 100644 --- a/docs/lessons/guess-the-number/quiz-answers.md +++ b/docs/lessons/guess-the-number/quiz-answers.md @@ -13,7 +13,7 @@ Answers may vary. Generally, on button pressed run code when an input button is Write the line of code that creates a condition when the BBC micro:bit button A is pressed. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` diff --git a/docs/reference/basic/forever.md b/docs/reference/basic/forever.md index e1a5f063..e892587c 100644 --- a/docs/reference/basic/forever.md +++ b/docs/reference/basic/forever.md @@ -37,7 +37,7 @@ let num = 0 basic.forever(() => { basic.showNumber(num, 150) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { num = num + 1 }) ``` diff --git a/docs/reference/blocks-vs-js.md b/docs/reference/blocks-vs-js.md index e119abff..b7dfacfd 100644 --- a/docs/reference/blocks-vs-js.md +++ b/docs/reference/blocks-vs-js.md @@ -101,13 +101,13 @@ for (let i3 = 0; i3 < 5; i3++) { Local scope allows you to use the same variable name in different parts of a program without concern about interference (as with variables with global scope). Here's the Touch Develop program that implements the "X" program without interference: ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { for (let i4 = 0; i4 < 5; i4++) { led.plot(i4, i4) basic.pause(1000) } }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { for (let i5 = 0; i5 < 5; i5++) { led.plot(4 - i5, i5) basic.pause(1000) diff --git a/docs/reference/control/in-background.md b/docs/reference/control/in-background.md index b8077647..efc09322 100644 --- a/docs/reference/control/in-background.md +++ b/docs/reference/control/in-background.md @@ -19,7 +19,7 @@ control.inBackground(() => { basic.pause(100) } }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { num++; }) ``` @@ -31,7 +31,7 @@ let num = 0 basic.forever(() => { basic.showNumber(num, 150) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { num++; }) ``` @@ -44,7 +44,7 @@ If you have multiple processes that each show something on the LED screen, you m basic.forever(() => { basic.showNumber(6789, 150) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showNumber(2, 150) }) ``` diff --git a/docs/reference/game/change-score-by.md b/docs/reference/game/change-score-by.md index fd033133..7588ce54 100644 --- a/docs/reference/game/change-score-by.md +++ b/docs/reference/game/change-score-by.md @@ -15,7 +15,7 @@ The code below shows a simple game where the user gets to press the button ``A`` The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/game/clear.md b/docs/reference/game/clear.md index 74179c5c..8d31e541 100644 --- a/docs/reference/game/clear.md +++ b/docs/reference/game/clear.md @@ -27,7 +27,7 @@ let img = images.createImage(` . . . . . `) img.showImage(0) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { img.clear() img.showImage(0) }) diff --git a/docs/reference/game/game-library.md b/docs/reference/game/game-library.md index 9b4684d9..b8457b36 100644 --- a/docs/reference/game/game-library.md +++ b/docs/reference/game/game-library.md @@ -13,7 +13,7 @@ The game library supports simple single-player time-based games. The player has The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/game/score.md b/docs/reference/game/score.md index 24f05c69..368dd4e4 100644 --- a/docs/reference/game/score.md +++ b/docs/reference/game/score.md @@ -15,7 +15,7 @@ The code below shows a simple game where the user gets to press the button ``A`` The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/game/start-countdown.md b/docs/reference/game/start-countdown.md index 8c0122af..86405db4 100644 --- a/docs/reference/game/start-countdown.md +++ b/docs/reference/game/start-countdown.md @@ -13,7 +13,7 @@ The game library supports simple single-player time-based games. The general goa The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/collections.md b/docs/reference/js/collections.md index 4bde7f8a..a71ed987 100644 --- a/docs/reference/js/collections.md +++ b/docs/reference/js/collections.md @@ -98,10 +98,10 @@ This program will record the current acceleration measured on `x` when you press ``` let accelerations = ([]) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { accelerations.push(input.acceleration("x")) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { for (let i1 = 0; i1 < accelerations.length; i1++) { basic.showString(accelerations[i1].toString(), 150) } diff --git a/docs/reference/js/event-handler.md b/docs/reference/js/event-handler.md index a11a1001..5c6f6efd 100644 --- a/docs/reference/js/event-handler.md +++ b/docs/reference/js/event-handler.md @@ -9,7 +9,7 @@ An event handler is code that is associated with a particular event, such as "bu Functions named "on " create an association between an event and the event handler code. For example, the following code registers the event handler (the code between the `do` and `end` keywords) with the event of a press of button A: ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) }) ``` @@ -21,7 +21,7 @@ After this code executes, then whenever button A is pressed in the future, the s Once you have registered an event handler for an event, like above, that event handler is active for the rest of the program execution. If you want to stop the string "hello" from printing each time button A is pressed then you need to arrange for the following code to execute: ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` @@ -32,10 +32,10 @@ The above code associated an event handler that does nothing with the event of a The above example also illustrates that there is only one event handler for each event. What is the result of the following code? ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("goodbye", 150) }) ``` @@ -43,7 +43,7 @@ input.onButtonPressed("A", () => { The answer is that whenever button A is pressed, the string "goodbye" will be printed. If you want both the strings "hello" and "goodbye" to be printed, you need to write the code like this: ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) basic.showString("goodbye", 150) }) diff --git a/docs/reference/js/game-library.md b/docs/reference/js/game-library.md index 951b591b..0864c55e 100644 --- a/docs/reference/js/game-library.md +++ b/docs/reference/js/game-library.md @@ -9,7 +9,7 @@ The game library supports simple single-player time-based games. The player has The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/game-library/add-point-to-score.md b/docs/reference/js/game-library/add-point-to-score.md index 2a526a94..ed88ff39 100644 --- a/docs/reference/js/game-library/add-point-to-score.md +++ b/docs/reference/js/game-library/add-point-to-score.md @@ -15,7 +15,7 @@ The code below shows a simple game where the user gets to press the button ``A`` The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/game-library/change-score-by.md b/docs/reference/js/game-library/change-score-by.md index 9c2e7ddb..a8c2166b 100644 --- a/docs/reference/js/game-library/change-score-by.md +++ b/docs/reference/js/game-library/change-score-by.md @@ -15,7 +15,7 @@ The code below shows a simple game where the user gets to press the button ``A`` The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/game-library/score.md b/docs/reference/js/game-library/score.md index 4548c063..ee6f7b33 100644 --- a/docs/reference/js/game-library/score.md +++ b/docs/reference/js/game-library/score.md @@ -15,7 +15,7 @@ The code below shows a simple game where the user gets to press the button ``A`` The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/game-library/start-countdown.md b/docs/reference/js/game-library/start-countdown.md index 5ccaa3ed..03173700 100644 --- a/docs/reference/js/game-library/start-countdown.md +++ b/docs/reference/js/game-library/start-countdown.md @@ -13,7 +13,7 @@ The game library supports simple single-player time-based games. The general goa The code below shows a simple game where the user gets to press the button ``A`` as much times as possible in 10 seconds. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) }) game.startCountdown(10000) diff --git a/docs/reference/js/lessons/2-player-pong/quiz-answers.md b/docs/reference/js/lessons/2-player-pong/quiz-answers.md index e704fefa..7c9c83f4 100644 --- a/docs/reference/js/lessons/2-player-pong/quiz-answers.md +++ b/docs/reference/js/lessons/2-player-pong/quiz-answers.md @@ -32,7 +32,7 @@ claimBall = true
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (claimBall) { pins.digitalWritePin("P0", 1) } diff --git a/docs/reference/js/lessons/boolean-fun/challenges.md b/docs/reference/js/lessons/boolean-fun/challenges.md index 8e9668f3..6767689c 100644 --- a/docs/reference/js/lessons/boolean-fun/challenges.md +++ b/docs/reference/js/lessons/boolean-fun/challenges.md @@ -9,7 +9,7 @@ Welcome! This [guided tutorial](https://live.microbit.co.uk/td/lessons/speed-but ``` counter = 0 fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 }) ``` @@ -21,7 +21,7 @@ We need to know when the user has hit button `A` 15 times. The user wins when he ``` counter = 0 fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 15 && input.runningTime() < 3500) { } @@ -33,7 +33,7 @@ Next, if the user has won, let's set our boolean to true. This indicates that he ``` counter = 0 fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 15 && input.runningTime() < 3500) { fastPress = true // *** @@ -48,7 +48,7 @@ We want to set `fastPress` to false if the user was too slow. To do so, we need ``` counter = 0 fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 15 && input.runningTime() < 3500) { fastPress = true @@ -66,7 +66,7 @@ Now let's display if the user won or lost. To do so, we need to check the status ``` counter = 0 fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 15 && input.runningTime() < 3500) { fastPress = true diff --git a/docs/reference/js/lessons/bop-it/challenges.md b/docs/reference/js/lessons/bop-it/challenges.md index 97554e43..6a623678 100644 --- a/docs/reference/js/lessons/bop-it/challenges.md +++ b/docs/reference/js/lessons/bop-it/challenges.md @@ -12,7 +12,7 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` newAction() // *** -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (action == 0) { game.addScore(1) // *** newAction() // *** @@ -30,7 +30,7 @@ input.onGesture(Gesture.Shake, () => { newAction() // *** } }) // *** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showNumber(game.score(), 150) // *** basic.pause(2000) // *** newAction() // *** @@ -68,12 +68,12 @@ Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on ``` // **. . .** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showNumber(game.score(), 150) // *** basic.pause(2000) // *** newAction() // *** }) // *** -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { if (action == 3) { game.addScore(1) // *** newAction() // *** diff --git a/docs/reference/js/lessons/bop-it/quiz-answers.md b/docs/reference/js/lessons/bop-it/quiz-answers.md index f569b53a..66ef0426 100644 --- a/docs/reference/js/lessons/bop-it/quiz-answers.md +++ b/docs/reference/js/lessons/bop-it/quiz-answers.md @@ -33,7 +33,7 @@ if (action == 0) {
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (action == 0) { game.addScore(1) } diff --git a/docs/reference/js/lessons/break/challenges.md b/docs/reference/js/lessons/break/challenges.md index e942374e..a0cc2d0b 100644 --- a/docs/reference/js/lessons/break/challenges.md +++ b/docs/reference/js/lessons/break/challenges.md @@ -9,7 +9,7 @@ Welcome! This [guided tutorial](/microbit/lessons/break/tutorial) will assist yo ``` count = 0 shouldBreak = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { shouldBreak = true }) while (true) { @@ -49,7 +49,7 @@ while (true) { basic.showNumber(count, 150) basic.pause(1000) } -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` @@ -57,7 +57,7 @@ Next, set `shouldBreak` back to false to indicate we want to run the `while` loo ``` // **. . .** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { shouldBreak = false // *** }) ``` @@ -66,7 +66,7 @@ And now copy the code from the previous while loop into the condition of `input- ``` // **. . .** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { shouldBreak = false while (true) { if (shouldBreak) { diff --git a/docs/reference/js/lessons/button/challenges.md b/docs/reference/js/lessons/button/challenges.md index c619303d..70cf1696 100644 --- a/docs/reference/js/lessons/button/challenges.md +++ b/docs/reference/js/lessons/button/challenges.md @@ -9,14 +9,14 @@ Howdy! This [guided tutorial](/microbit/rxqgzy) will help you complete this acti In this guide, you will learn how to use buttons and show text on the screen. Let's start by adding to respond **when the left button is pressed**. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` All the code inside `input->on button pressed` runs when the button is pressed. Let's add the code to show some text. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) }) ``` @@ -26,10 +26,10 @@ input.onButtonPressed("A", () => { Let's add an event handler for Button `B`. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) ``` @@ -38,10 +38,10 @@ input.onButtonPressed("B", () => { Display `bye` when the `B` button is pressed. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("hello", 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showString("bye", 150) }) ``` diff --git a/docs/reference/js/lessons/clear-screen/challenges.md b/docs/reference/js/lessons/clear-screen/challenges.md index c4649671..1b604f19 100644 --- a/docs/reference/js/lessons/clear-screen/challenges.md +++ b/docs/reference/js/lessons/clear-screen/challenges.md @@ -18,7 +18,7 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) ``` @@ -37,10 +37,10 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) ``` @@ -56,10 +56,10 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showAnimation(` # # # # # # # # # # . . . . . . . . . . # # # # # # # # # # . . . . . . . . . . diff --git a/docs/reference/js/lessons/compare-machine/challenges.md b/docs/reference/js/lessons/compare-machine/challenges.md index 6012430b..44aafca2 100644 --- a/docs/reference/js/lessons/compare-machine/challenges.md +++ b/docs/reference/js/lessons/compare-machine/challenges.md @@ -8,7 +8,7 @@ Welcome! This [guided tutorial](/microbit/lessons/comparison/tutorial) will assi ``` counter = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 10) { counter = 1 @@ -23,7 +23,7 @@ Now let's do something special when the micro:bit reaches the number `5`. Instea ``` counter = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 10) { counter = 1 @@ -40,7 +40,7 @@ Let's continue our plan of displaying `HALF WAY!` when `counter = 5`. To do so, ``` counter = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 10) { counter = 1 @@ -60,7 +60,7 @@ You may notice a problem right now. When `counter = 5`, the micro:bit will show ``` counter = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 if (counter == 10) { counter = 1 diff --git a/docs/reference/js/lessons/counter/activity.md b/docs/reference/js/lessons/counter/activity.md index 94abadb6..7b54757d 100644 --- a/docs/reference/js/lessons/counter/activity.md +++ b/docs/reference/js/lessons/counter/activity.md @@ -22,7 +22,7 @@ The code under ``on button pressed("A")`` will run each time the user presses A. ``` let count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count = count + 1 }) ``` @@ -31,7 +31,7 @@ Since the count has changed, it's time to refresh the screen display. Let's add ``` let count_1 = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count = count + 1 basic.showNumber(count, 150) }) diff --git a/docs/reference/js/lessons/counter/challenges.md b/docs/reference/js/lessons/counter/challenges.md index 20698c41..a45e968e 100644 --- a/docs/reference/js/lessons/counter/challenges.md +++ b/docs/reference/js/lessons/counter/challenges.md @@ -8,7 +8,7 @@ Complete the following [guided tutorial](/microbit/lessons/counter/activity) At ``` let count = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count = count + 1 basic.showNumber(count, 150) }) @@ -22,11 +22,11 @@ Let's add the code to `count` when `B` is pressed. Add an event handler with `in ``` let count1 = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count1 = count1 + 1 basic.showNumber(count1, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { count1 = count1 - 1 // *** basic.showNumber(count1, 150) // *** }) // *** diff --git a/docs/reference/js/lessons/guess-the-number/activity.md b/docs/reference/js/lessons/guess-the-number/activity.md index 75210043..48da6e6e 100644 --- a/docs/reference/js/lessons/guess-the-number/activity.md +++ b/docs/reference/js/lessons/guess-the-number/activity.md @@ -15,14 +15,14 @@ To create a new script, go to the [Create Code](/microbit/create-code) page and Add an event handler when button `A` is pressed. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` Create a local variable of type number `x` and set it to a random number using `math->random`. `math->random(10)` generates a random number between `0` and `10` **excluded**. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let x = Math.random(10) }) ``` @@ -30,7 +30,7 @@ input.onButtonPressed("A", () => { Show the random number on the screen. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let x1 = Math.random(10) basic.showNumber(x1, 150) }) diff --git a/docs/reference/js/lessons/guess-the-number/challenges.md b/docs/reference/js/lessons/guess-the-number/challenges.md index 00b6445d..57d67dab 100644 --- a/docs/reference/js/lessons/guess-the-number/challenges.md +++ b/docs/reference/js/lessons/guess-the-number/challenges.md @@ -11,7 +11,7 @@ Complete the following guided tutorial: At the end of the tutorial, click `keep editing`. Your code should look like this: ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let x = Math.random(10) basic.showNumber(x, 150) }) @@ -24,11 +24,11 @@ input.onButtonPressed("A", () => { When button `B` is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let x1 = Math.random(10) basic.showNumber(x1, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.clearScreen() // *** }) ``` diff --git a/docs/reference/js/lessons/jailbreak/challenges.md b/docs/reference/js/lessons/jailbreak/challenges.md index d5f0c2d8..dafd2958 100644 --- a/docs/reference/js/lessons/jailbreak/challenges.md +++ b/docs/reference/js/lessons/jailbreak/challenges.md @@ -13,7 +13,7 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` count = 0 shouldBreak = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { shouldBreak = true }) while (true) { @@ -60,7 +60,7 @@ while (true) { basic.showNumber(count, 150) basic.pause(1000) } -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` @@ -68,7 +68,7 @@ Next, set `should break` back to false to indicate we want to run the `while` lo ``` // **. . .** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { shouldBreak = false // *** }) ``` @@ -77,7 +77,7 @@ And now copy the code from the previous while loop into the condition of `input- ``` // **. . .** -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { shouldBreak = false while (true) { if (shouldBreak) { diff --git a/docs/reference/js/lessons/jailbreak/quiz-answers.md b/docs/reference/js/lessons/jailbreak/quiz-answers.md index 3d6164be..d178e1a2 100644 --- a/docs/reference/js/lessons/jailbreak/quiz-answers.md +++ b/docs/reference/js/lessons/jailbreak/quiz-answers.md @@ -22,7 +22,7 @@ shouldBreak = false Write the line of code to stop incrementing `count` when the button is pressed. (Hint: This will set `should break` to true). ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { shouldBreak = true }) ``` diff --git a/docs/reference/js/lessons/line-of-fire/quiz-answers.md b/docs/reference/js/lessons/line-of-fire/quiz-answers.md index 1c7dc56b..603e3d0b 100644 --- a/docs/reference/js/lessons/line-of-fire/quiz-answers.md +++ b/docs/reference/js/lessons/line-of-fire/quiz-answers.md @@ -128,7 +128,7 @@ for (let j = 0; j < 10; j++) {
``` -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showString("WINS", 150) basic.showNumber(wins, 150) basic.pause(500) diff --git a/docs/reference/js/lessons/love-meter/activity.md b/docs/reference/js/lessons/love-meter/activity.md index 1488eca0..7365c9dc 100644 --- a/docs/reference/js/lessons/love-meter/activity.md +++ b/docs/reference/js/lessons/love-meter/activity.md @@ -15,14 +15,14 @@ To create a new script, go to the [Create Code](/microbit/create-code) page and Begin by registering an event with `input->on pin pressed(PO)` to know when someone is holding pin ``P0`` and pin ``Gnd``. ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { }) ``` We are going to create a meter that displays a random number from 0 to 10. We use ``11`` as `math->random(n)` returns a number between ``0`` and ``n-1``. ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x = Math.random(11) }) ``` @@ -30,7 +30,7 @@ input.onPinPressed("P0", () => { Finally, let's show that number on the micro:bit. ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x_ = Math.random(11) basic.showNumber(x_, 150) }) diff --git a/docs/reference/js/lessons/love-meter/challenges.md b/docs/reference/js/lessons/love-meter/challenges.md index 8f5ba4ee..3c18e9ed 100644 --- a/docs/reference/js/lessons/love-meter/challenges.md +++ b/docs/reference/js/lessons/love-meter/challenges.md @@ -11,7 +11,7 @@ Complete the following guided tutorial: At the end of the tutorial, click `keep editing`. Your code should look like this: ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x = Math.random(11) basic.showNumber(x, 150) }) @@ -22,7 +22,7 @@ input.onPinPressed("P0", () => { Add a pause of 3000 milliseconds (3 seconds) after showing the number so that the number won't immediately disappear in the next challenge. ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x1 = Math.random(11) basic.showNumber(x1, 150) basic.pause(3000) // *** @@ -34,7 +34,7 @@ input.onPinPressed("P0", () => { If the rating **x** is between ``0`` and ``3`` (strictly less than ``4``), display the text "HORRIBLE!". ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x2 = Math.random(11) basic.showNumber(x2, 150) basic.pause(3000) @@ -51,7 +51,7 @@ input.onPinPressed("P0", () => { If the rating is between 4 and 7, display the text "MEDIOCRE!" **else** display the text "MATCHED!" ``` -input.onPinPressed("P0", () => { +input.onPinPressed(TouchPin.P0, () => { let x3 = Math.random(11) basic.showNumber(x3, 150) basic.pause(3000) diff --git a/docs/reference/js/lessons/love-meter/quiz-answers.md b/docs/reference/js/lessons/love-meter/quiz-answers.md index b673e707..4dd7d895 100644 --- a/docs/reference/js/lessons/love-meter/quiz-answers.md +++ b/docs/reference/js/lessons/love-meter/quiz-answers.md @@ -13,7 +13,7 @@ It's a method that runs code when the user holds the GND pin with a finger of on ## 2. Create a condition for on pin pressed ("P1"). ``` -input.onPinPressed("P1", () => { +input.onPinPressed(TouchPin.P1, () => { }) ``` diff --git a/docs/reference/js/lessons/night-light/activity.md b/docs/reference/js/lessons/night-light/activity.md index 7bc00baf..ea06cb22 100644 --- a/docs/reference/js/lessons/night-light/activity.md +++ b/docs/reference/js/lessons/night-light/activity.md @@ -32,7 +32,7 @@ Add a new event handler for `input->on button pressed(A)` and add the code to se ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) // *** }) // *** ``` diff --git a/docs/reference/js/lessons/night-light/challenges.md b/docs/reference/js/lessons/night-light/challenges.md index 4d6f73c9..7a45d212 100644 --- a/docs/reference/js/lessons/night-light/challenges.md +++ b/docs/reference/js/lessons/night-light/challenges.md @@ -13,7 +13,7 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) }) ``` @@ -27,10 +27,10 @@ What if we want to turn off all the LEDs? Let's do this by setting the brightnes ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { led.setBrightness(0) // *** }) // *** ``` diff --git a/docs/reference/js/lessons/number-psych/quiz-answers.md b/docs/reference/js/lessons/number-psych/quiz-answers.md index cf43a869..5348d1e1 100644 --- a/docs/reference/js/lessons/number-psych/quiz-answers.md +++ b/docs/reference/js/lessons/number-psych/quiz-answers.md @@ -126,7 +126,7 @@ for (let i4 = 0; i4 < 4; i4++) {
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (gameMode == 0 && playerNumber == 0) { micro_bitTransfer.transferByte(255) } @@ -148,7 +148,7 @@ for (let k1 = 0; k1 < 3; k1++) {
``` -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { if (gameMode == 2) { gameMode = 1 basic.plotImage(` diff --git a/docs/reference/js/lessons/offset-image/challenges.md b/docs/reference/js/lessons/offset-image/challenges.md index 5d94f317..879b4084 100644 --- a/docs/reference/js/lessons/offset-image/challenges.md +++ b/docs/reference/js/lessons/offset-image/challenges.md @@ -24,7 +24,7 @@ basic.forever(() => { . . # . . `).showImage(offset) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { offset = offset + 1 }) ``` @@ -47,10 +47,10 @@ basic.forever(() => { . . # . . `).showImage(offset) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { offset = offset + 1 }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { offset = offset - 1 // *** }) // *** ``` @@ -82,10 +82,10 @@ basic.forever(() => { . . # . . `).showImage(offset) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { offset = offset + 1 }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { offset = offset - 1 }) ``` diff --git a/docs/reference/js/lessons/offset-image/quiz-answers.md b/docs/reference/js/lessons/offset-image/quiz-answers.md index e320c114..1bcd7236 100644 --- a/docs/reference/js/lessons/offset-image/quiz-answers.md +++ b/docs/reference/js/lessons/offset-image/quiz-answers.md @@ -41,7 +41,7 @@ Write the two lines of code that cause the `variable` offset to increase by one
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { offset = offset + 1 }) ``` diff --git a/docs/reference/js/lessons/pong/activity.md b/docs/reference/js/lessons/pong/activity.md index 7a2b4f05..4ab4771e 100644 --- a/docs/reference/js/lessons/pong/activity.md +++ b/docs/reference/js/lessons/pong/activity.md @@ -26,10 +26,10 @@ ball.setDirection(-45) The user will control the paddle by pressing ``A`` to go up and ``B`` to go down. Let's add ``on button pressed`` event handlers to do that. ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { paddle.changeYBy(-1) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { paddle.changeYBy(1) }) ``` diff --git a/docs/reference/js/lessons/pong/quiz-answers.md b/docs/reference/js/lessons/pong/quiz-answers.md index 51f6afde..45cbf458 100644 --- a/docs/reference/js/lessons/pong/quiz-answers.md +++ b/docs/reference/js/lessons/pong/quiz-answers.md @@ -42,7 +42,7 @@ led.plot(ballX, ballY)
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (paddleNotUp()) { led.unplot(0, paddleY) paddleY = paddleY - 1 @@ -56,7 +56,7 @@ input.onButtonPressed("A", () => {
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { if (paddleNotDown()) { led.unplot(0, paddleY) paddleY = paddleY + 1 diff --git a/docs/reference/js/lessons/return/challenges.md b/docs/reference/js/lessons/return/challenges.md index a9eba150..8241cbc5 100644 --- a/docs/reference/js/lessons/return/challenges.md +++ b/docs/reference/js/lessons/return/challenges.md @@ -8,7 +8,7 @@ Welcome! This [guided tutorial](/microbit/lessons/return/tutorial) will help you ``` let original1 = 5 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let doubled = doubleIt_(5) basic.showNumber(doubled, 150) // *** }) @@ -32,11 +32,11 @@ Add a condition to know when button `B` is pressed. We will use this condition i ``` let original = 5 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let one = doubleIt_(original) basic.showNumber(one, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) ``` diff --git a/docs/reference/js/lessons/rock-paper-scissors-book-version/challenges.md b/docs/reference/js/lessons/rock-paper-scissors-book-version/challenges.md index cd0ba1d9..ae498951 100644 --- a/docs/reference/js/lessons/rock-paper-scissors-book-version/challenges.md +++ b/docs/reference/js/lessons/rock-paper-scissors-book-version/challenges.md @@ -50,7 +50,7 @@ input.onGesture(Gesture.Shake, () => { let offset1 = 5 * Math.random(3) img1.showImage(offset1) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) // *** ``` @@ -71,7 +71,7 @@ input.onGesture(Gesture.Shake, () => { let offset2 = 5 * Math.random(3) img2.showImage(offset2) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 // *** }) ``` @@ -93,7 +93,7 @@ input.onGesture(Gesture.Shake, () => { let offset3 = 5 * Math.random(3) img3.showImage(offset3) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) // *** basic.showNumber(wins, 150) // *** @@ -129,12 +129,12 @@ input.onGesture(Gesture.Shake, () => { let offset4 = 5 * Math.random(3) img4.showImage(offset4) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` @@ -155,12 +155,12 @@ input.onGesture(Gesture.Shake, () => { let offset5 = 5 * Math.random(3) img5.showImage(offset5) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 // *** }) ``` @@ -182,12 +182,12 @@ input.onGesture(Gesture.Shake, () => { let offset6 = 5 * Math.random(3) img6.showImage(offset6) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 basic.showString("WINS", 150) // *** basic.showNumber(wins, 150) // *** @@ -213,14 +213,14 @@ input.onGesture(Gesture.Shake, () => { let offset7 = 5 * Math.random(3) img7.showImage(offset7) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) basic.showString("LOSSES:", 150) // *** basic.showNumber(losses, 150) // *** }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 basic.showString("WINS", 150) basic.showNumber(wins, 150) diff --git a/docs/reference/js/lessons/rock-paper-scissors-teacher-guide/challenges.md b/docs/reference/js/lessons/rock-paper-scissors-teacher-guide/challenges.md index 63fbae9f..b50ad920 100644 --- a/docs/reference/js/lessons/rock-paper-scissors-teacher-guide/challenges.md +++ b/docs/reference/js/lessons/rock-paper-scissors-teacher-guide/challenges.md @@ -50,7 +50,7 @@ input.onGesture(Gesture.Shake, () => { let offset1 = 5 * Math.random(3) img1.showImage(offset1) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) // *** ``` @@ -71,7 +71,7 @@ input.onGesture(Gesture.Shake, () => { let offset2 = 5 * Math.random(3) img2.showImage(offset2) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 // *** }) ``` @@ -93,7 +93,7 @@ input.onGesture(Gesture.Shake, () => { let offset3 = 5 * Math.random(3) img3.showImage(offset3) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) // *** basic.showNumber(wins, 150) // *** @@ -129,12 +129,12 @@ input.onGesture(Gesture.Shake, () => { let offset4 = 5 * Math.random(3) img4.showImage(offset4) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` @@ -155,12 +155,12 @@ input.onGesture(Gesture.Shake, () => { let offset5 = 5 * Math.random(3) img5.showImage(offset5) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 // *** }) ``` @@ -182,12 +182,12 @@ input.onGesture(Gesture.Shake, () => { let offset6 = 5 * Math.random(3) img6.showImage(offset6) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 basic.showString("WINS", 150) // *** basic.showNumber(wins, 150) // *** @@ -213,14 +213,14 @@ input.onGesture(Gesture.Shake, () => { let offset7 = 5 * Math.random(3) img7.showImage(offset7) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { wins = wins + 1 basic.showString("WINS:", 150) basic.showNumber(wins, 150) basic.showString("LOSSES:", 150) // *** basic.showNumber(losses, 150) // *** }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { losses = losses + 1 basic.showString("WINS", 150) basic.showNumber(wins, 150) diff --git a/docs/reference/js/lessons/rock-paper-scissors/challenges.md b/docs/reference/js/lessons/rock-paper-scissors/challenges.md index 94ea9087..2bdacb6e 100644 --- a/docs/reference/js/lessons/rock-paper-scissors/challenges.md +++ b/docs/reference/js/lessons/rock-paper-scissors/challenges.md @@ -34,7 +34,7 @@ input.onGesture(Gesture.Shake, () => { `) img1.plotFrame(Math.random(3)) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) // *** }) // *** ``` @@ -54,7 +54,7 @@ input.onGesture(Gesture.Shake, () => { `) img2.plotFrame(Math.random(3)) }) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { game.addScore(1) basic.showString("WINS: ", 150) // *** basic.showNumber(game.score(), 150) // *** diff --git a/docs/reference/js/lessons/rotating-animation/challenges.md b/docs/reference/js/lessons/rotating-animation/challenges.md index 9f91d931..27658165 100644 --- a/docs/reference/js/lessons/rotating-animation/challenges.md +++ b/docs/reference/js/lessons/rotating-animation/challenges.md @@ -27,7 +27,7 @@ Now let's add to this by creating a condition for on button pressed `A` before t ``` rotating = true -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) // *** while (rotating) { basic.showAnimation(` @@ -48,7 +48,7 @@ Now that we have the on button pressed condition, let's make the animation stop ``` rotating = true -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { rotating = false // *** }) // *** while (rotating) { diff --git a/docs/reference/js/lessons/rotation-animation/challenges.md b/docs/reference/js/lessons/rotation-animation/challenges.md index 29ba9f3f..48505b8c 100644 --- a/docs/reference/js/lessons/rotation-animation/challenges.md +++ b/docs/reference/js/lessons/rotation-animation/challenges.md @@ -30,7 +30,7 @@ Now let's add to this by creating a condition for on button pressed `A` before t ``` rotating = true -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) // *** while (rotating) { basic.showAnimation(` @@ -52,7 +52,7 @@ Now that we have the on button pressed condition, let's make the animation stop ``` rotating = true -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { rotating = false // *** }) // *** while (rotating) { diff --git a/docs/reference/js/lessons/runaway-pacman/quiz-answers.md b/docs/reference/js/lessons/runaway-pacman/quiz-answers.md index de181370..68f72fbf 100644 --- a/docs/reference/js/lessons/runaway-pacman/quiz-answers.md +++ b/docs/reference/js/lessons/runaway-pacman/quiz-answers.md @@ -88,7 +88,7 @@ levelTime = 0
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let temp = math.abs(person.dirX) * (-1) // {stcode} // MACRO: stcode @@ -104,7 +104,7 @@ input.onButtonPressed("A", () => {
``` -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { let temp1 = math.abs(person.dirX) // {stcode} // MACRO: stcode diff --git a/docs/reference/js/lessons/screen-wipe/activity.md b/docs/reference/js/lessons/screen-wipe/activity.md index 4c298313..f4e4646c 100644 --- a/docs/reference/js/lessons/screen-wipe/activity.md +++ b/docs/reference/js/lessons/screen-wipe/activity.md @@ -32,7 +32,7 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() // *** }) // *** ``` diff --git a/docs/reference/js/lessons/screen-wipe/challenges.md b/docs/reference/js/lessons/screen-wipe/challenges.md index f617ba30..4e3ec6b0 100644 --- a/docs/reference/js/lessons/screen-wipe/challenges.md +++ b/docs/reference/js/lessons/screen-wipe/challenges.md @@ -14,7 +14,7 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) ``` @@ -31,10 +31,10 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) ``` @@ -52,10 +52,10 @@ basic.showAnimation(` . . . . . # # # # # # # # # # # # # # # . . . . . . . . . . . . . . . # # # # # `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.clearScreen() }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showAnimation(` # # # # # # # # # # . . . . . . . . . . # # # # # # # # # # . . . . . . . . . . diff --git a/docs/reference/js/lessons/set-brightness/challenges.md b/docs/reference/js/lessons/set-brightness/challenges.md index 0ec3578f..b1c1be3c 100644 --- a/docs/reference/js/lessons/set-brightness/challenges.md +++ b/docs/reference/js/lessons/set-brightness/challenges.md @@ -1,6 +1,6 @@ # set brightness challenges -These challenges will allow you to change the brightness of the micro:bit. #docs +These challenges will allow you to change the brightness of the micro:bit. docs **Challenge 0** @@ -11,7 +11,7 @@ These challenges will allow you to change the brightness of the micro:bit. #docs ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) }) ``` @@ -25,10 +25,10 @@ What if we want to turn off all the LEDs? Let's do this by setting the brightnes ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` @@ -39,10 +39,10 @@ Inside of the condition `input->on button pressed("B")`, add `led->set brightnes ``` led.setBrightness(255) led.plotAll() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.setBrightness(64) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { led.setBrightness(0) // *** }) ``` diff --git a/docs/reference/js/lessons/smiley/challenges.md b/docs/reference/js/lessons/smiley/challenges.md index 5b0a6a68..a2c0dcce 100644 --- a/docs/reference/js/lessons/smiley/challenges.md +++ b/docs/reference/js/lessons/smiley/challenges.md @@ -30,7 +30,7 @@ basic.showAnimation(` # . . . # . . . . . . # # # . . . . . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) // *** ``` @@ -48,7 +48,7 @@ basic.showAnimation(` # . . . # . . . . . . # # # . . . . . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showLeds(` . # . # . . # . # . diff --git a/docs/reference/js/lessons/speed-button/challenges.md b/docs/reference/js/lessons/speed-button/challenges.md index 1f265c4f..1e8ffac0 100644 --- a/docs/reference/js/lessons/speed-button/challenges.md +++ b/docs/reference/js/lessons/speed-button/challenges.md @@ -13,7 +13,7 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` let counter = 0 let fastPress = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter = counter + 1 }) ``` @@ -25,7 +25,7 @@ We need to know when the user has hit button `A` 15 times. The user wins when he ``` let counter1 = 0 let fastPress1 = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter1 = counter1 + 1 if (counter1 == 15 && input.runningTime() < 5000) { } @@ -37,7 +37,7 @@ Next, if the user has won, let's set our boolean to true. This indicates that he ``` let counter2 = 0 let fastPress2 = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter2 = counter2 + 1 if (counter2 == 15 && input.runningTime() < 5000) { fastPress2 = true // *** @@ -52,7 +52,7 @@ We want to set `fastPress` to false if the user was too slow. To do so, we need ``` let counter3 = 0 let fastPress3 = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter3 = counter3 + 1 if (counter3 == 15 && input.runningTime() < 5000) { fastPress3 = true @@ -72,7 +72,7 @@ Now let's display if the user won or lost. To do so, we need to check the status ``` let counter4 = 0 let fastPress4 = false -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { counter4 = counter4 + 1 if (counter4 == 15 && input.runningTime() < 5000) { fastPress4 = true diff --git a/docs/reference/js/lessons/speed-button/quiz-answers.md b/docs/reference/js/lessons/speed-button/quiz-answers.md index 7e573099..cbcceb1d 100644 --- a/docs/reference/js/lessons/speed-button/quiz-answers.md +++ b/docs/reference/js/lessons/speed-button/quiz-answers.md @@ -22,7 +22,7 @@ let count = 0 ``` let count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) @@ -38,7 +38,7 @@ After two button presses, **count** will be equal to 2. ``` count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) diff --git a/docs/reference/js/lessons/speed-button/quiz.md b/docs/reference/js/lessons/speed-button/quiz.md index cc9d2591..a1e0fcd0 100644 --- a/docs/reference/js/lessons/speed-button/quiz.md +++ b/docs/reference/js/lessons/speed-button/quiz.md @@ -24,7 +24,7 @@ let count = 0 ``` let count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) @@ -38,7 +38,7 @@ input.onButtonPressed("A", () => { ``` count_ = 0 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count_ = count_ + 1 basic.showNumber(count_, 100) }) diff --git a/docs/reference/js/lessons/the-hat-game/challenges.md b/docs/reference/js/lessons/the-hat-game/challenges.md index 7b3a4bd0..c0ac1bd8 100644 --- a/docs/reference/js/lessons/the-hat-game/challenges.md +++ b/docs/reference/js/lessons/the-hat-game/challenges.md @@ -13,10 +13,10 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` initializeGame() playLevel() -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { selectHat() }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { chooseHat() }) ``` diff --git a/docs/reference/js/lessons/the-hat-game/quiz-answers.md b/docs/reference/js/lessons/the-hat-game/quiz-answers.md index 54671518..bf514384 100644 --- a/docs/reference/js/lessons/the-hat-game/quiz-answers.md +++ b/docs/reference/js/lessons/the-hat-game/quiz-answers.md @@ -46,7 +46,7 @@ Write the code that displays the next letter of the string in "cup select" when
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { index = index + 1 if (index > 2) { index = 0 diff --git a/docs/reference/js/lessons/transformers/challenges.md b/docs/reference/js/lessons/transformers/challenges.md index 51631489..b820acd8 100644 --- a/docs/reference/js/lessons/transformers/challenges.md +++ b/docs/reference/js/lessons/transformers/challenges.md @@ -12,7 +12,7 @@ At the end of the tutorial, click `keep editing`. Your code should look like thi ``` let inital = 5 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let doubled1 = double(initial) basic.showNumber(doubled1, 150) // *** }) @@ -40,11 +40,11 @@ Add a condition for when button `B` is pressed. We will use this condition in th ``` initial = 5 -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let doubled = double(initial) basic.showNumber(doubled, 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { }) // *** ``` diff --git a/docs/reference/js/lessons/transformers/quiz-answers.md b/docs/reference/js/lessons/transformers/quiz-answers.md index 61086a89..33d41b2d 100644 --- a/docs/reference/js/lessons/transformers/quiz-answers.md +++ b/docs/reference/js/lessons/transformers/quiz-answers.md @@ -21,7 +21,7 @@ let x = 5
``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` diff --git a/docs/reference/js/lessons/truth-or-dare/activity.md b/docs/reference/js/lessons/truth-or-dare/activity.md index 9d2a69b9..97f284f5 100644 --- a/docs/reference/js/lessons/truth-or-dare/activity.md +++ b/docs/reference/js/lessons/truth-or-dare/activity.md @@ -28,7 +28,7 @@ basic.showLeds(` . . # . . . . # . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { }) ``` @@ -42,7 +42,7 @@ basic.showLeds(` . . # . . . . # . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random = Math.random(2) }) ``` @@ -57,7 +57,7 @@ basic.showLeds(` . . # . . . . # . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random1 = Math.random(2) if (random1 == 0) { basic.showString("TRUTH", 150) @@ -79,7 +79,7 @@ basic.showLeds(` . . # . . . . # . . `, 400) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random2 = Math.random(2) if (random2 == 0) { basic.showString("TRUTH", 150) diff --git a/docs/reference/js/lessons/truth-or-dare/challenges.md b/docs/reference/js/lessons/truth-or-dare/challenges.md index e7dca020..d1231944 100644 --- a/docs/reference/js/lessons/truth-or-dare/challenges.md +++ b/docs/reference/js/lessons/truth-or-dare/challenges.md @@ -18,7 +18,7 @@ basic.plotImage(` . . # . . . . # . . `) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random = Math.random(2) if (random == 0) { basic.showString("TRUTH", 150) @@ -47,7 +47,7 @@ basic.plotImage(` . . # . . . . # . . `) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random1 = Math.random(3) // *** if (random1 == 0) { basic.showString("TRUTH", 150) @@ -76,7 +76,7 @@ basic.plotImage(` . . # . . . . # . . `) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { let random2 = Math.random(3) if (random2 == 0) { basic.showString("TRUTH", 150) // *** diff --git a/docs/reference/js/lessons/typing-game/challenges.md b/docs/reference/js/lessons/typing-game/challenges.md index 77879414..7474af84 100644 --- a/docs/reference/js/lessons/typing-game/challenges.md +++ b/docs/reference/js/lessons/typing-game/challenges.md @@ -10,14 +10,14 @@ This [guided tutorial](/microbit/lessons/typing-game/tutorial) will teach you ho alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" index = 0 name = "" -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.showString(alphabet.substr(index, 1), 0) index = index + 1 }) if (index > 25) { index = 0 } -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { name = name.concat(alphabet.substr(index - 1, 1)) }) input.onGesture(Gesture.Shake, () => { @@ -33,14 +33,14 @@ After you have shown the string in the condition `on shake`, make the name varia alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" index = 0 name = "" -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.showString(alphabet.substr(index, 1), 0) index = index + 1 }) if (index > 25) { index = 0 } -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { name = name.concat(alphabet.substr(index - 1, 1)) }) input.onGesture(Gesture.Shake, () => { @@ -57,14 +57,14 @@ After you have cleared the name variable to hold nothing, make `index := 0` so t alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" index = 0 name = "" -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { led.showString(alphabet.substr(index, 1), 0) index = index + 1 }) if (index > 25) { index = 0 } -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { name = name.concat(alphabet.substr(index - 1, 1)) }) input.onGesture(Gesture.Shake, () => { diff --git a/docs/reference/js/lessons/yes-no/challenges.md b/docs/reference/js/lessons/yes-no/challenges.md index 57f6d10a..f5b12889 100644 --- a/docs/reference/js/lessons/yes-no/challenges.md +++ b/docs/reference/js/lessons/yes-no/challenges.md @@ -18,7 +18,7 @@ Now we need to reply after someone asks Micro a yes or no question. We want to ``` basic.showString("ASK ME A QUESTION", 150) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("YES", 150) // *** }) // *** ``` @@ -33,10 +33,10 @@ What if Micro's answer to the question is no? Let's have `NO` be displayed when ``` basic.showString("ASK ME A QUESTION", 150) -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { basic.showString("YES", 150) }) -input.onButtonPressed("B", () => { +input.onButtonPressed(Button.B, () => { basic.showString("NO", 150) // *** }) // *** ``` diff --git a/docs/reference/js/reactive.md b/docs/reference/js/reactive.md index 73837e34..9b79fef7 100644 --- a/docs/reference/js/reactive.md +++ b/docs/reference/js/reactive.md @@ -53,7 +53,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u ``` export function countButtonPresses() { let count = 0 - input.onButtonPressed("A", () => { + input.onButtonPressed(Button.A, () => { count = count + 1 }) basic.forever(() => { @@ -71,7 +71,7 @@ let count1 = 0 initializesthe variable `count`. The second statement ``` -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { count1 = count1 + 1 }) ``` @@ -135,13 +135,13 @@ As a result, you can easily add a new capability to the micro:bit by just adding ``` export function countButtonPressesWithReset() { let count = 0 - input.onButtonPressed("A", () => { + input.onButtonPressed(Button.A, () => { count = count + 1 }) basic.forever(() => { basic.showNumber(count, 150) }) - input.onButtonPressed("B", () => { + input.onButtonPressed(Button.B, () => { count = 0 }) } diff --git a/docs/reference/js/serial-library.md b/docs/reference/js/serial-library.md index e32f17e2..20cac1e1 100644 --- a/docs/reference/js/serial-library.md +++ b/docs/reference/js/serial-library.md @@ -8,7 +8,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st ``` serial.writeLine("started...") -input.onButtonPressed("A", () => { +input.onButtonPressed(Button.A, () => { serial.writeLine("A pressed") }) ``` From 06916c4f827b842a17c1f4540ba0caa96926425b Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 29 Mar 2016 23:09:19 -0700 Subject: [PATCH 3/4] Bump kindscript to 0.1.121 --- package.json | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 156a3a32..59fa2c77 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,35 @@ { - "name": "kindscript-microbit", - "version": "0.0.14", - "description": "BBC micro:bit target for KindScript", - "keywords": [ - "JavaScript", - "education", - "microbit" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/Microsoft/kindscript-microbit.git" - }, - "author": "", - "license": "MIT", - "homepage": "https://github.com/Microsoft/kindscript-microbit#readme", - "files": [ - "README.md", - "kindtarget.json", - "kindtheme.json", - "built/*.js", - "built/*.json", - "built/*.d.ts", - "sim/public", - "docs/*.md", - "docs/*/*.md", - "docs/*/*/*.md" - ], - "devDependencies": { - "typescript": "^1.8.7" - }, - "dependencies": { - "kindscript": "0.1.119" - } + "name": "kindscript-microbit", + "version": "0.0.14", + "description": "BBC micro:bit target for KindScript", + "keywords": [ + "JavaScript", + "education", + "microbit" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/Microsoft/kindscript-microbit.git" + }, + "author": "", + "license": "MIT", + "homepage": "https://github.com/Microsoft/kindscript-microbit#readme", + "files": [ + "README.md", + "kindtarget.json", + "kindtheme.json", + "built/*.js", + "built/*.json", + "built/*.d.ts", + "sim/public", + "docs/*.md", + "docs/*/*.md", + "docs/*/*/*.md" + ], + "devDependencies": { + "typescript": "^1.8.7" + }, + "dependencies": { + "kindscript": "0.1.121" + } } From 8f61570158e89488555ce7b2b1b2741cd5195e9a Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 29 Mar 2016 23:09:21 -0700 Subject: [PATCH 4/4] 0.0.15 --- package.json | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 59fa2c77..d266e1d1 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,35 @@ { - "name": "kindscript-microbit", - "version": "0.0.14", - "description": "BBC micro:bit target for KindScript", - "keywords": [ - "JavaScript", - "education", - "microbit" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/Microsoft/kindscript-microbit.git" - }, - "author": "", - "license": "MIT", - "homepage": "https://github.com/Microsoft/kindscript-microbit#readme", - "files": [ - "README.md", - "kindtarget.json", - "kindtheme.json", - "built/*.js", - "built/*.json", - "built/*.d.ts", - "sim/public", - "docs/*.md", - "docs/*/*.md", - "docs/*/*/*.md" - ], - "devDependencies": { - "typescript": "^1.8.7" - }, - "dependencies": { - "kindscript": "0.1.121" - } + "name": "kindscript-microbit", + "version": "0.0.15", + "description": "BBC micro:bit target for KindScript", + "keywords": [ + "JavaScript", + "education", + "microbit" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/Microsoft/kindscript-microbit.git" + }, + "author": "", + "license": "MIT", + "homepage": "https://github.com/Microsoft/kindscript-microbit#readme", + "files": [ + "README.md", + "kindtarget.json", + "kindtheme.json", + "built/*.js", + "built/*.json", + "built/*.d.ts", + "sim/public", + "docs/*.md", + "docs/*/*.md", + "docs/*/*/*.md" + ], + "devDependencies": { + "typescript": "^1.8.7" + }, + "dependencies": { + "kindscript": "0.1.121" + } }