put lessons back for Michael

This commit is contained in:
Tom Ball
2016-06-14 17:28:08 -04:00
parent 0c67cd8e8b
commit 54213cf554
182 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,37 @@
# counter challenges
Coding challenges for the counter.
## Before we get started
Complete the following [guided tutorial](/lessons/counter/activity) At the end of the tutorial, click **keep editing**. Your code should look like this:
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count)
})
```
### Challenge 1
Let's add the code to `count` when `B` is pressed. Add an event handler with `on button pressed(B)` then add the code to `count`.
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count)
})
input.onButtonPressed(Button.B, () => {
count = count - 1
basic.showNumber(count)
})
```
### Challenge 3
Now let's try to reset the counter when the micro:bit is shaken. You will need to register an event handler with `on shake`.