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

31 lines
689 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
2016-11-10 22:08:45 +01:00
pins.analogSetPitchPin(AnalogPin.P1)
2016-03-26 00:47:20 +01:00
```
### 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
```blocks
2016-11-10 22:08:45 +01:00
pins.analogSetPitchPin(AnalogPin.P1)
2016-03-26 00:47:20 +01:00
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-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