fix play ringtone (#MINI-32)
This commit is contained in:
parent
ede7c8b29b
commit
d69bd0e0e4
@ -94,9 +94,7 @@
|
|||||||
"Rotation.Roll|block": "roll",
|
"Rotation.Roll|block": "roll",
|
||||||
"String.charAt|block": "char from %this=text|at %pos",
|
"String.charAt|block": "char from %this=text|at %pos",
|
||||||
"String.compare|block": "compare %this=text| to %that",
|
"String.compare|block": "compare %this=text| to %that",
|
||||||
"String.concat|block": "join %this=text|%other",
|
|
||||||
"String.fromCharCode|block": "text from char code %code",
|
"String.fromCharCode|block": "text from char code %code",
|
||||||
"String.isEmpty|block": "%this=text| is empty",
|
|
||||||
"String.length|block": "length of %VALUE",
|
"String.length|block": "length of %VALUE",
|
||||||
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
||||||
"String|block": "String",
|
"String|block": "String",
|
||||||
|
@ -9,9 +9,13 @@ namespace music {
|
|||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone weight=90
|
||||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||||
//% parts="speaker" async
|
//% parts="speaker" async
|
||||||
void playTone(int freqency, int ms) {
|
void playTone(int frequency, int ms) {
|
||||||
uBit.soundmotor.soundOn(freqency);
|
if(frequency > 0) uBit.soundmotor.soundOn(frequency);
|
||||||
if(ms > 0) uBit.sleep(ms);
|
else uBit.soundmotor.soundOff();
|
||||||
uBit.soundmotor.soundOff();
|
if(ms > 0) {
|
||||||
|
uBit.sleep(ms);
|
||||||
|
uBit.soundmotor.soundOff();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user