824 B
824 B
Analog Read Pin
Read an analog signal (0 through 1023) from the
pin you say.
pins.analogReadPin(AnalogPin.P0)
Parameters
- a string that stores the pin you say (
P0throughP4, orP10)
Returns
- a number from
0through1024
This program reads pin P1 and shows the number as a
bar graph.
basic.forever(() => {
let value = pins.analogReadPin(AnalogPin.P1)
led.plotBarGraph(value, 1023)
});
See also
micro:bit pins, on pin pressed, analog write pin, digital read pin, digital write pin