move lessons out of web site

will move select lessons back to "educators" section
This commit is contained in:
Tom Ball
2016-06-14 11:49:58 -04:00
parent a6e6dd8287
commit f4eca66648
184 changed files with 8 additions and 8 deletions

View File

@ -1,43 +0,0 @@
# counter activity
Display a number with a variable.
### ~avatar avatar
Welcome! This tutorial will teach you how to make a counter that increments when button A is pressed. Let's get started!
### ~
Let's start by creating a **local variable** `count` to keep track of the current count.
```blocks
let count = 0
```
The code under ``on button pressed("A")`` will run each time the user presses A. Let's add a line of code that increments `count` by `1`.
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
})
```
Since the count has changed, it's time to refresh the screen display. Let's add a line of code to display the count on screen.
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count)
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/counter/challenges)
### ~

View File

@ -1,37 +0,0 @@
# 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`.

View File

@ -1,54 +0,0 @@
# counter quiz answers
Learn how to create a counter with the BBC micro:bit button.
This is the answer key for the [counter quiz](/lessons/counter/quiz).
## 1. What is a variable?
Answers may vary but a variable is a place where you can store and retrieve data
## 2. Draw the stored value for the variable called count
```blocks
let count = 0
```
![](/static/mb/lessons/counter-0.png)
We create a **variable**, `count` to keep track of the current count. The number 0 is stored into memory of the variable.
<br/>
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count)
})
```
![](/static/mb/lessons/counter-1.png)
We are only pressing on button pressed once. So the number to display on the micro:bit is also one.
<br/>
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
```blocks
let count = 0
input.onButtonPressed(Button.A, () => {
count = + 1
basic.showNumber(count)
})
```
![](/static/mb/lessons/counter-2.png)
We included the code ``on button pressed("A")`` that runs each time the user presses A. The code increments `count` by `1`. We increase `count` by 1 whenever the user presses the button. So the third time the A button is pressed on the BBC micro:bit, the number 3 is displayed
<br/>

View File

@ -1,54 +0,0 @@
# counter quiz
Learn how to create a counter with the BBC micro:bit button.
## Name
## Directions
Use this activity document to guide your work in the [counter tutorial](/lessons/counter/activity).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is a variable?
<br/>
## 2. Draw the stored value for the variable called count
```blocks
let count = 0
```
![](/static/mb/empty-microbit.png)
<br/>
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
```blocks
let counts = 0
input.onButtonPressed(Button.A, () => {
counts = counts + 1
basic.showNumber(counts, 150)
})
```
![](/static/mb/empty-microbit.png)
<br/>
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
```blocks
let counting= 0
input.onButtonPressed(Button.A, () => {
counting = counting + 1
basic.showNumber(counting, 100)
})
```
![](/static/mb/empty-microbit.png)
<br/>