2018-09-12 21:12:19 -07:00
|
|
|
# Analog Pin Tester
|
2017-02-09 17:40:21 -08:00
|
|
|
|
2018-09-12 21:12:19 -07:00
|
|
|
Use this program to graph the analog values that are read from pin ``P0``.
|
2017-06-21 11:17:25 -07:00
|
|
|
Press ``A`` to scroll the value on the screen.
|
|
|
|
|
2017-02-09 17:40:21 -08:00
|
|
|
```blocks
|
2017-06-21 11:17:25 -07:00
|
|
|
let reading = 0
|
2017-02-09 17:40:21 -08:00
|
|
|
basic.forever(() => {
|
2017-06-21 11:17:25 -07:00
|
|
|
reading = pins.analogReadPin(AnalogPin.P0)
|
2017-02-09 17:40:21 -08:00
|
|
|
led.plotBarGraph(
|
2017-06-21 11:17:25 -07:00
|
|
|
reading,
|
2017-02-09 17:40:21 -08:00
|
|
|
1023
|
|
|
|
)
|
2017-06-21 11:17:25 -07:00
|
|
|
if (input.buttonIsPressed(Button.A)) {
|
|
|
|
basic.showNumber(reading)
|
|
|
|
}
|
2017-02-09 17:40:21 -08:00
|
|
|
})
|
|
|
|
```
|