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

32 lines
789 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Analog Pitch
2016-07-22 01:25:20 +02:00
Emits a Pulse With Modulation (PWM) signal to the current pitch [pin](/device/pins). 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)
```
### Parameters
2016-04-13 17:27:45 +02:00
* `frequency` : [Number](/reference/types/number)
* `ms`: [Number](/reference/types/number)
2016-03-26 00:47:20 +01:00
### Example
```
pins.analogSetPitchPin("P0")
let frequency1 = 440
let duration = 1000
pins.analogPitch(frequency1, 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-04-13 17:27:45 +02:00
[micro:bit 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