@@ -10,6 +10,63 @@ const Wedo2Converter = {
10
10
let block ;
11
11
if ( ( this . _isSelf ( receiver ) || receiver === Opal . nil ) && ! rubyBlock ) {
12
12
switch ( name ) {
13
+ case 'wedo2_turn_motor_on_for' :
14
+ if ( args . length === 2 && this . _isString ( args [ 0 ] ) && this . _isNumberOrBlock ( args [ 1 ] ) ) {
15
+ block = this . _createBlock ( 'wedo2_motorOnFor' , 'statement' ) ;
16
+ this . _addInput (
17
+ block ,
18
+ 'MOTOR_ID' ,
19
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_ID' , 'MOTOR_ID' , args [ 0 ] )
20
+ ) ;
21
+ this . _addNumberInput ( block , 'DURATION' , 'math_number' , args [ 1 ] , 1 ) ;
22
+ }
23
+ break ;
24
+ case 'wedo2_trun_motor_on' :
25
+ if ( args . length === 1 && this . _isString ( args [ 0 ] ) ) {
26
+ block = this . _createBlock ( 'wedo2_motorOn' , 'statement' ) ;
27
+ this . _addInput (
28
+ block ,
29
+ 'MOTOR_ID' ,
30
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_ID' , 'MOTOR_ID' , args [ 0 ] )
31
+ ) ;
32
+ }
33
+ break ;
34
+ case 'wedo2_trun_motor_off' :
35
+ if ( args . length === 1 && this . _isString ( args [ 0 ] ) ) {
36
+ block = this . _createBlock ( 'wedo2_motorOff' , 'statement' ) ;
37
+ this . _addInput (
38
+ block ,
39
+ 'MOTOR_ID' ,
40
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_ID' , 'MOTOR_ID' , args [ 0 ] )
41
+ ) ;
42
+ }
43
+ break ;
44
+ case 'wedo2_set_motor_power' :
45
+ if ( args . length === 2 && this . _isString ( args [ 0 ] ) && this . _isNumberOrBlock ( args [ 1 ] ) ) {
46
+ block = this . _createBlock ( 'wedo2_startMotorPower' , 'statement' ) ;
47
+ this . _addInput (
48
+ block ,
49
+ 'MOTOR_ID' ,
50
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_ID' , 'MOTOR_ID' , args [ 0 ] )
51
+ ) ;
52
+ this . _addNumberInput ( block , 'POWER' , 'math_number' , args [ 1 ] , 100 ) ;
53
+ }
54
+ break ;
55
+ case 'wedo2_set_motor_direction' :
56
+ if ( args . length === 2 && this . _isString ( args [ 0 ] ) && this . _isString ( args [ 1 ] ) ) {
57
+ block = this . _createBlock ( 'wedo2_setMotorDirection' , 'statement' ) ;
58
+ this . _addInput (
59
+ block ,
60
+ 'MOTOR_ID' ,
61
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_ID' , 'MOTOR_ID' , args [ 0 ] )
62
+ ) ;
63
+ this . _addInput (
64
+ block ,
65
+ 'MOTOR_DIRECTION' ,
66
+ this . _createFieldBlock ( 'wedo2_menu_MOTOR_DIRECTION' , 'MOTOR_DIRECTION' , args [ 1 ] )
67
+ ) ;
68
+ }
69
+ break ;
13
70
case 'wedo2_set_light_color' :
14
71
if ( args . length === 1 && this . _isNumberOrBlock ( args [ 0 ] ) ) {
15
72
block = this . _createBlock ( 'wedo2_setLightHue' , 'statement' ) ;
0 commit comments