updated lessons
This commit is contained in:
parent
d1bf09b084
commit
abed962eab
@ -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
|
||||
|
||||
## 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
|
||||
* [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
|
||||
|
@ -4,13 +4,9 @@ a game similar to "Simon Says" with the BBC micro:bit. #docs
|
||||
|
||||
## 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)
|
||||
|
||||
At the end of the tutorial, click `keep editing`. Your code should look like this:
|
||||
|
||||
```
|
||||
```blocks
|
||||
newAction() // ***
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
if (action == 0) {
|
||||
@ -21,27 +17,27 @@ input.onButtonPressed(Button.A, () => {
|
||||
input.onLogoDown(() => {
|
||||
if (action == 1) {
|
||||
game.addScore(1) // ***
|
||||
newAction() // ***
|
||||
newAction()
|
||||
}
|
||||
}) // ***
|
||||
})
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
if (action == 2) {
|
||||
game.addScore(1) // ***
|
||||
newAction() // ***
|
||||
game.addScore(1)
|
||||
newAction()
|
||||
}
|
||||
}) // ***
|
||||
})
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showNumber(game.score(), 150) // ***
|
||||
basic.pause(2000) // ***
|
||||
newAction() // ***
|
||||
}) // ***
|
||||
})
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
```
|
||||
```blocks
|
||||
/**
|
||||
* {highlight}
|
||||
*/
|
@ -4,13 +4,9 @@ Coding challenges for the offset image tutorial. #docs
|
||||
|
||||
## 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)
|
||||
|
||||
At the end of the tutorial, click `keep editing`. Your code should look like this:
|
||||
|
||||
```
|
||||
```blocks
|
||||
offset = 0
|
||||
basic.forever(() => {
|
||||
if (offset == -4) {
|
@ -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
|
||||
|
||||
* [tutorial](/microbit/lessons/prank-wifi/tutorial)
|
||||
* [activity](/microbit/lessons/prank-wifi/activity)
|
||||
* [quiz](/microbit/lessons/prank-wifi/quiz)
|
||||
* [challenges](/microbit/lessons/prank-wifi/challenges)
|
||||
|
@ -4,13 +4,9 @@ create a fake wifi app to trick your friends. #docs
|
||||
|
||||
## 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)
|
||||
|
||||
At the end of the tutorial, click `keep editing`. Your code should look like this:
|
||||
|
||||
```
|
||||
```blocks
|
||||
basic.showString("Check Wifi", 150)
|
||||
basic.forever(() => {
|
||||
let xAccel = math.abs(input.acceleration("x"))
|
||||
@ -18,7 +14,7 @@ basic.forever(() => {
|
||||
let zAccel = math.abs(input.acceleration("z"))
|
||||
let sum = xAccel + yAccel + zAccel
|
||||
if (sum < 1400) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
@ -26,7 +22,7 @@ basic.forever(() => {
|
||||
# # # . .
|
||||
`)
|
||||
} else if (sum >= 1400 && sum < 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . # .
|
||||
. . # # .
|
||||
@ -35,7 +31,7 @@ basic.forever(() => {
|
||||
`)
|
||||
}
|
||||
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`.
|
||||
|
||||
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.forever(() => {
|
||||
let xAccel1 = math.abs(input.acceleration("x"))
|
||||
@ -64,7 +58,7 @@ basic.forever(() => {
|
||||
let zAccel1 = math.abs(input.acceleration("z"))
|
||||
let sum1 = xAccel1 + yAccel1 + zAccel1
|
||||
if (sum1 < 1200) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
@ -72,7 +66,7 @@ basic.forever(() => {
|
||||
# # # . .
|
||||
`)
|
||||
} else if (sum1 >= 1400 && sum1 < 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . # .
|
||||
. . # # .
|
||||
@ -81,7 +75,7 @@ basic.forever(() => {
|
||||
`)
|
||||
}
|
||||
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`
|
||||
|
||||
```
|
||||
```blocks
|
||||
basic.showString("Check Wifi", 150)
|
||||
basic.forever(() => {
|
||||
let xAccel2 = math.abs(input.acceleration("x"))
|
||||
@ -104,7 +98,7 @@ basic.forever(() => {
|
||||
let zAccel2 = math.abs(input.acceleration("z"))
|
||||
let sum2 = xAccel2 + yAccel2 + zAccel2
|
||||
if (sum2 < 1200) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
@ -112,7 +106,7 @@ basic.forever(() => {
|
||||
# # # . .
|
||||
`)
|
||||
} else if (sum2 >= 1400 && sum2 < 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . # .
|
||||
. . # # .
|
||||
@ -121,7 +115,7 @@ basic.forever(() => {
|
||||
`)
|
||||
}
|
||||
else if (sum2 >= 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
@ -130,7 +124,7 @@ basic.forever(() => {
|
||||
`)
|
||||
}
|
||||
if (sum2 >= 1200 && sum2 < 1400) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . #
|
||||
. . . # #
|
||||
. . # # #
|
@ -14,7 +14,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
```blocks
|
||||
let xAccel = math.abs(input.acceleration("x"))
|
||||
let yAccel = math.abs(input.acceleration("y"))
|
||||
let zAccel = math.abs(input.acceleration("z"))
|
||||
@ -28,7 +28,7 @@ let zAccel = math.abs(input.acceleration("z"))
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
```blocks
|
||||
let sum = xAccel + yAccel + zAccel
|
||||
```
|
||||
|
||||
@ -38,9 +38,9 @@ let sum = xAccel + yAccel + zAccel
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
```blocks
|
||||
if (sum < 1400) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . # . .
|
||||
@ -58,9 +58,9 @@ if (sum < 1400) {
|
||||
|
||||
<br/>
|
||||
|
||||
```
|
||||
```blocks
|
||||
if (sum >= 1400 && sum < 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . # .
|
||||
. . # # .
|
||||
@ -80,7 +80,7 @@ if (sum >= 1400 && sum < 1680) {
|
||||
|
||||
```
|
||||
if (sum >= 1680) {
|
||||
basic.plotImage(`
|
||||
basic.showleds(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
Loading…
Reference in New Issue
Block a user