2016-03-26 00:47:20 +01:00
|
|
|
# Analog Pitch
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
Emits a Pulse With Modulation (PWM) signal to the pin ``P0``.
|
|
|
|
Use [analog set pitch pin](/reference/pins/analog-set-pitch-pin) to set the current pitch pin.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
pins.analogPitch(440, 300)
|
|
|
|
```
|
|
|
|
|
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
|
|
|
* `frequency` : [Number](/types/number)
|
|
|
|
* `ms`: [Number](/types/number)
|
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 frequency1 = 440
|
|
|
|
let duration = 1000
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.analogSetPitchPin(AnalogPin.P1);
|
2016-03-26 00:47:20 +01:00
|
|
|
pins.analogPitch(frequency1, 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 set pitch pin](/reference/pins/analog-set-pitch-pin)
|
2016-03-26 00:47:20 +01:00
|
|
|
|