fix play ringtone (#MINI-32)

(cherry picked from commit d69bd0e)
This commit is contained in:
thinkberg 2017-02-19 11:19:26 +01:00
parent 00b4e8dc01
commit a1b0b5153c
2 changed files with 8 additions and 6 deletions

View File

@ -94,9 +94,7 @@
"Rotation.Roll|block": "roll",
"String.charAt|block": "char from %this=text|at %pos",
"String.compare|block": "compare %this=text| to %that",
"String.concat|block": "join %this=text|%other",
"String.fromCharCode|block": "text from char code %code",
"String.isEmpty|block": "%this=text| is empty",
"String.length|block": "length of %VALUE",
"String.substr|block": "substring of %this=text|from %start|of length %length",
"String|block": "String",

View File

@ -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();
}
}
}