pxt-calliope/docs/reference/pins/analog-write-pin.md
2016-04-13 08:27:45 -07:00

678 B

Analog Write Pin

Write to the specified pin (P0, P1, P2) as analog.

pins.analogWritePin(AnalogPin.P0, 400)

Parameters

  • name - String; the pin name ("P0", "P1", or "P2")
  • value - a Number between 0 and 1023 included

The following code writes 1023 to the P0 pin:

pins.analogWritePin(AnalogPin.P0, 1023)

See also

micro:bit pins, on pin pressed, analog read pin, digital read pin, digital write pin