pxt-calliope/olddocs/lessons/zoomer/challenges.md
Tom Ball f4eca66648 move lessons out of web site
will move select lessons back to "educators" section
2016-06-14 11:49:58 -04:00

956 B

zoomer blocks challenges

Coding challenges for zoomer.

Before we get started

Complete the following activity and your finished code should look like this:

basic.forever(() => {
    let az = input.acceleration(Dimension.Z)
    basic.showNumber(az)
})

Challenge 1

We'll modify the code to display the x acceleration if the A button is pressed. For that, we need to store acceleration (x) in a new variable ax and use a button (A) is pressed to detect if the button is pressed.

basic.forever(() => {
    let az = input.acceleration(Dimension.Z)
    let ax = input.acceleration(Dimension.X)
    if (input.buttonIsPressed(Button.A)) {
        basic.showNumber(ax)
    }
    basic.showNumber(az)
})
  • Run the code to see if it works as expected.

Challenge 2

Display the y acceleration when B is pressed by adding another if statement using button (B) is pressed.