Migrate docs from the other repo

This commit is contained in:
Michal Moskal
2016-03-25 16:47:20 -07:00
parent 38d2cf06d2
commit a08eb53f92
895 changed files with 36888 additions and 0 deletions

View File

@ -0,0 +1,45 @@
# counter activity
Display a number with a variable.
### ~avatar avatar
### @video td/videos/counter-0
Welcome! This tutorial will teach you how to make a counter that increments when button A is pressed. Let's get started!
### ~
To create a new script, go to the [Create Code](/microbit/create-code) page and tap *New Project* under **Touch Develop**.
Let's start by creating a **local variable** `count` to keep track of the current count.
```
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`.
```
let count_ = 0
input.onButtonPressed("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.
```
let count_1 = 0
input.onButtonPressed("A", () => {
count = count + 1
basic.showNumber(count, 150)
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/microbit/lessons/counter/challenges)!
### ~

View File

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

View File

@ -0,0 +1,91 @@
# counter lesson plan
Learn how to create a counter with with on button pressed.
### @video vimeo/134118661
## Topic
Variable - Counter
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to creating a **variable** to keep track of the current count. We will be learning how to create a counter app using global variables as well as simple commands, such as on button pressed, and show number.
## What the teacher needs to know
**Program:** A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.**
**Algorithm:** An unambiguous set of rules or a precise step-by-step guide to solve a problem or achieve a particular objective. The guided tutorial follows a algorithm and is a precise step-by-step guide to solve a problem**
**Loop:** A block of code repeated automatically under the programs control. ** The blink program introduces Forever. Forever will repeats code in the background forever.
**Command:** An instruction for the computer to execute, written in a particular programming language.**
**QuickStart Computing Glossary
## Documentation
* **variables**: [read more...](/microbit/reference/variables/var)
* **on button pressed** : [read more...](/microbit/reference/input/on-button-pressed)
* **show number** : [read more...](/microbit/reference/basic/show-number)
## Resources
* Activity: [tutorial](/microbit/lessons/counter/tutorial)
* Activity: [quiz](/microbit/lessons/counter/quiz)
* Extended Activity: [challenges](/microbit/lessons/counter/challenges)
## Objectives
* learn how to create a variable
* learn how to blink a light
* learn how to repeat turning on and off the light
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### Data & Data Representation
* Understands the difference between data and information. (AB)
* Defines data types: real numbers and Boolean. (AB)
#### Information Technology
* Collects, organises and presents data and information in digital content. (AB)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution. (EV)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/microbit/lessons/counter/tutorial)
* [quiz](/microbit/lessons/counter/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/microbit/lessons/counter/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/microbit/lessons/counter/challenges)
## Intended follow on
Publish script to the classroom.

View File

@ -0,0 +1,54 @@
# counter quiz answers
Learn how to create a counter with the BBC micro:bit button.
This is the answer key for the [counter quiz](/microbit/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
```
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
```
let count_ = 0
input.onButtonPressed("A", () => {
count_ = count_ + 1
basic.showNumber(count, 150)
})
```
![](/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
```
count_ = 0
input.onButtonPressed("A", () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
})
```
![](/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

@ -0,0 +1,54 @@
# 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](/microbit/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
```
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
```
let count_ = 0
input.onButtonPressed("A", () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
})
```
![](/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
```
count_ = 0
input.onButtonPressed("A", () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
})
```
![](/static/mb/empty-microbit.png)
<br/>