This commit is contained in:
Michael Elliot Braun 2016-03-31 17:17:22 -07:00
Родитель 34c5a5e216
Коммит 691da3605f
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -13,14 +13,14 @@ Welcome! This activity will teach how to use the 1st micro:bit to chart the seco
Let's measure `acceleration (mg)` and then `send number`. `Acceleration` is measured in **milli-gravities**, so a value of -1000 is equivalent to -1g or -9.81m/s^2. We will be able to get the acceleration value (g-force), in the specified "x" dimension. `Send number` will broadcast a number data packet to other micro:bits connected via radio.
```blocks
radio.sendNumber(input.acceleration(Dimension.X))
radio.sendNumber(input.acceleration(Dimension.X));
```
We want to display the acceleration forever. In order to do so, we need a `forever` loop. A forever loop will repeat code in the background forever.
```blocks
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
radio.sendNumber(input.acceleration(Dimension.X));
})
```

Просмотреть файл

@ -6,4 +6,4 @@ create a fake wifi app to trick your friends
* [activity](/microbit/lessons/prank-wifi/activity)
* [quiz](/microbit/lessons/prank-wifi/quiz)
* [quiz](/microbit/lessons/prank-wifi/quiz-answers)
* [quiz answers](/microbit/lessons/prank-wifi/quiz-answers)

Просмотреть файл

@ -47,7 +47,7 @@ let yAccel = Math.abs(input.acceleration(Dimension.Y))
let zAccel = Math.abs(input.acceleration(Dimension.Z))
let sum = xAccel + yAccel + zAccel
if (sum < 1400) {
basic.showleds(`
basic.showLeds(`
. . . . .
. . . . .
. . # . .
@ -71,7 +71,7 @@ let yAccel = Math.abs(input.acceleration(Dimension.Y))
let zAccel = Math.abs(input.acceleration(Dimension.Z))
let sum = xAccel + yAccel + zAccel
if (sum >= 1400 && sum < 1680) {
basic.showleds(`
basic.showLeds(`
. . . . .
. . . # .
. . # # .
@ -95,7 +95,7 @@ let yAccel = Math.abs(input.acceleration(Dimension.Y))
let zAccel = Math.abs(input.acceleration(Dimension.Z))
let sum = xAccel + yAccel + zAccel
if (sum >= 1680) {
basic.showleds(`
basic.showLeds(`
. . . . .
. . . . .
. . . . .