pxt-calliope/docs/lessons/charting.md

40 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# charting lesson
2016-04-25 21:33:11 +02:00
Create a charting app for simulating and measuring the acceleration applied to the micro:bit
2016-03-26 00:47:20 +01:00
## Topic
Acceleration
## Quick Links
2016-04-25 23:42:47 +02:00
* [Graphing Temperature](/lessons/chartingtemperature)
2016-04-26 00:16:01 +02:00
* [Graphing Acceleration](/lessons/charting/acceleration)
2016-04-25 23:42:47 +02:00
* [Graphing Light Level](/lessons/charting/light-level)
* [Graphing Rotation](/lessons/charting/rotation)
* [Graphing Magnetic Force](/lessons/charting/magnetic-force)
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn the functions of **on data received**, **send number** and **receive number** and chart `plot bar graph` for `acceleration` in the "x" dimension.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
2016-03-30 00:59:00 +02:00
basic.showNumber(0)
input.acceleration(Dimension.X)
led.plotBarGraph(0, 1023)
2016-04-05 07:33:13 +02:00
radio.onDataReceived(() => {})
2016-03-30 00:59:00 +02:00
radio.sendNumber(0)
radio.receiveNumber()
```
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 to get the acceleration value (g-force), in one of three specified dimensions
* learn how to display a vertical bar graph based on the value and high value.
* learn how to register code to run when a packet is received over radio
* learn how to broadcast a number data packet to other micro:bits connected via radio
* learn how to read the next radio packet as a number data packet