Compare commits
5 Commits
v0.8.23
...
calliope-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
910987fcea | ||
|
|
7c8c35a326 | ||
|
|
7ad9a1cab8 | ||
|
|
97ba83f660 | ||
|
|
d69bd0e0e4 |
@@ -180,6 +180,7 @@
|
||||
"music.noteFrequency": "Gets the frequency of a note.",
|
||||
"music.noteFrequency|param|name": "the note name",
|
||||
"music.playTone": "Plays a tone through ``speaker`` for the given duration.",
|
||||
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
|
||||
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
|
||||
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
|
||||
"music.rest|param|ms": "rest duration in milliseconds (ms)",
|
||||
|
||||
@@ -9,9 +9,13 @@ namespace music {
|
||||
//% help=music/play-tone weight=90
|
||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||
//% parts="speaker" async
|
||||
void playTone(int freqency, int ms) {
|
||||
uBit.soundmotor.soundOn(freqency);
|
||||
if(ms > 0) uBit.sleep(ms);
|
||||
uBit.soundmotor.soundOff();
|
||||
void playTone(int frequency, int ms) {
|
||||
if(frequency > 0) uBit.soundmotor.soundOn(frequency);
|
||||
else uBit.soundmotor.soundOff();
|
||||
if(ms > 0) {
|
||||
uBit.sleep(ms);
|
||||
uBit.soundmotor.soundOff();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
2
libs/core/shims.d.ts
vendored
2
libs/core/shims.d.ts
vendored
@@ -555,7 +555,7 @@ declare namespace music {
|
||||
//% help=music/play-tone weight=90
|
||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||
//% parts="speaker" async shim=music::playTone
|
||||
function playTone(freqency: number, ms: number): void;
|
||||
function playTone(frequency: number, ms: number): void;
|
||||
}
|
||||
declare namespace pins {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-calliope",
|
||||
"version": "0.8.23",
|
||||
"version": "0.8.25",
|
||||
"description": "Calliope Mini editor for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
|
||||
Reference in New Issue
Block a user