pxt-calliope/olddocs/lessons/glowing-pendulum/challenges.md

37 lines
1.0 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# glowing pendulum blocks challenges
Coding challenges for the glowing pendulum tutorial.
## Before we get started
2016-04-13 17:27:45 +02:00
Complete the following [glowing pendulum activity](/lessons/glowing-pendulum/activity) and your code should look like this:
2016-03-26 00:47:20 +01:00
2016-04-25 20:31:06 +02:00
```blocks
basic.forever(() => {
let acceleration = input.acceleration(Dimension.Y);
acceleration = Math.abs(acceleration);
acceleration = acceleration / 4;
led.setBrightness(acceleration)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
});
```
2016-03-26 00:47:20 +01:00
2016-05-06 18:28:26 +02:00
### Challenge 1
2016-03-26 00:47:20 +01:00
![](/static/mb/lessons/glowing-pendulum-0.jpg)
Hold the micro:bit in your hand in a dark room. Move the micro:bit like a pendulum and produce a slow image that captures the pattern of the micro:bit LEDs.
2016-05-06 18:28:26 +02:00
### Challenge 2
2016-03-26 00:47:20 +01:00
Replace "y" in `acceleration(y)` with "x" or "z". Changing the axis will cause the micro:bit to measure the force in a different direction. What differences in the resulting pattern does this replacement make?