-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefinitions.ts
75 lines (71 loc) · 2.37 KB
/
definitions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Blockly.Blocks['import_DriveBit'] = {
init: function() {
this.appendDummyInput()
.appendField("from DriveBit import *");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour("#c51a4a");
this.setTooltip("Imports DriveBit library.");
this.setHelpUrl("");
}
};
Blockly.Blocks['DriveBit_init'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("robot"), "robot")
.appendField(" = DriveBit()");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour("#c51a4a");
this.setTooltip("Initialise DriveBit");
this.setHelpUrl("");
}
};
Blockly.Blocks['DriveBit_direction'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("robot"), "robot")
.appendField(".motor.")
.appendField(new Blockly.FieldDropdown([["one","one"], ["two","two"]]), "motor")
.appendField(".")
.appendField(new Blockly.FieldDropdown([["forward","forward"], ["backward","backward"]]), "direction")
.appendField("(");
this.appendValueInput("NAME")
.setCheck(null);
this.appendDummyInput()
.appendField(")");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour("#c51a4a");
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['DriveBit_stop'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("robot"), "robot")
.appendField(".motor.")
.appendField(new Blockly.FieldDropdown([["one","one"], ["two","two"]]), "motor")
.appendField(".stop()");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour("#c51a4a");
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['sliderinlinerobot'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldSlider("1023", "0", "1023", "1", "1", "Speed"), 'slider');
this.setInputsInline(true);
this.setOutput(true, null);
this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
this.setColour("#FFFFFF", "#FFFFFF", "#FFFFFF");
this.setTooltip("Slider input for inline input");
this.setHelpUrl("");
}
};