updated lessons

This commit is contained in:
Michael Elliot Braun 2016-03-30 17:15:42 -07:00
parent d1bf09b084
commit abed962eab
11 changed files with 36 additions and 49 deletions

View File

@ -59,6 +59,7 @@ Overview of lessons for the BBC micro:bit.
* [Telegraph](/microbit/lessons/telegraph), play the telegraph game between two BBC micro:bits * [Telegraph](/microbit/lessons/telegraph), play the telegraph game between two BBC micro:bits
## Advanced ## Advanced
* [Prank WiFi](/microbit/lessons/prank-wifi), create fake WiFi to trick your friends
* [Speed Button](/microbit/lessons/speed-button), code a speed game with running time * [Speed Button](/microbit/lessons/speed-button), code a speed game with running time
* [Headbands](/microbit/lessons/headbands), create a charades game with a collection of strings that hold the words * [Headbands](/microbit/lessons/headbands), create a charades game with a collection of strings that hold the words
* [Hero](/microbit/lessons/hero), reconstruct the classic arcade game pac man with the BBC micro:bit * [Hero](/microbit/lessons/hero), reconstruct the classic arcade game pac man with the BBC micro:bit

View File

@ -4,13 +4,9 @@ a game similar to "Simon Says" with the BBC micro:bit. #docs
## Before we get started ## Before we get started
Complete the following guided tutorial: Complete the following guided tutorial. Your code should look like this:
* [tutorial](/microbit/lessons/bop-it/tutorial) ```blocks
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
newAction() // *** newAction() // ***
input.onButtonPressed(Button.A, () => { input.onButtonPressed(Button.A, () => {
if (action == 0) { if (action == 0) {
@ -21,27 +17,27 @@ input.onButtonPressed(Button.A, () => {
input.onLogoDown(() => { input.onLogoDown(() => {
if (action == 1) { if (action == 1) {
game.addScore(1) // *** game.addScore(1) // ***
newAction() // *** newAction()
} }
}) // *** })
input.onGesture(Gesture.Shake, () => { input.onGesture(Gesture.Shake, () => {
if (action == 2) { if (action == 2) {
game.addScore(1) // *** game.addScore(1)
newAction() // *** newAction()
} }
}) // *** })
input.onButtonPressed(Button.B, () => { input.onButtonPressed(Button.B, () => {
basic.showNumber(game.score(), 150) // *** basic.showNumber(game.score(), 150) // ***
basic.pause(2000) // *** basic.pause(2000) // ***
newAction() // *** newAction() // ***
}) // *** })
``` ```
### Challenge 1 ### Challenge 1
Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`. Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0. Now let's add some more types of instructions for the player to follow. Let's add `PRESS PIN 0`. Change the global variable `action` to `math->random(4)` so that we can add a new **IF** statement that checks if `action=3`. If it does, display instructions to press pin 0.
``` ```blocks
/** /**
* {highlight} * {highlight}
*/ */

View File

