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
|
|
|
|
|
2016-08-09 17:52:24 +02:00
|
|
|
```blocks
|
2016-03-26 00:47:20 +01:00
|
|
|
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-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
|
|
|
|