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

31 lines
675 B
Markdown
Raw Permalink 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)
2016-03-26 00:47:20 +01:00
```
## Parameters
2016-03-26 00:47:20 +01:00
* `name` - [String](/types/string); the pin name ("P0", "P1", or "P2")
2016-03-26 00:47:20 +01:00
## Example
2016-03-26 00:47:20 +01:00
```blocks
pins.analogSetPitchPin(AnalogPin.P0)
2016-03-26 00:47:20 +01:00
let frequency = 440
let duration = 1000
pins.analogPitch(frequency, duration)
```
## Some common notes
2016-03-26 00:47:20 +01:00
* 440 = A4 on piano
* see [piano key frequencies ](https://en.wikipedia.org/wiki/Piano_key_frequencies) for more information
## See also
2016-03-26 00:47:20 +01:00
2016-11-02 01:44:37 +01:00
[@boardname@ 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