-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblocks.js
More file actions
64 lines (61 loc) · 2 KB
/
blocks.js
File metadata and controls
64 lines (61 loc) · 2 KB
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
Blockly.Blocks['uart_new'] = {
init: function() {
this.appendDummyInput()
.appendField(Blockly.Msg.WEBDUINO_UART_SETTING, "設定 UART baud rate:")
.appendField(new Blockly.FieldDropdown([
["9600", "9600"],
["19200", "19200"],
["38400", "38400"],
["57600", "57600"],
["76800", "76800"],
["115200", "115200"]
]), "baud_rate");
this.setOutput(true, null);
this.setColour(230);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['uart_tx'] = {
init: function() {
this.appendValueInput("uart_data")
.setCheck(null)
.appendField(new Blockly.FieldVariable("uart"), "uart")
.appendField(Blockly.Msg.WEBDUINO_UART_TX, "傳送資料")
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(75);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['uart_rx'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("uart"), "uart")
.appendField(Blockly.Msg.WEBDUINO_UART_RX, "接收資料")
this.appendStatementInput("rx")
.setCheck(null)
.appendField("執行");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(30);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.Blocks['uart_data'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldVariable("uart"), "uart")
.appendField("取得資料")
.appendField(new Blockly.FieldDropdown([
["string", "string"],
["list", "list"]
]), "dataType");
this.setOutput(true, null);
this.setColour(75);
this.setTooltip("");
this.setHelpUrl("");
}
};