Analog Set Pitch Pin

Specify which pin (P0, P1, P2) is used to generate tones.

pins.analogSetPitchPin(AnalogPin.P0)

Parameters

  • name - String; the pin name (“P0”, “P1”, or “P2”)

Example

Set the pitch pin to P0 and send a 440 Hz tone for 1 second.

pins.analogSetPitchPin(AnalogPin.P0)
let frequency = 440
let duration = 1000
pins.analogPitch(frequency, duration)

Some common notes

See also

micro:bit pins, analog set period, analog pitch, set audio pin