diff --git a/src/assets/toolbox_adv.xml b/src/assets/toolbox_adv.xml index 86b5982..060ffd4 100644 --- a/src/assets/toolbox_adv.xml +++ b/src/assets/toolbox_adv.xml @@ -321,6 +321,10 @@ + + + + diff --git a/src/components/Activity.vue b/src/components/Activity.vue index 49601a4..567536c 100644 --- a/src/components/Activity.vue +++ b/src/components/Activity.vue @@ -2089,6 +2089,74 @@ export default { var code = 'get_bot().get_mpu_temp()'; return [code, Blockly.Python.ORDER_ATOMIC]; }; + + Blockly.Blocks['coderbot_atmega_get_input'] = { + /** + * Block for get_input function. + * @this Blockly.Block + */ + init: function() { + this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL); + this.setColour(240); + this.appendDummyInput() + .appendField(Blockly.Msg.CODERBOT_ATMEGA_READ) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.CODERBOT_ATMEGA_AI_1, "0"], + [Blockly.Msg.CODERBOT_ATMEGA_AI_2, "1"], + [Blockly.Msg.CODERBOT_ATMEGA_DI_3, "2"], + [Blockly.Msg.CODERBOT_ATMEGA_DI_4, "3"], + [Blockly.Msg.CODERBOT_ATMEGA_DI_5, "4"], + [Blockly.Msg.CODERBOT_ATMEGA_DI_6, "5"],]), 'INPUT'); + this.setOutput(true, 'Number'); + this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP); + } + }; + + Blockly.Python['coderbot_atmega_get_input'] = function(block) { + // input index: 0, 1 are Analogs, 2..5 are Digital + var input = block.getFieldValue('INPUT'); + var code = 'get_atmega().get_input(' + input + ')'; + return [code, Blockly.Python.ORDER_ATOMIC]; + }; + + Blockly.Blocks['coderbot_atmega_set_output'] = { + /** + * Block for set_output function. + * @this Blockly.Block + */ + init: function() { + this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL); + this.setColour(240); + this.appendDummyInput() + .appendField(Blockly.Msg.CODERBOT_ATMEGA_WRITE) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.CODERBOT_ATMEGA_DO_1, "0"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_2, "1"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_3, "2"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_4, "3"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_5, "4"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_6, "5"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_7, "6"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_8, "7"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_9, "8"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_10, "9"], + [Blockly.Msg.CODERBOT_ATMEGA_DO_11, "10"],]), 'OUTPUT'); + this.appendValueInput('VALUE') + .setCheck('Boolean') + .appendField(Blockly.Msg.CODERBOT_ATMEGA_VALUE); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP); + } + }; + + Blockly.Python['coderbot_atmega_set_output'] = function(block) { + // input index: 0, 10 are Digital + var output = block.getFieldValue('OUTPUT'); + var value = Blockly.Python.valueToCode(block, 'VALUE', + Blockly.Python.ORDER_NONE) || '\'\''; + var code = 'get_atmega().set_output(' + output + ', ' + value + ')\n'; + return code; + }; }, toggleSidebar() { diff --git a/static/js/blockly/bot_en.js b/static/js/blockly/bot_en.js index 6b052aa..d27a1e0 100644 --- a/static/js/blockly/bot_en.js +++ b/static/js/blockly/bot_en.js @@ -92,4 +92,23 @@ Blockly.Msg.CODERBOT_EVENT_PUBLISH = "publish"; Blockly.Msg.CODERBOT_EVENT_ON_TOPIC = "on topic"; Blockly.Msg.CODERBOT_EVENT_GENERATOR = "event generator"; Blockly.Msg.CODERBOT_CONVERSATION_PARSE = "parse"; - +Blockly.Msg.CODERBOT_ATMEGA_READ = "Read"; +Blockly.Msg.CODERBOT_ATMEGA_VALUE = "Value"; +Blockly.Msg.CODERBOT_ATMEGA_AI_1 = "Analog Input 1"; +Blockly.Msg.CODERBOT_ATMEGA_AI_2 = "Analog Input 2"; +Blockly.Msg.CODERBOT_ATMEGA_DI_3 = "Digital Input 1"; +Blockly.Msg.CODERBOT_ATMEGA_DI_4 = "Digital Input 2"; +Blockly.Msg.CODERBOT_ATMEGA_DI_5 = "Digital Input3"; +Blockly.Msg.CODERBOT_ATMEGA_DI_6 = "Digital Input 4"; +Blockly.Msg.CODERBOT_ATMEGA_WRITE = "Write"; +Blockly.Msg.CODERBOT_ATMEGA_DO_1 = "Digital Output 1"; +Blockly.Msg.CODERBOT_ATMEGA_DO_2 = "Digital Output 2"; +Blockly.Msg.CODERBOT_ATMEGA_DO_3 = "Digital Output 3"; +Blockly.Msg.CODERBOT_ATMEGA_DO_4 = "Digital Output 4"; +Blockly.Msg.CODERBOT_ATMEGA_DO_5 = "Digital Output 5"; +Blockly.Msg.CODERBOT_ATMEGA_DO_6 = "Digital Output 6"; +Blockly.Msg.CODERBOT_ATMEGA_DO_7 = "Digital Output 7"; +Blockly.Msg.CODERBOT_ATMEGA_DO_8 = "Digital Output 8"; +Blockly.Msg.CODERBOT_ATMEGA_DO_9 = "Digital Output 9"; +Blockly.Msg.CODERBOT_ATMEGA_DO_10 = "Digital Output 10"; +Blockly.Msg.CODERBOT_ATMEGA_DO_11 = "Digital Output 11"; \ No newline at end of file diff --git a/static/js/blockly/bot_it.js b/static/js/blockly/bot_it.js index 315c2da..bb74da5 100644 --- a/static/js/blockly/bot_it.js +++ b/static/js/blockly/bot_it.js @@ -92,3 +92,23 @@ Blockly.Msg.CODERBOT_EVENT_PUBLISH = "pubblica"; Blockly.Msg.CODERBOT_EVENT_ON_TOPIC = "sul topic"; Blockly.Msg.CODERBOT_EVENT_GENERATOR = "genera eventi"; Blockly.Msg.CODERBOT_CONVERSATION_PARSE = "interpreta"; +Blockly.Msg.CODERBOT_ATMEGA_READ = "Leggi"; +Blockly.Msg.CODERBOT_ATMEGA_VALUE = "Valore"; +Blockly.Msg.CODERBOT_ATMEGA_AI_1 = "Analog Input 1"; +Blockly.Msg.CODERBOT_ATMEGA_AI_2 = "Analog Input 2"; +Blockly.Msg.CODERBOT_ATMEGA_DI_3 = "Digital Input 1"; +Blockly.Msg.CODERBOT_ATMEGA_DI_4 = "Digital Input 2"; +Blockly.Msg.CODERBOT_ATMEGA_DI_5 = "Digital Input3"; +Blockly.Msg.CODERBOT_ATMEGA_DI_6 = "Digital Input 4"; +Blockly.Msg.CODERBOT_ATMEGA_WRITE = "Scrivi"; +Blockly.Msg.CODERBOT_ATMEGA_DO_1 = "Digital Output 1"; +Blockly.Msg.CODERBOT_ATMEGA_DO_2 = "Digital Output 2"; +Blockly.Msg.CODERBOT_ATMEGA_DO_3 = "Digital Output 3"; +Blockly.Msg.CODERBOT_ATMEGA_DO_4 = "Digital Output 4"; +Blockly.Msg.CODERBOT_ATMEGA_DO_5 = "Digital Output 5"; +Blockly.Msg.CODERBOT_ATMEGA_DO_6 = "Digital Output 6"; +Blockly.Msg.CODERBOT_ATMEGA_DO_7 = "Digital Output 7"; +Blockly.Msg.CODERBOT_ATMEGA_DO_8 = "Digital Output 8"; +Blockly.Msg.CODERBOT_ATMEGA_DO_9 = "Digital Output 9"; +Blockly.Msg.CODERBOT_ATMEGA_DO_10 = "Digital Output 10"; +Blockly.Msg.CODERBOT_ATMEGA_DO_11 = "Digital Output 11"; \ No newline at end of file diff --git a/vue-app.tar.gz b/vue-app.tar.gz new file mode 100644 index 0000000..01701f6 Binary files /dev/null and b/vue-app.tar.gz differ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy