updated lessons

This commit is contained in:
Michael Elliot Braun
2016-03-30 15:11:05 -07:00
parent f00491df52
commit 1e77491b16
22 changed files with 422 additions and 159 deletions

View File

@ -0,0 +1,49 @@
# catch the egg game lesson
a game to catch eggs in a basket #var #data #if #random #min #max #mod #plot #unplot #pause #accceleration #docs
### @video td/videos/catch-the-egg-game-0
## Topic
Variables
## Quick Links
* [quiz](/microbit/lessons/catch-the-egg-game/quiz)
* [quiz answers](/microbit/lessons/catch-the-egg-game/quiz-answers)
* [challenges](/microbit/lessons/catch-the-egg-game/challenges)
## Prior learning/place of lesson in scheme of work
Learn how to create a catch the egg game game with **plot**, `led->plot` , **unplot**, `led->unplot`, and **acceleration** `input -> acceleration` to turn on and off LED lights on the LED screen. We will be learning how to create a catch the egg game app using global variables, forever loop, local variable, input acceleration, math min, math max, math random, math mod, if (conditionals), game library as well as simple commands, such as led plot, led unplot, and pause.
## Documentation
* **variables** : [read more...](/microbit/reference/variables/var)
* **forever** : [read more...](/microbit/reference/basic/forever)
* **unplot** : [read more...](/microbit/reference/led/unplot)
* **plot** : [read more...](/microbit/reference/led/plot)
* **if** : [read more...](/microbit/reference/logic/if)
* **acceleration** : [read more...](/microbit/reference/input/acceleration)
* **math minimum number** : [read more...](/microbit/js/math)
* **math maximum number** : [read more...](/microbit/js/math)
* **math random number** : [read more...](/microbit/js/math)
* **math modulus** : [read more...](/microbit/js/math)
* **show number** : [read more...](/microbit/reference/basic/show-number)
* **pause** : [read more...](/microbit/reference/basic/pause)
## Objectives
* learn how to create a global variable as a place where you can store data so that you can use it later in your code, accessible across functions and in nested code blocks
* learn how to repeat code in the background forever
* learn how to turn off a LED light on the LED screen
* learn how to turn on a LED light on the LED screen
* learn how to learn how to conditionally run code depending on whether a condition is true or not
* learn how to learn how to get the acceleration value (g-force), in one of three specified dimensions
* learn how to return the smaller of two numbers
* learn how to return the larger of two numbers
* learn how to return a random number
* learn how to return the modulus
* learn how to show a number of the BBC micro:bit screen
* learn how to pause your code for the specified number of milliseconds

View File

@ -0,0 +1,160 @@
# catch the egg game challenges
Coding challenges for catch the egg game.
## Before we get started
Your starting code should look like this:
```blocks
let basketX = 2
let eggX = 2
let eggY = 0
basic.forever(() => {
led.unplot(basketX, 4)
led.unplot(eggX, eggY)
eggY = eggY + 1
led.plot(eggX, eggY)
basic.pause(300)
let accX = input.acceleration(Dimension.X)
basketX = 2 + Math.min(2, Math.max(-2, accX / 200))
led.plot(basketX, 4)
if (eggY > 4) {
eggY = -1
eggX = Math.random(5)
}
basic.pause(300)
})
```
### ~avatar avatar impressed
### Challenge 1
Let's start by adding the **game** library.
### ~
### ~avatar avatar improvised
### Challenge 2
Let's use an **IF** statement to detect if the egg and the basket are lined up.
Now that we know when an egg is caught, we can keep track of the score! We need to use the `add score` function built into the game library to add `1` point for every egg that is caught. However, let's not forget to `remove life` if an egg falls off the display before it's caught!
### ~
```blocks
let basketX1 = 2
let eggX1 = 2
let eggY1 = 0
basic.forever(() => {
led.unplot(basketX1, 4)
led.unplot(eggX1, eggY1)
eggY1 = eggY1 + 1
led.plot(eggX1, eggY1)
basic.pause(300)
let accX = input.acceleration(Dimension.X)
basketX1 = 2 + Math.min(2, Math.max(-2, accX / 200))
led.plot(basketX1, 4)
if (eggY1 > 4) {
eggY1 = -1
eggX1 = Math.random(5)
}
if (eggY1 == 4) {
if (basketX1 == eggX1) {
game.addScore(1) // ***
} else {
game.removeLife(1) // ***
}
}
basic.pause(300)
})
```
* Press the `run` button to test out your game.
### ~avatar avatar encourage
### Challenge 3
Catching eggs gets easier with practice so let's make the eggs fall faster every 5 catches. We can do this by tracking how long the egg pauses in each position while falling with a global variable called **falling pause**. Let's create this variable and set it to `300` initially. Don't forget to also create a condition that will be true every 5 catches.
### ~
```blocks
let basketX2 = 2
let eggX2 = 2
let eggY2 = 0
let fallingPause = 300 // ***
basic.forever(() => {
led.unplot(basketX2, 4)
led.unplot(eggX2, eggY2)
eggY2 = eggY2 + 1
led.plot(eggX2, eggY2)
basic.pause(300)
let accX2 = input.acceleration(Dimension.X)
basketX2 = 2 + Math.min(2, Math.max(-2, accX2 / 200))
led.plot(basketX2, 4)
if (eggY2 > 4) {
eggY2 = -1
eggX2 = Math.random(5)
}
if (eggY2 == 4) {
if (basketX2 == eggX2) {
game.addScore(1)
if (game.score() %5 == 0) {
}
} else {
game.removeLife(1)
}
}
basic.pause(300)
})
```
### ~avatar avatar surprised
### Challenge 4
### @video td/videos/catch-the-egg-game-4
Let's make the egg fall faster by decreasing the amount of time it pauses in each position by decreasing **falling pause** by `25` every 5 catches. Now, instead of pausing for 300 milliseconds we can pause for the value of **falling pause**.
```blocks
let basketX3 = 2
let eggX3 = 2
let eggY3 = 0
let fallingPause1 = 300
basic.forever(() => {
led.unplot(basketX3, 4)
led.unplot(eggX3, eggY3)
eggY3 = eggY3 + 1
led.plot(eggX3, eggY3)
basic.pause(300)
let accX3 = input.acceleration(Dimension.X)
basketX3 = 2 + Math.min(2, Math.max(-2, accX3 / 200))
led.plot(basketX3, 4)
if (eggY3 > 4) {
eggY3 = -1
eggX3 = Math.random(5)
}
if (eggY3 == 4) {
if (basketX3 == eggX3) {
game.addScore(1)
if (game.score()% 5 == 0) {
fallingPause1 = fallingPause1 - 25 // ***
}
} else {
game.removeLife(1)
}
}
basic.pause(fallingPause1) // ***
})
```
Fantastic! Your game is now ready to show off.
* Press the `run` button to see your finished game!

View File

@ -0,0 +1,58 @@
# catch the egg game quiz answers
Programming a game of catch the egg using the accelerometer
## Name
## Directions
Use this activity document to guide your work in the [catch the egg tutorial](/microbit/lessons/catch-the-egg-game/tutorial)
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Write the data type for the global variables 'basket' and 'egg'.
<br/>
'Basket' and 'egg' are stored as **Number**.
## 2. Write the code to plot the initial position of the egg and the basket using the variables 'egg x', 'egg y', and 'basket x'. The code should arrange the egg and basket as shown below.
![](/static/mb/lessons/catch-the-egg-game-0.png)
<br/>
```blocks
let basketX = 2
let eggX = 2
let eggY = 0
led.plot(eggX, eggY)
led.plot(basketX, 4)
```
## 3. Write the three lines of code that moves the egg down. (You need to unplot the egg's current position, update its position variables, and plot its new position.
<br/>
```blocks
let basketX = 2
let eggX = 2
let eggY = 0
led.unplot(eggX, eggY)
eggY = eggY + 1
led.plot(eggX, eggY)
```
## 4. . Write the code that resets the egg after it has fallen past the bottom of the BBC micro:bit.
<br/>
```blocks
let eggX = 2
let eggY = 0
if (eggY > 4) {
eggY = -1
eggX = Math.random(5)
}
```

View File

@ -0,0 +1,30 @@
# catch the egg game quiz
Programming a game of catch the egg using the accelerometer.
## Name
## Directions
Use this activity document to guide your work in the [catch the egg tutorial](/microbit/lessons/catch-the-egg-game/tutorial)
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Write the data type for the global variables 'basket' and 'egg'.
<br/>
## 2. Write the code to plot the initial position of the egg and the basket using the variables 'egg x', 'egg y', and 'basket x'. The code should arrange the egg and basket as shown below.
![](/static/mb/lessons/catch-the-egg-game-0.png)
<br/>
## 3. Write the three lines of code that moves the egg down. (You need to unplot the egg's current position, update its position variables, and plot its new position.
<br/>
## 4. Write the code that resets the egg after it has fallen past the bottom of the BBC micro:bit.
<br/>

View File

@ -26,6 +26,7 @@ let degrees = input.compassHeading()
```blocks
let degrees = input.compassHeading()
if (degrees < 45) {
basic.showString("N", 150)
}
@ -35,6 +36,7 @@ if (degrees < 45) {
```blocks
let degrees = input.compassHeading()
if (degrees < 135) {
basic.showString("E", 150)
}
@ -44,6 +46,7 @@ if (degrees < 135) {
```blocks
let degrees = input.compassHeading()
if (degrees < 225) {
basic.showString("S", 150)
}

View File

@ -23,10 +23,10 @@ We create a **variable**, `count` to keep track of the current count. The number
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
```blocks
let count_ = 0
let counts = 0
input.onButtonPressed(Button.A, () => {
count_ = count_ + 1
basic.showNumber(count, 150)
counts = counts + 1
basic.showNumber(counts, 150)
})
```
@ -39,10 +39,10 @@ We are only pressing on button pressed once. So the number to display on the mic
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
```blocks
count_ = 0
let counting= 0
input.onButtonPressed(Button.A, () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
counting = counting + 1
basic.showNumber(counting, 100)
})
```

View File

@ -27,10 +27,10 @@ let count = 0
## 3. Draw which LEDs are ON after running this code and pressing button "A" once. Explain you chose to draw that number
```blocks
let count_ = 0
let counts = 0
input.onButtonPressed(Button.A, () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
counts = counts + 1
basic.showNumber(counts, 150)
})
```
@ -41,10 +41,10 @@ input.onButtonPressed(Button.A, () => {
## 4. Draw which LEDs are ON after running this code and pressing button "A" three times. Explain you chose to draw that number
```blocks
count_ = 0
let counting= 0
input.onButtonPressed(Button.A, () => {
count_ = count_ + 1
basic.showNumber(count_, 100)
counting = counting + 1
basic.showNumber(counting, 100)
})
```

View File

@ -16,7 +16,7 @@ A loop that repeats code while a condition is true.
<br/>
```
```blocks
let count = 0
```
@ -26,7 +26,8 @@ let count = 0
<br/>
```
```blocks
let count = 0
while (count < 5) {
count = count + 1
}

View File

