smalruby-editor 0.1.24-x86-mingw32 → 0.2.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Guardfile +9 -0
- data/app/assets/javascripts/blocks/hardware.js.coffee.erb +147 -62
- data/app/assets/javascripts/blocks/sensing.js.coffee.erb +4 -0
- data/app/assets/javascripts/msg/en_us.js +34 -12
- data/app/assets/javascripts/msg/ja.js +35 -15
- data/app/helpers/editor_helper.rb +2 -1
- data/app/models/concerns/ruby_to_block/block/{hardware_button_down_or_up.rb → hardware_button_pressed_or_released.rb} +3 -3
- data/app/models/concerns/ruby_to_block/block/{hardware_led_on.rb → hardware_led_turn_off.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/{hardware_led_off.rb → hardware_led_turn_on.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +2 -0
- data/app/models/concerns/ruby_to_block/block/{hardware_rgb_led_on.rb → hardware_rgb_led_set_color.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/{hardware_rgb_led_off.rb → hardware_rgb_led_turn_off.rb} +2 -2
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb +22 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb +24 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_led_turn_on_or_off.rb +22 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_light_sensor_value.rb +28 -0
- data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_touch_sensor_pressed_or_released.rb +29 -0
- data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_commands.rb +3 -1
- data/app/views/editor/_toolbox.html.haml +30 -17
- data/app/views/layouts/application.html.erb +3 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/lib/smalruby_editor/blockly_message_helper.rb +2 -1
- data/lib/smalruby_editor/version.rb +1 -1
- data/lib/tasks/release.rake +0 -0
- data/public/assets/{application-fda71a642d958ffbaf90185c471d6e51.js → application-b305a6ea9e7c045a8e170bbf6fb09dd1.js} +3 -3
- data/public/assets/{application-fda71a642d958ffbaf90185c471d6e51.js.gz → application-b305a6ea9e7c045a8e170bbf6fb09dd1.js.gz} +0 -0
- data/public/assets/{manifest-1a9856df207640ec658271db34b30dbb.json → manifest-ebd584fa603a378faf780f013e6a447d.json} +1 -1
- data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js +1 -0
- data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js.gz +0 -0
- data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js +1 -0
- data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js.gz +0 -0
- data/smalruby-editor.gemspec +1 -1
- data/spec/acceptance/block_mode/blocks/hardware/{button_down_or_up.feature → button_pressed_or_released.feature} +15 -15
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +67 -0
- data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +67 -0
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +79 -0
- data/spec/acceptance/block_mode/blocks/hardware/{button_not_use_pullup.feature → rgb_led_turn_off.feature} +30 -18
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +107 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +151 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +73 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature +92 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_motor_speed.feature +116 -0
- data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature +108 -0
- data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +359 -36
- data/spec/models/concerns/ruby_to_block_spec.rb +8 -8
- data/spec/steps/block_mode_steps.rb +8 -0
- metadata +43 -35
- data/app/models/concerns/ruby_to_block/block/hardware_button_not_use_pullup.rb +0 -18
- data/app/models/concerns/ruby_to_block/block/hardware_on_button_down_or_up.rb +0 -19
- data/app/models/concerns/ruby_to_block/block/hardware_on_sensor_change.rb +0 -17
- data/public/assets/msg/en_us-893d970ff8061fbe7459f009582c4df5.js +0 -1
- data/public/assets/msg/en_us-893d970ff8061fbe7459f009582c4df5.js.gz +0 -0
- data/public/assets/msg/ja-4d22bd0341f464f9d1b9f373121bce6d.js +0 -1
- data/public/assets/msg/ja-4d22bd0341f464f9d1b9f373121bce6d.js.gz +0 -0
- data/spec/acceptance/block_mode/blocks/hardware/led_off.feature +0 -75
- data/spec/acceptance/block_mode/blocks/hardware/led_on.feature +0 -75
- data/spec/acceptance/block_mode/blocks/hardware/on_button_down_or_up.feature +0 -87
- data/spec/acceptance/block_mode/blocks/hardware/on_sensor_change.feature +0 -81
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_off.feature +0 -81
- data/spec/acceptance/block_mode/blocks/hardware/rgb_led_on.feature +0 -87
@@ -0,0 +1,108 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# language: en
|
3
|
+
@javascript
|
4
|
+
Feature: hardware_smalrubot_v3_touch_sensor_pressed_or_released block
|
5
|
+
Scenario: ブロックのみ配置する
|
6
|
+
Given "ブロック" タブを表示する
|
7
|
+
|
8
|
+
When 次のブロックを配置する:
|
9
|
+
"""
|
10
|
+
%block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
|
11
|
+
%field{:name => "LOR"}<
|
12
|
+
right
|
13
|
+
%field{:name => "POR"}<
|
14
|
+
pressed
|
15
|
+
"""
|
16
|
+
And ブロックからソースコードを生成する
|
17
|
+
|
18
|
+
Then テキストエディタのプログラムは "" であること
|
19
|
+
|
20
|
+
Scenario: 文とブロックを配置する
|
21
|
+
Given "ブロック" タブを表示する
|
22
|
+
|
23
|
+
When 次のブロックを配置する:
|
24
|
+
"""
|
25
|
+
%block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
|
26
|
+
%value{:name => "ARG"}
|
27
|
+
%block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
|
28
|
+
%field{:name => "LOR"}<
|
29
|
+
right
|
30
|
+
%field{:name => "POR"}<
|
31
|
+
pressed
|
32
|
+
"""
|
33
|
+
And ブロックからソースコードを生成する
|
34
|
+
|
35
|
+
Then テキストエディタのプログラムは以下であること:
|
36
|
+
"""
|
37
|
+
require "smalruby"
|
38
|
+
|
39
|
+
p("")
|
40
|
+
|
41
|
+
"""
|
42
|
+
|
43
|
+
Scenario: キャラクターとブロックを配置する
|
44
|
+
Given "ブロック" タブを表示する
|
45
|
+
And 次のキャラクターを追加する:
|
46
|
+
| name | costumes | x | y | angle |
|
47
|
+
| car1 | car1.png | 0 | 0 | 0 |
|
48
|
+
|
49
|
+
When 次のブロックを配置する:
|
50
|
+
"""
|
51
|
+
%block{:type => "character_new", :x => "21", :y => "15"}
|
52
|
+
%field{:name => "NAME"}<
|
53
|
+
car1
|
54
|
+
%statement{:name => "DO"}
|
55
|
+
%block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
|
56
|
+
%value{:name => "ARG"}
|
57
|
+
%block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
|
58
|
+
%field{:name => "LOR"}<
|
59
|
+
right
|
60
|
+
%field{:name => "POR"}<
|
61
|
+
pressed
|
62
|
+
"""
|
63
|
+
And ブロックからソースコードを生成する
|
64
|
+
|
65
|
+
Then テキストエディタのプログラムは以下であること:
|
66
|
+
"""
|
67
|
+
require "smalruby"
|
68
|
+
|
69
|
+
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
70
|
+
p(car1.smalrubot_v3.right_touch_sensor.pressed?)
|
71
|
+
|
72
|
+
"""
|
73
|
+
|
74
|
+
Scenario: キャラクターとイベントとブロックを配置する
|
75
|
+
Given "ブロック" タブを表示する
|
76
|
+
And 次のキャラクターを追加する:
|
77
|
+
| name | costumes | x | y | angle |
|
78
|
+
| car1 | car1.png | 0 | 0 | 0 |
|
79
|
+
|
80
|
+
When 次のブロックを配置する:
|
81
|
+
"""
|
82
|
+
%block{:type => "character_new", :x => "21", :y => "15"}
|
83
|
+
%field{:name => "NAME"}<
|
84
|
+
car1
|
85
|
+
%statement{:name => "DO"}
|
86
|
+
%block{:type => "events_on_start"}
|
87
|
+
%statement{:name => "DO"}
|
88
|
+
%block{:type => "ruby_p", :x => "0", :y => "0", :inline => "true" }
|
89
|
+
%value{:name => "ARG"}
|
90
|
+
%block{:type => "hardware_smalrubot_v3_touch_sensor_pressed_or_released", :x => "0", :y => "0"}
|
91
|
+
%field{:name => "LOR"}<
|
92
|
+
left
|
93
|
+
%field{:name => "POR"}<
|
94
|
+
released
|
95
|
+
"""
|
96
|
+
And ブロックからソースコードを生成する
|
97
|
+
|
98
|
+
Then テキストエディタのプログラムは以下であること:
|
99
|
+
"""
|
100
|
+
require "smalruby"
|
101
|
+
|
102
|
+
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
103
|
+
|
104
|
+
car1.on(:start) do
|
105
|
+
p(smalrubot_v3.left_touch_sensor.released?)
|
106
|
+
end
|
107
|
+
|
108
|
+
"""
|
@@ -12,15 +12,15 @@ init_hardware
|
|
12
12
|
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
13
13
|
|
14
14
|
car1.on(:start) do
|
15
|
-
led("D4").
|
16
|
-
rgb_led_cathode("D9").
|
15
|
+
led("D4").turn_on
|
16
|
+
rgb_led_cathode("D9").color = [255, 0, 0]
|
17
17
|
two_wheel_drive_car("D6").forward
|
18
18
|
end
|
19
|
-
car1.led("D4").
|
20
|
-
car1.rgb_led_cathode("D9").
|
19
|
+
car1.led("D4").turn_off
|
20
|
+
car1.rgb_led_cathode("D9").turn_off
|
21
21
|
car1.two_wheel_drive_car("D6").backward
|
22
22
|
|
23
|
-
car1.on(:
|
23
|
+
car1.on(:start) do
|
24
24
|
if sensor("A0").value < 200
|
25
25
|
two_wheel_drive_car("D6").turn_left
|
26
26
|
two_wheel_drive_car("D6").turn_right
|
@@ -46,10 +46,10 @@ end
|
|
46
46
|
<statement name="DO">
|
47
47
|
<block type="events_on_start">
|
48
48
|
<statement name="DO">
|
49
|
-
<block type="
|
49
|
+
<block type="hardware_led_turn_on">
|
50
50
|
<field name="PIN">D4</field>
|
51
51
|
<next>
|
52
|
-
<block type="
|
52
|
+
<block type="hardware_rgb_led_set_color">
|
53
53
|
<field name="AC">cathode</field>
|
54
54
|
<field name="PIN">D9</field>
|
55
55
|
<field name="COLOUR">#ff0000</field>
|
@@ -63,18 +63,17 @@ end
|
|
63
63
|
</block>
|
64
64
|
</statement>
|
65
65
|
<next>
|
66
|
-
<block type="
|
66
|
+
<block type="hardware_led_turn_off">
|
67
67
|
<field name="PIN">D4</field>
|
68
68
|
<next>
|
69
|
-
<block type="
|
69
|
+
<block type="hardware_rgb_led_turn_off">
|
70
70
|
<field name="AC">cathode</field>
|
71
71
|
<field name="PIN">D9</field>
|
72
72
|
<next>
|
73
73
|
<block type="hardware_two_wheel_drive_car_backward">
|
74
74
|
<field name="PIN">D6</field>
|
75
75
|
<next>
|
76
|
-
<block type="
|
77
|
-
<field name="PIN">A0</field>
|
76
|
+
<block type="events_on_start">
|
78
77
|
<statement name="DO">
|
79
78
|
<block type="control_if" inline="true">
|
80
79
|
<value name="COND">
|
@@ -387,14 +386,12 @@ require "smalruby"
|
|
387
386
|
init_hardware
|
388
387
|
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
389
388
|
|
390
|
-
car1.on(:
|
391
|
-
p(button("D3").
|
392
|
-
p(button("D3").
|
393
|
-
button("D3").not_use_pullup
|
389
|
+
car1.on(:start) do
|
390
|
+
p(button("D3").released?)
|
391
|
+
p(button("D3").pressed?)
|
394
392
|
end
|
395
|
-
p(car1.button("D3").
|
396
|
-
p(car1.button("D3").
|
397
|
-
car1.button("D3").not_use_pullup
|
393
|
+
p(car1.button("D3").released?)
|
394
|
+
p(car1.button("D3").pressed?)
|
398
395
|
EOS
|
399
396
|
describe compact_source_code(parts) do
|
400
397
|
_parts = parts
|
@@ -407,30 +404,23 @@ car1.button("D3").not_use_pullup
|
|
407
404
|
<block type="character_new">
|
408
405
|
<field name="NAME">car1</field>
|
409
406
|
<statement name="DO">
|
410
|
-
<block type="
|
411
|
-
<field name="PIN">D3</field>
|
412
|
-
<field name="DOU">down</field>
|
407
|
+
<block type="events_on_start">
|
413
408
|
<statement name="DO">
|
414
409
|
<block type="ruby_p" inline="true">
|
415
410
|
<value name="ARG">
|
416
|
-
<block type="
|
411
|
+
<block type="hardware_button_pressed_or_released">
|
417
412
|
<field name="PIN">D3</field>
|
418
|
-
<field name="
|
413
|
+
<field name="POR">released</field>
|
419
414
|
</block>
|
420
415
|
</value>
|
421
416
|
<next>
|
422
417
|
<block type="ruby_p" inline="true">
|
423
418
|
<value name="ARG">
|
424
|
-
<block type="
|
419
|
+
<block type="hardware_button_pressed_or_released">
|
425
420
|
<field name="PIN">D3</field>
|
426
|
-
<field name="
|
421
|
+
<field name="POR">pressed</field>
|
427
422
|
</block>
|
428
423
|
</value>
|
429
|
-
<next>
|
430
|
-
<block type="hardware_button_not_use_pullup">
|
431
|
-
<field name="PIN">D3</field>
|
432
|
-
</block>
|
433
|
-
</next>
|
434
424
|
</block>
|
435
425
|
</next>
|
436
426
|
</block>
|
@@ -438,22 +428,355 @@ car1.button("D3").not_use_pullup
|
|
438
428
|
<next>
|
439
429
|
<block type="ruby_p" inline="true">
|
440
430
|
<value name="ARG">
|
441
|
-
<block type="
|
431
|
+
<block type="hardware_button_pressed_or_released">
|
442
432
|
<field name="PIN">D3</field>
|
443
|
-
<field name="
|
433
|
+
<field name="POR">released</field>
|
444
434
|
</block>
|
445
435
|
</value>
|
446
436
|
<next>
|
447
437
|
<block type="ruby_p" inline="true">
|
448
438
|
<value name="ARG">
|
449
|
-
<block type="
|
439
|
+
<block type="hardware_button_pressed_or_released">
|
450
440
|
<field name="PIN">D3</field>
|
451
|
-
<field name="
|
441
|
+
<field name="POR">pressed</field>
|
452
442
|
</block>
|
453
443
|
</value>
|
444
|
+
</block>
|
445
|
+
</next>
|
446
|
+
</block>
|
447
|
+
</next>
|
448
|
+
</block>
|
449
|
+
</statement>
|
450
|
+
</block>
|
451
|
+
XML
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
parts = <<-EOS
|
456
|
+
require "smalruby"
|
457
|
+
|
458
|
+
init_hardware
|
459
|
+
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
460
|
+
|
461
|
+
car1.on(:start) do
|
462
|
+
smalrubot_v3.forward
|
463
|
+
smalrubot_v3.backward
|
464
|
+
smalrubot_v3.turn_left
|
465
|
+
smalrubot_v3.turn_right
|
466
|
+
smalrubot_v3.stop
|
467
|
+
|
468
|
+
smalrubot_v3.forward(sec: 0.5)
|
469
|
+
smalrubot_v3.backward(sec: 0.4)
|
470
|
+
smalrubot_v3.turn_left(sec: 0.3)
|
471
|
+
smalrubot_v3.turn_right(sec: 0.2)
|
472
|
+
smalrubot_v3.stop(sec: 0.1)
|
473
|
+
|
474
|
+
p(smalrubot_v3.left_touch_sensor.pressed?)
|
475
|
+
p(smalrubot_v3.left_touch_sensor.released?)
|
476
|
+
p(smalrubot_v3.right_touch_sensor.pressed?)
|
477
|
+
p(smalrubot_v3.right_touch_sensor.released?)
|
478
|
+
|
479
|
+
p(smalrubot_v3.light_sensor.value)
|
480
|
+
|
481
|
+
smalrubot_v3.red_led.turn_on
|
482
|
+
smalrubot_v3.green_led.turn_off
|
483
|
+
end
|
484
|
+
car1.smalrubot_v3.forward
|
485
|
+
car1.smalrubot_v3.backward
|
486
|
+
car1.smalrubot_v3.turn_left
|
487
|
+
car1.smalrubot_v3.turn_right
|
488
|
+
car1.smalrubot_v3.stop
|
489
|
+
|
490
|
+
car1.smalrubot_v3.forward(sec: 0.5)
|
491
|
+
car1.smalrubot_v3.backward(sec: 0.4)
|
492
|
+
car1.smalrubot_v3.turn_left(sec: 0.3)
|
493
|
+
car1.smalrubot_v3.turn_right(sec: 0.2)
|
494
|
+
car1.smalrubot_v3.stop(sec: 0.1)
|
495
|
+
|
496
|
+
p(car1.smalrubot_v3.left_touch_sensor.pressed?)
|
497
|
+
p(car1.smalrubot_v3.left_touch_sensor.released?)
|
498
|
+
p(car1.smalrubot_v3.right_touch_sensor.pressed?)
|
499
|
+
p(car1.smalrubot_v3.right_touch_sensor.released?)
|
500
|
+
|
501
|
+
p(car1.smalrubot_v3.light_sensor.value)
|
502
|
+
|
503
|
+
car1.smalrubot_v3.red_led.turn_on
|
504
|
+
car1.smalrubot_v3.green_led.turn_off
|
505
|
+
EOS
|
506
|
+
describe compact_source_code(parts) do
|
507
|
+
_parts = parts
|
508
|
+
let(:data) { _parts }
|
509
|
+
|
510
|
+
it '結果が正しいこと' do
|
511
|
+
should eq_block_xml(<<-XML)
|
512
|
+
<character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
|
513
|
+
<block type="hardware_init_hardware" />
|
514
|
+
<block type="character_new">
|
515
|
+
<field name="NAME">car1</field>
|
516
|
+
<statement name="DO">
|
517
|
+
<block type="events_on_start">
|
518
|
+
<statement name="DO">
|
519
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
520
|
+
<field name="ACTION">forward</field>
|
521
|
+
<next>
|
522
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
523
|
+
<field name="ACTION">backward</field>
|
454
524
|
<next>
|
455
|
-
<block type="
|
456
|
-
<field name="
|
525
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
526
|
+
<field name="ACTION">turn_left</field>
|
527
|
+
<next>
|
528
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
529
|
+
<field name="ACTION">turn_right</field>
|
530
|
+
<next>
|
531
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
532
|
+
<field name="ACTION">stop</field>
|
533
|
+
<next>
|
534
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
535
|
+
<field name="ACTION">forward</field>
|
536
|
+
<value name="SEC">
|
537
|
+
<block type="math_number">
|
538
|
+
<field name="NUM">0.5</field>
|
539
|
+
</block>
|
540
|
+
</value>
|
541
|
+
<next>
|
542
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
543
|
+
<field name="ACTION">backward</field>
|
544
|
+
<value name="SEC">
|
545
|
+
<block type="math_number">
|
546
|
+
<field name="NUM">0.4</field>
|
547
|
+
</block>
|
548
|
+
</value>
|
549
|
+
<next>
|
550
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
551
|
+
<field name="ACTION">turn_left</field>
|
552
|
+
<value name="SEC">
|
553
|
+
<block type="math_number">
|
554
|
+
<field name="NUM">0.3</field>
|
555
|
+
</block>
|
556
|
+
</value>
|
557
|
+
<next>
|
558
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
559
|
+
<field name="ACTION">turn_right</field>
|
560
|
+
<value name="SEC">
|
561
|
+
<block type="math_number">
|
562
|
+
<field name="NUM">0.2</field>
|
563
|
+
</block>
|
564
|
+
</value>
|
565
|
+
<next>
|
566
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
567
|
+
<field name="ACTION">stop</field>
|
568
|
+
<value name="SEC">
|
569
|
+
<block type="math_number">
|
570
|
+
<field name="NUM">0.1</field>
|
571
|
+
</block>
|
572
|
+
</value>
|
573
|
+
<next>
|
574
|
+
<block type="ruby_p" inline="true">
|
575
|
+
<value name="ARG">
|
576
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
577
|
+
<field name="LOR">left</field>
|
578
|
+
<field name="POR">pressed</field>
|
579
|
+
</block>
|
580
|
+
</value>
|
581
|
+
<next>
|
582
|
+
<block type="ruby_p" inline="true">
|
583
|
+
<value name="ARG">
|
584
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
585
|
+
<field name="LOR">left</field>
|
586
|
+
<field name="POR">released</field>
|
587
|
+
</block>
|
588
|
+
</value>
|
589
|
+
<next>
|
590
|
+
<block type="ruby_p" inline="true">
|
591
|
+
<value name="ARG">
|
592
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
593
|
+
<field name="LOR">right</field>
|
594
|
+
<field name="POR">pressed</field>
|
595
|
+
</block>
|
596
|
+
</value>
|
597
|
+
<next>
|
598
|
+
<block type="ruby_p" inline="true">
|
599
|
+
<value name="ARG">
|
600
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
601
|
+
<field name="LOR">right</field>
|
602
|
+
<field name="POR">released</field>
|
603
|
+
</block>
|
604
|
+
</value>
|
605
|
+
<next>
|
606
|
+
<block type="ruby_p" inline="true">
|
607
|
+
<value name="ARG">
|
608
|
+
<block type="hardware_smalrubot_v3_light_sensor_value" />
|
609
|
+
</value>
|
610
|
+
<next>
|
611
|
+
<block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
|
612
|
+
<field name="COLOUR">red</field>
|
613
|
+
<field name="OOO">turn_on</field>
|
614
|
+
<next>
|
615
|
+
<block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
|
616
|
+
<field name="COLOUR">green</field>
|
617
|
+
<field name="OOO">turn_off</field>
|
618
|
+
</block>
|
619
|
+
</next>
|
620
|
+
</block>
|
621
|
+
</next>
|
622
|
+
</block>
|
623
|
+
</next>
|
624
|
+
</block>
|
625
|
+
</next>
|
626
|
+
</block>
|
627
|
+
</next>
|
628
|
+
</block>
|
629
|
+
</next>
|
630
|
+
</block>
|
631
|
+
</next>
|
632
|
+
</block>
|
633
|
+
</next>
|
634
|
+
</block>
|
635
|
+
</next>
|
636
|
+
</block>
|
637
|
+
</next>
|
638
|
+
</block>
|
639
|
+
</next>
|
640
|
+
</block>
|
641
|
+
</next>
|
642
|
+
</block>
|
643
|
+
</next>
|
644
|
+
</block>
|
645
|
+
</next>
|
646
|
+
</block>
|
647
|
+
</next>
|
648
|
+
</block>
|
649
|
+
</next>
|
650
|
+
</block>
|
651
|
+
</statement>
|
652
|
+
<next>
|
653
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
654
|
+
<field name="ACTION">forward</field>
|
655
|
+
<next>
|
656
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
657
|
+
<field name="ACTION">backward</field>
|
658
|
+
<next>
|
659
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
660
|
+
<field name="ACTION">turn_left</field>
|
661
|
+
<next>
|
662
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
663
|
+
<field name="ACTION">turn_right</field>
|
664
|
+
<next>
|
665
|
+
<block type="hardware_smalrubot_v3_action" inline="true">
|
666
|
+
<field name="ACTION">stop</field>
|
667
|
+
<next>
|
668
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
669
|
+
<field name="ACTION">forward</field>
|
670
|
+
<value name="SEC">
|
671
|
+
<block type="math_number">
|
672
|
+
<field name="NUM">0.5</field>
|
673
|
+
</block>
|
674
|
+
</value>
|
675
|
+
<next>
|
676
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
677
|
+
<field name="ACTION">backward</field>
|
678
|
+
<value name="SEC">
|
679
|
+
<block type="math_number">
|
680
|
+
<field name="NUM">0.4</field>
|
681
|
+
</block>
|
682
|
+
</value>
|
683
|
+
<next>
|
684
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
685
|
+
<field name="ACTION">turn_left</field>
|
686
|
+
<value name="SEC">
|
687
|
+
<block type="math_number">
|
688
|
+
<field name="NUM">0.3</field>
|
689
|
+
</block>
|
690
|
+
</value>
|
691
|
+
<next>
|
692
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
693
|
+
<field name="ACTION">turn_right</field>
|
694
|
+
<value name="SEC">
|
695
|
+
<block type="math_number">
|
696
|
+
<field name="NUM">0.2</field>
|
697
|
+
</block>
|
698
|
+
</value>
|
699
|
+
<next>
|
700
|
+
<block type="hardware_smalrubot_v3_action_with_sec" inline="true">
|
701
|
+
<field name="ACTION">stop</field>
|
702
|
+
<value name="SEC">
|
703
|
+
<block type="math_number">
|
704
|
+
<field name="NUM">0.1</field>
|
705
|
+
</block>
|
706
|
+
</value>
|
707
|
+
<next>
|
708
|
+
<block type="ruby_p" inline="true">
|
709
|
+
<value name="ARG">
|
710
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
711
|
+
<field name="LOR">left</field>
|
712
|
+
<field name="POR">pressed</field>
|
713
|
+
</block>
|
714
|
+
</value>
|
715
|
+
<next>
|
716
|
+
<block type="ruby_p" inline="true">
|
717
|
+
<value name="ARG">
|
718
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
719
|
+
<field name="LOR">left</field>
|
720
|
+
<field name="POR">released</field>
|
721
|
+
</block>
|
722
|
+
</value>
|
723
|
+
<next>
|
724
|
+
<block type="ruby_p" inline="true">
|
725
|
+
<value name="ARG">
|
726
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
727
|
+
<field name="LOR">right</field>
|
728
|
+
<field name="POR">pressed</field>
|
729
|
+
</block>
|
730
|
+
</value>
|
731
|
+
<next>
|
732
|
+
<block type="ruby_p" inline="true">
|
733
|
+
<value name="ARG">
|
734
|
+
<block type="hardware_smalrubot_v3_touch_sensor_pressed_or_released">
|
735
|
+
<field name="LOR">right</field>
|
736
|
+
<field name="POR">released</field>
|
737
|
+
</block>
|
738
|
+
</value>
|
739
|
+
<next>
|
740
|
+
<block type="ruby_p" inline="true">
|
741
|
+
<value name="ARG">
|
742
|
+
<block type="hardware_smalrubot_v3_light_sensor_value" />
|
743
|
+
</value>
|
744
|
+
<next>
|
745
|
+
<block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
|
746
|
+
<field name="COLOUR">red</field>
|
747
|
+
<field name="OOO">turn_on</field>
|
748
|
+
<next>
|
749
|
+
<block type="hardware_smalrubot_v3_led_turn_on_or_off" inline="true">
|
750
|
+
<field name="COLOUR">green</field>
|
751
|
+
<field name="OOO">turn_off</field>
|
752
|
+
</block>
|
753
|
+
</next>
|
754
|
+
</block>
|
755
|
+
</next>
|
756
|
+
</block>
|
757
|
+
</next>
|
758
|
+
</block>
|
759
|
+
</next>
|
760
|
+
</block>
|
761
|
+
</next>
|
762
|
+
</block>
|
763
|
+
</next>
|
764
|
+
</block>
|
765
|
+
</next>
|
766
|
+
</block>
|
767
|
+
</next>
|
768
|
+
</block>
|
769
|
+
</next>
|
770
|
+
</block>
|
771
|
+
</next>
|
772
|
+
</block>
|
773
|
+
</next>
|
774
|
+
</block>
|
775
|
+
</next>
|
776
|
+
</block>
|
777
|
+
</next>
|
778
|
+
</block>
|
779
|
+
</next>
|
457
780
|
</block>
|
458
781
|
</next>
|
459
782
|
</block>
|