pxt-calliope/olddocs/lessons/zoomer.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

1.2 KiB

zoomer blocks lesson

measure the acceleration on the micro:bit in the "z" direction.

Topic

Acceleration

Prior learning/place of lesson in scheme of work

Learn how to get the acceleration, acceleration in one of three specified dimensions. We will be learning how to get the acceleration using a forever loop, local variables, input on button pressed, as well as simple commands, such as show number and pause.

Documentation

basic.forever(() => {
})
let x = 0
input.acceleration(Dimension.X)
if (true) {
}
input.buttonIsPressed(Button.A)
basic.showNumber(0)

Objectives

  • learn how to repeat code in the background forever
  • learn how to create a variable to store data
  • learn how to get the acceleration value (g-force), in one of three specified dimensions
  • learn how to pause your code for the specified number of milliseconds
  • learn how to conditionally run code depending on whether a condition is true or not
  • learn how to get the state of an input button
  • learn how to show a number on the LED screen