Skip to content

Commit 37b65df

Browse files
committed
[ADD] converter of microbit_button_pressed function
1 parent 4d958c3 commit 37b65df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib/ruby-to-blocks-converter/microbit.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ const MicroBitConverter = {
1616
rubyBlockArgs && rubyBlockArgs.length === 0 &&
1717
rubyBlock) {
1818
switch (args[0].value) {
19+
case 'microbit_button_pressed':
20+
if (args.length === 2 && this._isString(args[1])) {
21+
block = this._createBlock('microbit_whenButtonPressed', 'hat');
22+
this._addFieldInput(
23+
block, 'BTN', 'microbit_menu_buttons', 'buttons',
24+
args[1], 'A'
25+
)
26+
this._setParent(rubyBlock, block);
27+
}
28+
break;
1929
}
2030
} else if (this._isSelf(receiver) || receiver === Opal.nil) {
2131
switch (name) {

0 commit comments

Comments
 (0)