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
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.analogSetPitchPin(AnalogPin.P0)
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Parameters
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
* `name` - [String](/types/string); the pin name ("P0", "P1", or "P2")
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Example
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-08-09 17:52:24 +02:00
|
|
|
```blocks
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.analogSetPitchPin(AnalogPin.P0)
|
2016-03-26 00:47:20 +01:00
|
|
|
let frequency = 440
|
|
|
|
let duration = 1000
|
|
|
|
pins.analogPitch(frequency, duration)
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## 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
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## 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
|
|
|
|