pxt-calliope/docs/lessons/charting.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# charting lesson
2016-11-01 17:44:37 -07:00
Create a charting app for simulating and measuring the acceleration applied to the @boardname@
2016-03-25 16:47:20 -07:00
## Topic
Acceleration
## Quick Links
* [activity](/lessons/charting/activity)
* [challenge](/lessons/charting/challenge)
* [quiz](/lessons/charting/quiz)
2016-04-28 11:47:59 -07:00
* [answers](/lessons/charting/quiz-answers)
2016-03-25 16:47:20 -07: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-04 22:33:13 -07:00
```cards
2016-03-29 15:59:00 -07:00
input.acceleration(Dimension.X)
led.plotBarGraph(0, 1023)
2016-04-25 15:26:49 -07:00
basic.showNumber(0)
radio.onDataPacketReceived(() => {})
2016-03-29 15:59:00 -07:00
radio.sendNumber(0)
```
2016-03-25 16:47:20 -07:00
2016-03-29 15:59:00 -07:00
## Objectives
2016-03-25 16:47:20 -07:00
2016-03-29 15:59:00 -07: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
2016-11-01 17:44:37 -07:00
* learn how to broadcast a number data packet to other @boardname@s connected via radio
2016-03-29 15:59:00 -07:00
* learn how to read the next radio packet as a number data packet
2017-03-15 15:54:40 -07:00
```package
radio
```