Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fustyles authored Oct 12, 2018
1 parent 9b2514f commit 4a3a191
Show file tree
Hide file tree
Showing 80 changed files with 67,362 additions and 0 deletions.
14 changes: 14 additions & 0 deletions smart_uart_myfirmata_20180309/blockly.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"types": ["uart_car","uart_system","uart_custom"],
"category": "catPlus",
"scripts": [
"blockly/blocks.js",
"blockly/javascript.js"
],
"dependencies": [
"uartmyfirmata.js"
],
"msg": "blockly/msg",
"blocksMsg": "blockly/msg/blocks",
"toolbox": "blockly/toolbox.xml"
}
124 changes: 124 additions & 0 deletions smart_uart_myfirmata_20180309/blockly/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
Blockly.Blocks['uart_car'] = {
init: function() {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_LEFT)
.appendField("Uart Car");
this.appendValueInput("cmd")
.setCheck("String")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("cmd");
this.appendValueInput("str1")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("pinL1");
this.appendValueInput("str2")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("pinL2");
this.appendValueInput("str3")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("pinR1");
this.appendValueInput("str4")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("pinR2");
this.appendValueInput("str5")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("L speed");
this.appendValueInput("str6")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("R speed");
this.appendValueInput("str7")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Delay(ms)");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("State")
.appendField(new Blockly.FieldDropdown([["FORWARD","F"], ["BACKWARD","B"], ["LEFT","L"], ["RIGHT","R"], ["STOP","S"]]), "str8");
this.setInputsInline(false);
this.setOutput(true, null);
this.setColour(300);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Blocks['uart_system'] = {
init: function() {
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Uart System cmd")
.appendField(new Blockly.FieldDropdown([["inputPullup","inputpullup"], ["pinMode","pinmode"], ["digitalWrite","digitalwrite"], ["digitalRead","digitalread"], ["analogWrite","analogwrite"], ["analogRead","analogread"]]), "cmd");
this.appendValueInput("str1")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("pin");
this.appendValueInput("str2")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("value");
this.appendValueInput("str3")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str3~str9");
this.setInputsInline(false);
this.setOutput(true, null);
this.setColour(300);
this.setTooltip("");
this.setHelpUrl("");
}
};

Blockly.Blocks['uart_custom'] = {
init: function() {
this.appendValueInput("cmd")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Uart Custom cmd");
this.appendValueInput("str1")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str1");
this.appendValueInput("str2")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str2");
this.appendValueInput("str3")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str3");
this.appendValueInput("str4")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str4");
this.appendValueInput("str5")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str5");
this.appendValueInput("str6")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str6");
this.appendValueInput("str7")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str7");
this.appendValueInput("str8")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str8");
this.appendValueInput("str9")
.setCheck(null)
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("str9");
this.setInputsInline(false);
this.setOutput(true, null);
this.setColour(300);
this.setTooltip("");
this.setHelpUrl("");
}
};
37 changes: 37 additions & 0 deletions smart_uart_myfirmata_20180309/blockly/javascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Blockly.JavaScript['uart_car'] = function(block) {
var value_cmd = Blockly.JavaScript.valueToCode(block, 'cmd', Blockly.JavaScript.ORDER_ATOMIC);
var value_str1 = Blockly.JavaScript.valueToCode(block, 'str1', Blockly.JavaScript.ORDER_ATOMIC);
var value_str2 = Blockly.JavaScript.valueToCode(block, 'str2', Blockly.JavaScript.ORDER_ATOMIC);
var value_str3 = Blockly.JavaScript.valueToCode(block, 'str3', Blockly.JavaScript.ORDER_ATOMIC);
var value_str4 = Blockly.JavaScript.valueToCode(block, 'str4', Blockly.JavaScript.ORDER_ATOMIC);
var value_str5 = Blockly.JavaScript.valueToCode(block, 'str5', Blockly.JavaScript.ORDER_ATOMIC);
var value_str6 = Blockly.JavaScript.valueToCode(block, 'str6', Blockly.JavaScript.ORDER_ATOMIC);
var value_str7 = Blockly.JavaScript.valueToCode(block, 'str7', Blockly.JavaScript.ORDER_ATOMIC);
var dropdown_str8 = block.getFieldValue('str8');
var code = "uartcar("+value_cmd+","+value_str1+","+value_str2+","+value_str3+","+value_str4+","+value_str5+","+value_str6+","+value_str7+",'"+dropdown_str8+"')";
return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['uart_system'] = function(block) {
var dropdown_cmd = block.getFieldValue('cmd');
var value_str1 = Blockly.JavaScript.valueToCode(block, 'str1', Blockly.JavaScript.ORDER_ATOMIC);
var value_str2 = Blockly.JavaScript.valueToCode(block, 'str2', Blockly.JavaScript.ORDER_ATOMIC);
var value_str3 = Blockly.JavaScript.valueToCode(block, 'str3', Blockly.JavaScript.ORDER_ATOMIC);
var code = "uartsystem('"+dropdown_cmd+"',"+value_str1+","+value_str2+","+value_str3+")";
return [code, Blockly.JavaScript.ORDER_NONE];
};

Blockly.JavaScript['uart_custom'] = function(block) {
var value_cmd = Blockly.JavaScript.valueToCode(block, 'cmd', Blockly.JavaScript.ORDER_ATOMIC);
var value_str1 = Blockly.JavaScript.valueToCode(block, 'str1', Blockly.JavaScript.ORDER_ATOMIC);
var value_str2 = Blockly.JavaScript.valueToCode(block, 'str2', Blockly.JavaScript.ORDER_ATOMIC);
var value_str3 = Blockly.JavaScript.valueToCode(block, 'str3', Blockly.JavaScript.ORDER_ATOMIC);
var value_str4 = Blockly.JavaScript.valueToCode(block, 'str4', Blockly.JavaScript.ORDER_ATOMIC);
var value_str5 = Blockly.JavaScript.valueToCode(block, 'str5', Blockly.JavaScript.ORDER_ATOMIC);
var value_str6 = Blockly.JavaScript.valueToCode(block, 'str6', Blockly.JavaScript.ORDER_ATOMIC);
var value_str7 = Blockly.JavaScript.valueToCode(block, 'str7', Blockly.JavaScript.ORDER_ATOMIC);
var value_str8 = Blockly.JavaScript.valueToCode(block, 'str8', Blockly.JavaScript.ORDER_ATOMIC);
var value_str9 = Blockly.JavaScript.valueToCode(block, 'str9', Blockly.JavaScript.ORDER_ATOMIC);
var code = "uartcustom("+value_cmd+","+value_str1+","+value_str2+","+value_str3+","+value_str4+","+value_str5+","+value_str6+","+value_str7+","+value_str8+","+value_str9+")";
return [code, Blockly.JavaScript.ORDER_NONE];
};
1 change: 1 addition & 0 deletions smart_uart_myfirmata_20180309/blockly/msg/blocks/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions smart_uart_myfirmata_20180309/blockly/msg/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MSG.catUARTMYFIRMATA = "UART MYFIRMATA";
1 change: 1 addition & 0 deletions smart_uart_myfirmata_20180309/blockly/msg/zh-hans.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MSG.catUARTMYFIRMATA = "UART MYFIRMATA";
1 change: 1 addition & 0 deletions smart_uart_myfirmata_20180309/blockly/msg/zh-hant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MSG.catUARTMYFIRMATA = "UART MYFIRMATA";
115 changes: 115 additions & 0 deletions smart_uart_myfirmata_20180309/blockly/toolbox.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<category id="catUARTMYFIRMATA" tags="mark1,fly,smart">
<block type="uart_car">
<field name="str5">F</field>
<value name="cmd">
<block type="text">
<field name="TEXT">car</field>
</block>
</value>
<value name="str1">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
<value name="str2">
<block type="math_number">
<field name="NUM">5</field>
</block>
</value>
<value name="str3">
<block type="math_number">
<field name="NUM">6</field>
</block>
</value>
<value name="str4">
<block type="math_number">
<field name="NUM">9</field>
</block>
</value>
<value name="str5">
<block type="math_number">
<field name="NUM">200</field>
</block>
</value>
<value name="str6">
<block type="math_number">
<field name="NUM">200</field>
</block>
</value>
<value name="str7">
<block type="math_number">
<field name="NUM">200</field>
</block>
</value>
</block>
<block type="uart_system">
<field name="cmd">inputpullup</field>
<value name="str1">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
<value name="str2">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
<value name="str3">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
<block type="uart_custom">
<value name="cmd">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str1">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str2">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str3">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str4">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str5">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str6">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str7">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str8">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
<value name="str9">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
</category>
26 changes: 26 additions & 0 deletions smart_uart_myfirmata_20180309/uartmyfirmata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Author: Chung-Yi Fu (Kaohsiung, Taiwan) https://www.facebook.com/francefu

+(function (window, document) {

'use strict';

function uartcar(cmd,str1,str2,str3,str4,str5,str6,str7,str8)
{
return "?"+cmd+"="+str1+";"+str2+";"+str3+";"+str4+";"+str5+";"+str6+";"+str7+";"+str8;
}

function uartsystem(cmd,str1,str2,str3)
{
return "?"+cmd+"="+str1+";"+str2+";"+str3;
}

function uartcustom(cmd,str1,str2,str3,str4,str5,str6,str7,str8,str9)
{
return "?"+cmd+"="+str1+";"+str2+";"+str3+";"+str4+";"+str5+";"+str6+";"+str7+";"+str8+";"+str9;
}

window.uartcar = uartcar;
window.uartsystem = uartsystem;
window.uartcustom = uartcustom;

}(window, window.document));
14 changes: 14 additions & 0 deletions speak_setting_sample_fustyles/blockly.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"types": ["speak_setting_sample_fustyles","speak_setting_sample1_fustyles"],
"category": "catPlus",
"scripts": [
"blockly/blocks.js",
"blockly/javascript.js"
],
"dependencies": [
"speak_setting_sample.js"
],
"msg": "blockly/msg",
"blocksMsg": "blockly/msg/blocks",
"toolbox": "blockly/toolbox.xml"
}
Loading

0 comments on commit 4a3a191

Please sign in to comment.