lessons to projects

This commit is contained in:
Tom Ball 2016-06-14 11:12:13 -04:00
parent 4657263abb
commit d94c7e0157
18 changed files with 13 additions and 462 deletions

View File

@ -1,21 +0,0 @@
# banana keyboard blocks lesson
display beautiful images on the BBC micro:bit.
## Topic
Music
## Quick Links
* [activity](/lessons/banana-keyboard/activity)
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a music player using pins P0 and GND, earphones (or speakers), as well as crocodile clips (or spring clips). The connect fruit using pins P1 and GND.
## Objectives
* learn how to setup the BBC micro:bit with earphones to play music
* learn how to setup the BBC micro:bit with fruit be the musical instrument

View File

@ -1,20 +0,0 @@
# hack your headphones lesson
display beautiful images on the BBC micro:bit.
## Topic
Hack your headphone
## Quick Links
* [activity](/lessons/hack-your-headphones/activity)
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a music player using pins P0 and GND, headphones (or speakers), as well as crocodile clips (or spring clips).
## Objectives
* learn how to setup the BBC micro:bit with headphones to play music

View File

@ -1,62 +0,0 @@
# rock paper scissors lesson
A game against the BBC micro:bit.
## Topic
Local Variables
## Quick Links
* [activity](/lessons/rock-paper-scissors/activity)
* [challenges](/lessons/rock-paper-scissors/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create a **local variable**, `var t :=time` where you can store data, so that you can use it in your code. We will be learning how to create a classic rock paper scissors game using global variables, input on shake, local variables, math random as well as simple commands such as create image, show image, show string, and show number.
## Documentation
```cards
input.onGesture(Gesture.Shake, () => {})
Math.random(3)
let x = 0
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
```
## Objectives
* learn how to create a condition so the micro:bit will run code when it is shaken
* learn how to create a local variable for a place where you can store data
* learn how to create an image to show on the micro:bit's LED screen
* learn how to show an image on the micro:bit's LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* 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)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Defines data types: real numbers and Boolean (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation

View File

@ -1,121 +0,0 @@
# rock paper scissors activity
A classic game against the micro:bit.
### ~avatar avatar
Welcome! This tutorial will help you create a game of rock paper scissors with the micro:bit. Let's get started!
### ~
We want the micro:bit to choose rock, paper, or scissors when it is shaken. Let's begin by creating an on shake condition so the micro:bit will run code when it is shaken.
```blocks
input.onGesture(Gesture.Shake, () => {
})
```
Next, create a variable and store pick random number from 0 to 2. On shake, a number will be randomly picked from 0-2. We will randomly display an image based on the random number returned.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(3)
})
```
The micro:bit will look like it's showing 1 frame of the image by displaying the whole image when pick random is equal to 2. We can help the micro:bit randomly decide which image to use by pick random. The micro:bit will randomly pick the image to display with show LEDs and the pick random function.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(3)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
}
})
```
The micro:bit will look like it's showing 1 frame of the image by displaying the whole image when pick random is equal to 1. We can help the micro:bit randomly decide which image to use by pick random. The micro:bit will randomly pick the image to display with show LEDs and the pick random function.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(3)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (img == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
}
})
```
The micro:bit will look like it's showing 1 frame of the image by displaying the whole image when pick random is not equal to 2 and not equal to 1. We can help the micro:bit randomly decide which image to use by pick random. The micro:bit will randomly pick the image to display with show LEDs and the pick random function.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(3)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (img == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
} else {
basic.showLeds(`
. . . # #
# # . # .
. . # . .
# # . # .
. . . # #
`)
}
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/rock-paper-scissors/challenges)!
### ~

View File

@ -1,133 +0,0 @@
# rock paper scissors challenges
Coding challenges for rock paper scissors.
## Before we get started
Complete the following [guided activity](/lessons/rock-paper-scissors/activity) , your code should look like this:
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(3)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (img == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
} else {
basic.showLeds(`
. . . # #
# # . # .
. . # . .
# # . # .
. . . # #
`)
}
})
```
### Challenge 1
When the A button is pressed, increment the score by 1. You can select Game drawer then add change score by 1.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(2)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (img == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
} else {
basic.showLeds(`
. . . # #
# # . # .
. . # . .
# # . # .
. . . # #
`)
}
})
input.onButtonPressed(Button.A, () => {
game.addScore(1)
})
```
* Click *run* to execute your code in the simulator
### Challenge 2
After incrementing the score, display the total number of wins you have.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = Math.random(2)
if (img == 2) {
basic.showLeds(`
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
`)
} else if (img == 1) {
basic.showLeds(`
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
`)
} else {
basic.showLeds(`
. . . # #
# # . # .
. . # . .
# # . # .
. . . # #
`)
}
})
input.onButtonPressed(Button.A, () => {
game.addScore(1)
basic.showString("WINS:")
basic.showNumber(game.score())
})
```
* Run and compile the code to see if it works as expected.
### Challenge 3
You have successfully tracked and displayed the number of wins on the micro:bit! However, what about losses? Use the Game drawer to change score by -1 when button `B` is pressed.
* Run and compile the code to see if it works as expected.