@ -4,13 +4,9 @@ Coding challenges for the offset image tutorial. #docs
## Before we get started ## Before we get started
Complete the following guided tutorial: Complete the following exercise. Your code should look like this:
* [tutorial](/microbit/lessons/offset-image/tutorial) ```blocks
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
offset = 0 offset = 0
basic.forever(() => { basic.forever(() => {
if (offset == -4) { if (offset == -4) {

View File

@ -4,6 +4,6 @@ create a fake wifi app to trick your friends #abs #acceleration #if #math #plot
create a fake wifi app to trick your friends create a fake wifi app to trick your friends
* [tutorial](/microbit/lessons/prank-wifi/tutorial) * [activity](/microbit/lessons/prank-wifi/activity)
* [quiz](/microbit/lessons/prank-wifi/quiz) * [quiz](/microbit/lessons/prank-wifi/quiz)
* [challenges](/microbit/lessons/prank-wifi/challenges)

View File

@ -4,13 +4,9 @@ create a fake wifi app to trick your friends. #docs
## Before we get started ## Before we get started
Complete the following guided tutorial: Complete the following exercise. Your code should look like this:
* [tutorial](/microbit/lessons/prank-wifi/tutorial) ```blocks
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.showString("Check Wifi", 150) basic.showString("Check Wifi", 150)
basic.forever(() => { basic.forever(() => {
let xAccel = math.abs(input.acceleration("x")) let xAccel = math.abs(input.acceleration("x"))
@ -18,7 +14,7 @@ basic.forever(() => {
let zAccel = math.abs(input.acceleration("z")) let zAccel = math.abs(input.acceleration("z"))
let sum = xAccel + yAccel + zAccel let sum = xAccel + yAccel + zAccel
if (sum < 1400) { if (sum < 1400) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . # . . . . # . .
@ -26,7 +22,7 @@ basic.forever(() => {
# # # . . # # # . .
`) `)
} else if (sum >= 1400 && sum < 1680) { } else if (sum >= 1400 && sum < 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . # . . . . # .
. . # # . . . # # .
@ -35,7 +31,7 @@ basic.forever(() => {
`) `)
} }
else if (sum >= 1680) { else if (sum >= 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
@ -52,11 +48,9 @@ What if wanted to show the maximum connectivity of wifi instead of just 1, 3, or
Let's start by changing the first **IF** statement to `if sum <1200`. Let's start by changing the first **IF** statement to `if sum <1200`.
Edit this line: **if** sum <1400 **then** Edit this line: if sum is greater than 1400 then just click on the `1400` and backspace until you can add your own number of `1200`.
Just click on the `1400` and backspace until you can add your own number of `1200`. ```blocks
```
basic.showString("Check Wifi", 150) basic.showString("Check Wifi", 150)
basic.forever(() => { basic.forever(() => {
let xAccel1 = math.abs(input.acceleration("x")) let xAccel1 = math.abs(input.acceleration("x"))
@ -64,7 +58,7 @@ basic.forever(() => {
let zAccel1 = math.abs(input.acceleration("z")) let zAccel1 = math.abs(input.acceleration("z"))
let sum1 = xAccel1 + yAccel1 + zAccel1 let sum1 = xAccel1 + yAccel1 + zAccel1
if (sum1 < 1200) { if (sum1 < 1200) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . # . . . . # . .
@ -72,7 +66,7 @@ basic.forever(() => {
# # # . . # # # . .
`) `)
} else if (sum1 >= 1400 && sum1 < 1680) { } else if (sum1 >= 1400 && sum1 < 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . # . . . . # .
. . # # . . . # # .
@ -81,7 +75,7 @@ basic.forever(() => {
`) `)
} }
else if (sum1 >= 1680) { else if (sum1 >= 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
@ -96,7 +90,7 @@ basic.forever(() => {
Let's add an **IF** at the bottom of your code that checks to see if `sum >= to 1200` **and** if `sum <1400` Let's add an **IF** at the bottom of your code that checks to see if `sum >= to 1200` **and** if `sum <1400`
``` ```blocks
basic.showString("Check Wifi", 150) basic.showString("Check Wifi", 150)
basic.forever(() => { basic.forever(() => {
let xAccel2 = math.abs(input.acceleration("x")) let xAccel2 = math.abs(input.acceleration("x"))
@ -104,7 +98,7 @@ basic.forever(() => {
let zAccel2 = math.abs(input.acceleration("z")) let zAccel2 = math.abs(input.acceleration("z"))
let sum2 = xAccel2 + yAccel2 + zAccel2 let sum2 = xAccel2 + yAccel2 + zAccel2
if (sum2 < 1200) { if (sum2 < 1200) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . # . . . . # . .
@ -112,7 +106,7 @@ basic.forever(() => {
# # # . . # # # . .
`) `)
} else if (sum2 >= 1400 && sum2 < 1680) { } else if (sum2 >= 1400 && sum2 < 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . # . . . . # .
. . # # . . . # # .
@ -121,7 +115,7 @@ basic.forever(() => {
`) `)
} }
else if (sum2 >= 1680) { else if (sum2 >= 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
@ -130,7 +124,7 @@ basic.forever(() => {
`) `)
} }
if (sum2 >= 1200 && sum2 < 1400) { if (sum2 >= 1200 && sum2 < 1400) {
basic.plotImage(` basic.showleds(`
. . . . # . . . . #
. . . # # . . . # #
. . # # # . . # # #

View File

@ -14,7 +14,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br/> <br/>
``` ```blocks
let xAccel = math.abs(input.acceleration("x")) let xAccel = math.abs(input.acceleration("x"))
let yAccel = math.abs(input.acceleration("y")) let yAccel = math.abs(input.acceleration("y"))
let zAccel = math.abs(input.acceleration("z")) let zAccel = math.abs(input.acceleration("z"))
@ -28,7 +28,7 @@ let zAccel = math.abs(input.acceleration("z"))
<br/> <br/>
``` ```blocks
let sum = xAccel + yAccel + zAccel let sum = xAccel + yAccel + zAccel
``` ```
@ -38,9 +38,9 @@ let sum = xAccel + yAccel + zAccel
<br/> <br/>
``` ```blocks
if (sum < 1400) { if (sum < 1400) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . # . . . . # . .
@ -58,9 +58,9 @@ if (sum < 1400) {
<br/> <br/>
``` ```blocks
if (sum >= 1400 && sum < 1680) { if (sum >= 1400 && sum < 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . # . . . . # .
. . # # . . . # # .
@ -80,7 +80,7 @@ if (sum >= 1400 && sum < 1680) {
``` ```
if (sum >= 1680) { if (sum >= 1680) {
basic.plotImage(` basic.showleds(`
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .