pxt-calliope/docs/lessons/glowing-pendulum.md

46 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# glowing pendulum blocks lesson
2016-04-02 01:22:47 +02:00
construct a pendulum that glows using acceleration.
2016-03-26 00:47:20 +01:00
## Topic
Acceleration
## Quick Links
* [activity](/microbit/lessons/glowing-pendulum/activity)
* [challenges](/microbit/lessons/glowing-pendulum/challenges)
2016-03-31 01:25:19 +02:00
* [quiz](/microbit/lessons/glowing-pendulum/quiz)
* [quiz answers](/microbit/lessons/glowing-pendulum/quiz-answers)
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn how to get the acceleration **acceleration**, `acceleration` value (g-force), in one of three specified dimensions. We will be learning how to get the acceleration using forever loop, a local variable, acceleration, the math library, as well as simple commands, such as led set brightness and led plot all.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
basic.forever(() => {})
2016-03-30 00:59:00 +02:00
let x = 0
input.acceleration(Dimension.X)
Math.abs(0)
led.setBrightness(255)
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
```
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
## Objectives
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
* learn how to repeat code in the background forever
* learn how create a local variable to store data, so that you can use it in your code
* learn how to get the acceleration value (g-force), in one of three specified dimensions
* learn how to return the absolute value
* learn how to sets the brightness of the LED screen
* learn how to turn on all the LED lights on the LED screen
2016-03-26 00:47:20 +01:00