View File

@ -1,74 +0,0 @@
# rock paper scissors quiz
shift an image horizontally across the display with offset.
## Name
## Directions
Use this activity document to guide your work in the [rock paper scissors tutorial](/lessons/rock-paper-scissors/activity).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Describe what `offset` does?
<br/>
## 2. Draw which LEDs are ON after running this code and the random number returned is 0
```blocks
let img = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . # # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
let offset = Math.random(3) * 5
img.showImage(offset)
```
![](/static/mb/lessons/night-light-2.png)
<br/>
<br/>
## 3. Draw which LEDs are ON after running this code with an offset of 5. This would occur if the random number returned is 1.
```blocks
let img_ = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . # # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
let offset_ = Math.random(3) * 5
img.showImage(offset)
```
![](/static/mb/lessons/night-light-2.png)
<br/>
<br/>
## 4. Draw which LEDs are ON after running this code with an offset of 10. This would occur if the random number returned is 2.
```blocks
let img_1 = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . # # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
let offset_1 = Math.random(3) * 5
img.showImage(offset)
```
![](/static/mb/lessons/night-light-2.png)
<br/>

View File

@ -1,24 +0,0 @@
# telegraph lesson
display beautiful images on the BBC micro:bit.
## Topic
Telegraph
## Quick Links
* [activity](/lessons/telegraph/activity)
* [challenges](/lessons/telegraph/challenges)
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a telegraph using a second BBC micro:bit as well as pin P1, P2, 3V, GND,
and crocodile clips (or spring clips). The connect BBC micro:bit uses pins P1, P2, 3V, GND.
## Objectives
* learn how to setup the BBC micro:bit with crocodile clips
* learn how to telegraph to another BBC micro:bit

View File

@ -22,11 +22,11 @@
![](/static/mb/projects/a5-compass.png)
## [Hack your headphones](/lessons/hack-your-headphones/activity)
## [Hack your headphones](/projects/hack-your-headphones)
![](/static/mb/projects/a6-music.png)
## [Banana keyboard](/lessons/banana-keyboard/activity)
## [Banana keyboard](/projects/banana-keyboard)
![](/static/mb/projects/a7-conductive.png)

View File

@ -95,6 +95,6 @@ Tap your banana instrument to play sound against... the fruit!
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/banana-keyboard/challenges)!
Excellent, you're ready to continue with the [challenges](/banana-keyboard-challenges)!
### ~

View File

@ -1,4 +1,4 @@
# compass activity
# compass
![](/static/mb/projects/a5-compass.png)

View File

@ -1,3 +1,5 @@
# flashing heart
![](/static/mb/projects/a1-display.png)
Use the LEDs to display a flashing heart.

View File

@ -1,4 +1,4 @@
# hack your headphones activity
# hack your headphones
Hack your headphones

View File

@ -1,3 +1,5 @@
# love meter
![](/static/mb/projects/a3-pins.png)
Use pins P0, P1 and P2 to change the display by creating a circuit with your body.

View File

@ -1,3 +1,5 @@
# smiley buttons
![](/static/mb/projects/a2-buttons.png)
Use buttons to show a smiley or frowny face.

View File

@ -70,6 +70,6 @@ Using the 4th crocodile clip, connect the unattached end of the crocodile clip o
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/telegraph/challenges)!
Excellent, you're ready to continue with the [challenges](/projects/telegraph-challenges)!
### ~

View File

@ -1,6 +1,6 @@
![](/static/mb/projects/a10-watch.png)
# micro:bit watch
# the watch
![](/static/mb/lessons/the-watch-0.png)