@ -22,7 +22,7 @@ When the micro:bit goes logo up, the code nested under the `on logo up` function
```blocks
input.onLogoUp(() => {
basic.showAnimation(`
basic.showLeds(`
. . # . .
. # # # .
# # # # #
@ -31,6 +31,7 @@ input.onLogoUp(() => {
`)
})
```
Run your code and try to turn around the micro:bit to see the **logo up** event in action!

View File

@ -8,7 +8,7 @@ Complete the [magic logo](/microbit/lessons/magic-logo/activity) activity and yo
```blocks
input.onLogoUp(() => {
basic.showAnimation(`
basic.showLeds(`
. . # . .
. # # # .
# # # # #
@ -28,7 +28,7 @@ How about when the logo is down? We should display an arrow pointing downward!
```blocks
input.onLogoUp(() => {
basic.showAnimation(`
basic.showLeds(`
. . # . .
. # # # .
# # # # #
@ -37,7 +37,7 @@ input.onLogoUp(() => {
`)
})
input.onLogoDown(() => {
basic.showAnimation(`
basic.showLeds(`
. . # . .
. . # . .
# # # # #

View File

@ -44,7 +44,7 @@ input.onLogoUp(() => {
```blocks
input.onLogoDown(() => {
basic.plotImage(`
basic.showLeds(`
. . # . .
. . # . .
# # # # #

View File

@ -4,34 +4,50 @@ Learn how to create a rotating image with a while loop. #image #loop #while #do
This is the answer key for the [rotation animation quiz](/microbit/lessons/rotation-animation/quiz).
## 1. What is a "global variable"?
## 1. What is a " variable"?
Answers may vary. A global variable is a place where you can store data so that you can use it later in your code.
Answers may vary. A variable is a place where you can store data so that you can use it later in your code.
## 2. Consider the following directions
## 2. Write the code to create a ** variable** called `foo` that stores a boolean and initialize it to **false**.
Write the code to create a **global variable** called `foo` that stores a boolean and initialize it to **false**.
```
rotating = true
```blocks
let rotating = true;
```
## 3. Consider the following code
## 3. Explain what this line of code does.
```
```blocks
let rotating = true;
while (rotating) {
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
}
```
Explain what this line of code does.
<br/>
It is a **while** loop that will be executed only if the **global variable** called `rotating` is **true**.
It is a **while** loop that will be executed only if the ** variable** called `rotating` is **true**.
## 4. Consider the following code
## 4. If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
```
```blocks
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
@ -41,7 +57,7 @@ basic.showAnimation(`
`, 400)
```
If the rectangle below represents the BBC micro:bit, shade the areas that will be displayed. Explain why that particular area is shaded.
![](/static/mb/lessons/rotation-animation-0.png)

View File

@ -10,26 +10,42 @@ Use this activity document to guide your work in the [rotation animation tutoria
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is a "global variable"?
## 1. What is a " variable"?
<br />
## 2. Write the code to create a global variable called foo that stores a boolean and initialize it to false.
## 2. Write the code to create a variable called foo that stores a boolean and initialize it to false.
<br/>
## 3. Explain why you use a while loop with a global variable
## 3. Explain why you use a while loop with a variable
```
```blocks
let rotating = true;
while (rotating) {
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
}
```
<br/>
## 4. Draw the areas on the micro:bits to illustrate the code below. Explain why you chose to draw in those areas.
```
```blocks
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .

View File

@ -13,14 +13,14 @@ Welcome! This tutorial will help you make a smiley face blink. Let's get started
Create an animation with an image displaying a smiley face and the next image with no LEDs lit up. This will make it look like the smiley face is blinking as the display switches between images.
```blocks
basic.showAnimation(`
basic.showLeds(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . . . .

View File

@ -8,14 +8,14 @@ Complete the [smiley activity](/microbit/lessons/smiley/activity) and your code
```blocks
basic.showAnimation(`
basic.showLeds(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . . . .
@ -33,14 +33,14 @@ Let's make add code that will run when button A is pressed!
```blocks
basic.showAnimation(`
basic.showLeds(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . . . .
@ -59,14 +59,14 @@ input.onButtonPressed(Button.A, () => {
Now, we want to show a frowny face when this button is pressed. Let's show the LEDs.
```blocks
basic.showAnimation(`
basic.showLeds(`
. # . # .
. # . # .
. . . . .
# . . . #
. # # # .
`)
basic.showAnimation(`
basic.showLeds(`
. . . . .
. . . . .
. . . . .
@ -74,7 +74,7 @@ basic.showAnimation(`
. . . . .
`)
input.onButtonPressed(Button.A, () => {
basic.showAnimation(`
basic.showLeds(`
. # . # .
. # . # .
. . . . .

View File

@ -51,7 +51,7 @@ basic.forever(() => {
. . # . .
`)
})
```blocks
```
Run your code in the simulator or download it to your BBC micro:bit to see what happens!

View File

@ -6,25 +6,59 @@ Coding challenges for snowflake fall.
Complete the [snowflake fall](/microbit/lessons/snowflake-fall/activity) activity and your code will look like this:
![](/static/mb/blocks/lessons/snowflake-fall-1.jpg)
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`)
basic.showLeds(`
. . # . .
. # . # .
# . . . #
. # . # .
. . # . .
`)
})
```
### Challenge 1
### @video td/videos/snowflake-fall-1
Let's begin creating our falling effect by adding another snowflake with `show LEDs` that displays a different snowflake pattern after the first one. We need 2 frames in the new animation that display both the first and the second snowflake images.
![](/static/mb/blocks/lessons/snowflake-fall-2.jpg)
* Run your program to see the cool animation.
### Challenge 2
### @video td/videos/snowflake-fall-2
To finalize our snowflake fall, let's add a different snowflake pattern.
![](/static/mb/blocks/lessons/snowflake-fall-3.jpg)
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`)
basic.showLeds(`
. . # . .
. # . # .
# . . . #
. # . # .
. . # . .
`)
basic.showLeds(`
. # . # .
# # # # #
. # . # .
# # # # #
. # . # .
`)
})
```
* Run your program and see if it works.

View File

@ -28,7 +28,24 @@ basic.forever(() => {
![](/static/mb/lessons/snowflake-fall-0.png)
![](/static/mb/blocks/lessons/snowflake-fall-5.png)
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`);
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
});
```
## 4. Write the code for a forever loop and show LEDS for these images!
@ -36,5 +53,21 @@ basic.forever(() => {
![](/static/mb/lessons/snowflake-fall-2.png)
![](/static/mb/blocks/lessons/snowflake-fall-6.png)
```blocks
basic.forever(() => {
basic.showLeds(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`);
basic.showLeds(`
# # # # #
# # . # #
# . # . #
# # . # #
# # # # #
`)
});
```

View File

@ -12,19 +12,95 @@ Welcome! This guided tutorial will teach how to program a script that randomly p
Let's begin by adding an `on shake` condition to know when the micro:bit is shaken.
![](/static/mb/blocks/lessons/spinner-0.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
})
```
Now let's randomly generate a number from 0 to 3 so that we can randomly display an arrow in a given direction.
![](/static/mb/blocks/lessons/spinner-1.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
if (randomArrow = 3) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
})
```
Now let's handle each of the cases by displaying the appropriate arrow. (Let's display an up arrow if `random arrow` is 0.
![](/static/mb/blocks/lessons/spinner-2.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
if (randomArrow = 3) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow = 2) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
})
```
Now let's handle the rest of the cases for `random arrow`.
![](/static/mb/blocks/lessons/spinner-3.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
if (randomArrow = 3) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow = 2) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
if (randomArrow = 1) {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
}
})
```
### ~avatar avatar

View File

@ -6,21 +6,164 @@ Create an arrow that randomly points to a player.
Complete the following [guided tutorial](/microbit/lessons/spinner/activity), your code should look like this:
![](/static/mb/blocks/lessons/spinner-3.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
if (randomArrow = 3) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow = 2) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
if (randomArrow = 1) {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
}
})
```
### Challenge 1
Modify the random number generator so that it can include new arrows we will create in the next challenge.
![](/static/mb/blocks/lessons/spinner-4.jpg)
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(8)
if (randomArrow = 3) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow = 2) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
if (randomArrow = 1) {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
}
})
```
* Do **not** run the code yet because it will not work until you have conditions for every random number.
### Challenge 2
Let's add four more arrows that point diagonally.
Let's add more arrows that point diagonally.
```blocks
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(8)
if (randomArrow = 7) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow = 6) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
if (randomArrow = 5) {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
}
if (randomArrow = 4) {
basic.showLeds(`
. . # . .
. . . # .
# # # # #
. . . # .
. . # . .
`)
}
if (randomArrow = 3) {
basic.showLeds(`
# # # # #
# # # # .
# # # # .
# . . # .
. . . . #
`)
}
if (randomArrow = 2) {
basic.showLeds(`
# # # # #
# # # # #
. . # # #
. # . # #
# . . . #
`)
}
if (randomArrow = 1) {
basic.showLeds(`
# . . . #
# # . # .
# # # . .
# # # # .
# # # # #
`)
}
})
```
![](/static/mb/blocks/lessons/spinner-5.jpg)
* Run your code to see if it works as expected

View File

@ -14,7 +14,7 @@ Write the line of code to measure the acceleration and then store in it a variab
<br/>
```
```blocks
let accX_ = input.acceleration("x")
```
@ -26,9 +26,9 @@ After storing the acceleration in a variable, write the code to show acceleratio
<br/>
```
```blocks
let accX = input.acceleration("x")
basic.showNumber(accX_, 150)
basic.showNumber(accX, 150)
```
Note: make sure the same variable name ("acc x" in this case) is the same in both lines of code..