2016-03-26 00:47:20 +01:00
# Analog Set Period
2016-04-13 17:27:45 +02:00
Configures the period of the Pulse Width Modulation (PWM) on the specified analog [pin ](/device/pins ) (``P0``, ``P1`` or ``P2``). Prior to calling this function, the given pin should be set as analog.
2016-03-26 00:47:20 +01:00
```sig
pins.analogSetPeriod(AnalogPin.P0, 20000)
```
### Parameters
2016-04-13 17:27:45 +02:00
* `name` - [String ](/reference/types/string ); the pin name ("P0", "P1", or "P2")
* `micros` - a [Number ](/reference/types/number ) representing the micro-seconds of the analog period.
2016-03-26 00:47:20 +01:00
The following code
```blocks
pins.analogWritePin(AnalogPin.P0, 512)
pins.analogSetPeriod(AnalogPin.P0, 20000)
```
### See also
2016-04-13 17:27:45 +02:00
[micro:bit pins ](/device/pins ), [on pin pressed ](/reference/input/on-pin-pressed ), [analog read pin ](/reference/pins/analog-read-pin ), [digital read pin ](/reference/pins/digital-read-pin ), [digital write pin ](/reference/pins/digital-write-pin )
2016-03-26 00:47:20 +01:00