fix play ringtone (#MINI-32)

This commit is contained in:
thinkberg 2017-02-19 11:19:26 +01:00
parent ede7c8b29b
commit d69bd0e0e4
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();
}
}
}