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

852 B

Analog Set Period

Configures the period of the Pulse Width Modulation (PWM) on the specified analog pin (P0, P1 or P2). Prior to calling this function, the given pin should be set as analog.

pins.analogSetPeriod(AnalogPin.P0, 20000)

Parameters

  • name - String; the pin name ("P0", "P1", or "P2")
  • micros - a Number representing the micro-seconds of the analog period.

The following code

pins.analogWritePin(AnalogPin.P0, 512)
pins.analogSetPeriod(AnalogPin.P0, 20000)

See also

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