pxt-calliope/docs/reference/pins/analog-set-pitch-pin.md

31 lines
681 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Analog Set Pitch Pin
2016-04-13 17:27:45 +02:00
Specify which [pin](/device/pins) (P0, P1, P2) is used to generate tones.
2016-03-26 00:47:20 +01:00
```sig
pins.analogSetPitchPin(AnalogPin.P0)
```
### Parameters
2016-04-13 17:27:45 +02:00
* `name` - [String](/reference/types/string); the pin name ("P0", "P1", or "P2")
2016-03-26 00:47:20 +01:00
### Example
```
pins.analogSetPitchPin(AnalogPin.P0)
let frequency = 440
let duration = 1000
pins.analogPitch(frequency, duration)
```
### Some common notes
* 440 = A4 on piano
* see [piano key frequencies ](https://en.wikipedia.org/wiki/Piano_key_frequencies) for more information
### See also
2016-04-13 17:27:45 +02:00
[micro:bit pins](/device/pins), [analog set period](/reference/pins/analog-set-period), [analog pitch](/reference/pins/analog-pitch)
2016-03-26 00:47:20 +01:00