2018-10-15 05:47:57 +02:00
# Plot Acceleration
2018-10-15 16:05:15 +02:00
The ``||led:plot bar graph||`` uses the screen to display the _magnitude_ (how big a number is whether it's positive or negative) of a value. This is a great tool to understand the data returned by sensors... like the accelerometer.
2018-10-15 05:47:57 +02:00
## Acceleration
2018-10-15 16:05:15 +02:00
This example plots acceleration in the ``x`` dimension on the LEDs.
2018-10-15 05:47:57 +02:00
```blocks
basic.forever(() => {
led.plotBarGraph(
input.acceleration(Dimension.X),
0
)
})
```
## Console
2018-10-15 16:05:15 +02:00
Click on the ``||Show Console||`` button to see a chart of the values plotted by the block over a period of time.
2018-10-15 05:47:57 +02:00
## Maximum value
If you specify the maximum value, the block can do a better job at displaying the data.
For example, we can tell the block that we don't expect values beyond 1000 mg.
```blocks
basic.forever(() => {
led.plotBarGraph(
input.acceleration(Dimension.X),
1000
)
})
```
## Other sensors
2018-10-15 16:05:15 +02:00
You can use this block for pretty much any kind of data. Try it out! Plot the light level as you play with the light sensor.
2018-10-15 05:47:57 +02:00
```blocks
basic.forever(() => {
led.plotBarGraph(
input.lightLevel(),
0
)
})
```