pxt-calliope/docs/examples/plot-analog-pin.md
Peli de Halleux 676eee168a Soil - moisture (#418)
* updated servo calibrator

* updated plot analog pin example

* updated servo example

* first drop of soil moisture

* updated picture

* fixing macros

* update code section

* 5 seconds

* adding soil moisture

* fixing links
2017-06-21 11:17:25 -07:00

386 B

Plot Analog Pin

Use this program to graph the analog value on pin P0, P1 or P2. Press A to scroll the value on the screen.

let reading = 0
basic.forever(() => {
    reading = pins.analogReadPin(AnalogPin.P0)
    led.plotBarGraph(
        reading,
        1023
    )
    if (input.buttonIsPressed(Button.A)) {
        basic.showNumber(reading)
    }
})