analog Pin
Get an analog pin number for a pin identifier.
pins._analogPin(AnalogPin.P0)
Parameters
- pin: a pin identifier for an analog pin (
P0
throughP20
).
Returns
- a pin number for the pin identifier.
Example
Set an analog pin variable for P1
, read pin P1
, and show the input value on the LED screen.
let myPin = AnalogPin.P1
basic.forever(function() {
let value = pins.analogReadPin(myPin)
basic.showNumber(value)
})