diff --git a/mixly/boards/default_src/arduino/arduino_generator.js b/mixly/boards/default_src/arduino/arduino_generator.js new file mode 100644 index 00000000..a9b60371 --- /dev/null +++ b/mixly/boards/default_src/arduino/arduino_generator.js @@ -0,0 +1,165 @@ +import * as Blockly from 'blockly/core'; +import Names from './others/names'; + +export class ArduinoGenerator extends Blockly.Generator { + constructor(name) { + super(name ?? 'Arduino') + this.ORDER_ATOMIC = 0 // 0 "" ... + this.ORDER_UNARY_POSTFIX = 1 // expr++ expr-- () [] . + this.ORDER_UNARY_PREFIX = 2 // -expr !expr ~expr ++expr --expr + this.ORDER_MULTIPLICATIVE = 3 // * / % ~/ + this.ORDER_ADDITIVE = 4 // + - + this.ORDER_SHIFT = 5 // << >> + this.ORDER_RELATIONAL = 6 // is is! >= > <= < + this.ORDER_EQUALITY = 7 // == != === !== + this.ORDER_BITWISE_AND = 8 // & + this.ORDER_BITWISE_XOR = 9 // ^ + this.ORDER_BITWISE_OR = 10 // | + this.ORDER_LOGICAL_AND = 11 // && + this.ORDER_LOGICAL_OR = 12 // || + this.ORDER_CONDITIONAL = 13 // expr ? expr : expr + this.ORDER_ASSIGNMENT = 14 // = *= /= ~/= %= += -= <<= >>= &= ^= |= + this.ORDER_NONE = 99 // (...) + this.INDENT = ' ' + this.isInitialized = false + this.PASS = '' + + this.addReservedWords( + 'setup,loop,if,else,for,switch,case,while,do,break,continue,return,goto,define,include,HIGH,LOW,INPUT,OUTPUT,INPUT_PULLUP,true,false,interger,constants,floating,point,void,bookean,char,unsigned,byte,int,short,word,long,float,double,string,String,array,static,volatile,const,sizeof' + ) + } + + init() { + super.init(); + // Create a dictionary of definitions to be printed before setups. + this.definitions_ = Object.create(null) + // Create a dictionary of setups to be printed before the code. + this.setups_ = Object.create(null) + this.setups_begin_ = Object.create(null) + this.setups_end_ = Object.create(null) + this.libs_ = Object.create(null) + this.loops_begin_ = Object.create(null) + this.loops_end_ = Object.create(null) + //this.variableTypes_ = Object.create(null);//处理变量类型 + + if (!this.variableDB_) { + this.variableDB_ = new Names( + this.RESERVED_WORDS_ + ) + } else { + this.variableDB_.reset() + } + this.isInitialized = true; + } + + finish(code) { + // Indent every line. + code = ' ' + code.replace(/\n/g, '\n '); + code = code.replace(/\n\s+$/, '\n'); + // Convert the definitions dictionary into a list. + var imports = []; + var define = []; + var definitions_var = []; //变量定义 + var definitions_fun = []; //函数定义 + //var sorted_keys=Object.keys(this.definitions_).sort(); + var sorted_keys = Object.keys(this.definitions_); + if (sorted_keys.length) { + for (var idx in sorted_keys) { + var name = sorted_keys[idx]; + var def = this.definitions_[name]; + if (name.match(/^define/)) { + define.push(def); + } else if (name.match(/^include/)) { + imports.push(def); + } else if (def.match(/^WiFiClient/)) { + imports.push(def); + } else if (name.match(/^var_declare/)) { + definitions_var.push(def); + } else { + definitions_fun.push(def); + } + } + } + // Convert the setups dictionary into a list. + var setups = []; + for (let name in this.setups_) { + setups.push(this.setups_[name]); + } + var setupsBegin = [], setupsEnd = []; + for (let name in this.setups_begin_) { + setupsBegin.push(this.setups_begin_[name]); + } + for (let name in this.setups_end_) { + setupsEnd.push(this.setups_end_[name]); + } + + for (let name in this.libs_) { + imports.push(`#include "${name}.h"`); + } + + var loopsBegin = [], loopsEnd = []; + for (let name in this.loops_begin_) { + loopsBegin.push(this.loops_begin_[name]); + } + for (let name in this.loops_end_) { + loopsEnd.push(this.loops_end_[name]); + } + code = 'void loop() {\n' + + (loopsBegin.length ? (' ' + loopsBegin.join('\n ')) : '') + + code + + (loopsEnd.length ? (' ' + loopsEnd.join('\n ')) : '') + + '\n}'; + var allDefs = define.join('\n') + '\n' + imports.join('\n') + '\n\n' + + definitions_var.join('\n') + + '\n\n' + definitions_fun.join('\n') + + '\n\nvoid setup() {\n ' + + setupsBegin.join('\n ') + ((setupsBegin.length && (setupsEnd.length || setups.length)) ? '\n ' : '') + + setups.join('\n ') + ((setupsEnd.length && setups.length) ? '\n ' : '') + + setupsEnd.join('\n ') + '\n}' + '\n\n'; + return allDefs.replace(/\n\n+/g, '\n\n').replace(/\n*$/, '\n\n') + code; + } + + scrubNakedValue(line) { + return line + ';\n' + } + + quote_(string) { + // TODO: This is a quick hack. Replace with goog.string.quote + //return goog.string.quote(string); + return "\"" + string + "\""; + } + + scrub_(block, code) { + if (code === null) { + // Block has handled code generation itself. + return ''; + } + var commentCode = ''; + // Only collect comments for blocks that aren't inline. + if (!block.outputConnection || !block.outputConnection.targetConnection) { + // Collect comment for this block. + let comment = block.getCommentText(); + if (comment) { + commentCode += this.prefixLines(comment, '// ') + '\n'; + } + // Collect comments for all value arguments. + // Don't collect comments for nested statements. + for (var x = 0; x < block.inputList.length; x++) { + if (block.inputList[x].type == Blockly.INPUT_VALUE) { + var childBlock = block.inputList[x].connection.targetBlock(); + if (childBlock) { + let comment = this.allNestedComments(childBlock); + if (comment) { + commentCode += this.prefixLines(comment, '// '); + } + } + } + } + } + var nextBlock = block.nextConnection && block.nextConnection.targetBlock(); + var nextCode = this.blockToCode(nextBlock); + return commentCode + code + nextCode; + } +} + +export const Arduino = new ArduinoGenerator(); diff --git a/mixly/boards/default_src/arduino/blocks/ethernet.js b/mixly/boards/default_src/arduino/blocks/ethernet.js new file mode 100644 index 00000000..9d4d657a --- /dev/null +++ b/mixly/boards/default_src/arduino/blocks/ethernet.js @@ -0,0 +1,223 @@ +import * as Blockly from 'blockly/core'; +import CITYS_DATA from '../templates/json/cities.json'; + +const ETHERNET_HUE = 0; +const WEATHER_HUE = '#27b6ac'; + + +/** + * @name 模块名 Http GET请求 + * @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3} + */ +export const http_get = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_GET_REQUEST); + this.appendValueInput("api") + .setCheck(null) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendStatementInput("success") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SUCCESS); + this.appendStatementInput("failure") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_FAILED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + } +}; + +/** + * @name 模块名 Http PATCH|POST|PUT请求 + * @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3} + */ +export const http_post = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + ["POST", "POST"], + ["PATCH", "PATCH"], + ["PUT", "PUT"] + ]), "TYPE") + .appendField(Blockly.Msg.blockpy_REQUESTS); + this.appendValueInput("api") + .setCheck(null) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendStatementInput("success") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SUCCESS); + this.appendStatementInput("failure") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_FAILED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + } +}; + +var PROVINCES = [], key; +for (key in CITYS_DATA) + PROVINCES.push([key, key]); + + +function getCitysByProvince(a) { + var b = [], c; + for (c in CITYS_DATA[a]) + b.push([c, c]); + return b; +} + +var citysByProvince = {}; +for (key of PROVINCES) { + citysByProvince[key[0]] = getCitysByProvince(key[0]); +} + +export const china_city = { + init: function () { + const defaultOptions = [["-", "-"]]; + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(PROVINCES), "province") + .appendField(new Blockly.FieldDependentDropdown("province", citysByProvince, defaultOptions), "city"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(WEATHER_HUE); + this.setHelpUrl(""); + this.preProvince = null; + } +}; + +export const weather_private_key = { + init: function () { + this.setColour(WEATHER_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([['S9l2sb_ZK-UsWaynG', 'S9l2sb_ZK-UsWaynG'], ['SpRpSYb7QOMT0M8Tz', 'SpRpSYb7QOMT0M8Tz'], ['SboqGMxP4tYNXUN8f', 'SboqGMxP4tYNXUN8f'], ['SJiRrYGYFkGnfi081', 'SJiRrYGYFkGnfi081'], ['SMhSshUxuTL0GLVLS', 'SMhSshUxuTL0GLVLS']]), 'key'); + this.setOutput(true, null); + } +}; + +export const weather_seniverse_city_weather = { + init: function () { + this.appendDummyInput("") + .appendField(Blockly.Msg.MSG.catweather) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LIVE_WEATHER, "weather/now"], [Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST, "weather/daily"], [Blockly.Msg.MIXLY_6_LIFE_INDEXES, "life/suggestion"]]), "api") + .appendField(Blockly.Msg.MIXLY_INFORMATION_CONFIGURATION); + this.appendValueInput("location") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_GEOGRAPHIC_LOCATION); + this.appendValueInput("private_key") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_API_PRIVATE_KEY); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_LANGUAGE) + .appendField(new Blockly.FieldDropdown([ + ["简体中文", "zh-Hans"], + ["繁體中文", "zh-Hant"], + ["English", "en"] + ]), "language"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_TEMPERATURE_UNIT) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_CELSIUS + "(℃)", "c"], [Blockly.Msg.MIXLY_FAHRENHEIT + "(℉)", "f"]]), "unit"); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(WEATHER_HUE); + this.setTooltip("这里的API私钥免费体验有次数限制\n访问频率限制20次/分钟"); + this.setHelpUrl(""); + } +}; + + +export const weather_get_seniverse_weather_info = { + init: function () { + this.appendDummyInput("") + //.appendField("心知天气") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_LIVE_WEATHER, "weather/now"], + [Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST, "weather/daily"], + [Blockly.Msg.MIXLY_6_LIFE_INDEXES, "life/suggestion"] + ]), "api") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_AVAILABLE, "update"], + [Blockly.Msg.MIXLY_GET_DATA_UPDATE_TIME, "getLastUpdate"], + [Blockly.Msg.MIXLY_GET_SERVER_RESPONSE_STATUS_CODE, "getServerCode"] + ]), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(WEATHER_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } + +}; + +export const weather_get_seniverse_weather_info1 = { + init: function () { + this.appendDummyInput("") + //.appendField("心知天气") + .appendField(Blockly.Msg.MIXLY_LIVE_WEATHER) + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_WEATHER_PHENOMENON, "getWeatherText"], [Blockly.Msg.MIXLY_WEATHER_PHENOMENON_CODE, "getWeatherCode"], [Blockly.Msg.MIXLY_TEMPERATURE, "getDegree"]]), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(WEATHER_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } + +}; + +export const weather_get_seniverse_weather_info2 = { + init: function () { + this.appendDummyInput("") + //.appendField("心知天气") + .appendField(Blockly.Msg.MIXLY_3_DAY_WEATHER_FORECAST) + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_TODAY, "0"], [Blockly.Msg.MIXLY_TOMORROW, "1"], [Blockly.Msg.MIXLY_DAY_AFTER_TOMORROW, "2"]]), "date") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.ForecastHigh, "getHigh"], + [Blockly.Msg.ForecastLow, "getLow"], + [Blockly.Msg.MIXLY_DAYTIME_WEATHER_PHENOMENON, "getDayText"], + [Blockly.Msg.MIXLY_DAYTIME_WEATHER_PHENOMENON_CODE, "getDayCode"], + [Blockly.Msg.MIXLY_EVENING_WEATHER_PHENOMENON, "getNightText"], + [Blockly.Msg.MIXLY_EVENING_WEATHER_PHENOMENON_CODE, "getNightCode"], + [Blockly.Msg.MIXLY_PROBABILITY_OF_PRECIPITATION, "getRain"], + [Blockly.Msg.ForecastFx, "getWindDirection"], + [Blockly.Msg.MIXLY_WIND_SPEED, "getWindSpeed"], + [Blockly.Msg.MIXLY_WIND_RATING, "getWindScale"], + [Blockly.Msg.MIXLY_Humidity, "getHumidity"] + ]), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(WEATHER_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const weather_get_seniverse_weather_info3 = { + init: function () { + this.appendDummyInput("") + //.appendField("心知天气") + .appendField(Blockly.Msg.MIXLY_6_LIFE_INDEXES) + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_CAR_WASH_INDEX, "getCarWash"], + [Blockly.Msg.MIXLY_DRESSING_INDEX, "getDressing"], + [Blockly.Msg.MIXLY_COLD_INDEX, "getFactorFlu"], + [Blockly.Msg.MIXLY_MOVEMENT_INDEX, "getExercise"], + [Blockly.Msg.MIXLY_TOURISM_INDEX, "getTravel"], + [Blockly.Msg.MIXLY_UV_INDEX, "getUV"]] + ), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(WEATHER_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/blocks/procedures.js b/mixly/boards/default_src/arduino/blocks/procedures.js new file mode 100644 index 00000000..68efecff --- /dev/null +++ b/mixly/boards/default_src/arduino/blocks/procedures.js @@ -0,0 +1,1314 @@ +/** + * @license + * Visual Blocks Editor + * + * Copyright 2012 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Procedure blocks for Blockly. + * @author fraser@google.com (Neil Fraser) + */ + +import * as Blockly from 'blockly/core'; +import { Variables, Procedures } from 'blockly/core'; + +/** + * Common HSV hue for all blocks in this category. + */ +const PROCEDURES_HUE = 290; + +export const procedures_defnoreturn = { + /** + * Block for defining a procedure with no return value. + * @this {Blockly.Block} + */ + init: function () { + var initName = Procedures.findLegalName('', this); + var nameField = new Blockly.FieldTextInput(initName, + Procedures.rename); + nameField.setSpellcheck(false); + this.appendDummyInput() + .appendField(Blockly.Msg['PROCEDURES_DEFNORETURN_TITLE']) + .appendField(nameField, 'NAME') + .appendField('', 'PARAMS'); + this.setMutator(new Blockly.icons.MutatorIcon(['procedures_mutatorarg'], this)); + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']) { + this.setCommentText(Blockly.Msg['PROCEDURES_DEFNORETURN_COMMENT']); + } + this.setStyle('procedure_blocks'); + this.setTooltip(Blockly.Msg['PROCEDURES_DEFNORETURN_TOOLTIP']); + this.setHelpUrl(Blockly.Msg['PROCEDURES_DEFNORETURN_HELPURL']); + this.arguments_ = []; + this.argumentstype_ = [];//新增 + this.argumentVarModels_ = []; + this.setStatements_(true); + this.statementConnection_ = null; + }, + /** + * Add or remove the statement block from this function definition. + * @param {boolean} hasStatements True if a statement block is needed. + * @this {Blockly.Block} + */ + setStatements_: function (hasStatements) { + if (this.hasStatements_ === hasStatements) { + return; + } + if (hasStatements) { + this.appendStatementInput('STACK') + .appendField(Blockly.Msg['PROCEDURES_DEFNORETURN_DO']); + if (this.getInput('RETURN')) { + this.moveInputBefore('STACK', 'RETURN'); + } + } else { + this.removeInput('STACK', true); + } + this.hasStatements_ = hasStatements; + }, + /** + * Update the display of parameters for this procedure definition block. + * @private + * @this {Blockly.Block} + */ + updateParams_: function () { + + // Merge the arguments into a human-readable list. + var paramString = ''; + if (this.arguments_.length) { + paramString = Blockly.Msg['PROCEDURES_BEFORE_PARAMS'] + + ' ' + this.arguments_.join(', '); + } + // The params field is deterministic based on the mutation, + // no need to fire a change event. + Blockly.Events.disable(); + try { + this.setFieldValue(paramString, 'PARAMS'); + } finally { + Blockly.Events.enable(); + } + }, + /** + * Create XML to represent the argument inputs. + * @param {boolean=} opt_paramIds If true include the IDs of the parameter + * quarks. Used by Procedures.mutateCallers for reconnection. + * @return {!Element} XML storage element. + * @this {Blockly.Block} + */ + mutationToDom: function (opt_paramIds) { + var container = Blockly.utils.xml.createElement('mutation'); + if (opt_paramIds) { + container.setAttribute('name', this.getFieldValue('NAME')); + } + for (var i = 0; i < this.argumentVarModels_.length; i++) { + var parameter = Blockly.utils.xml.createElement('arg'); + var argModel = this.argumentVarModels_[i]; + parameter.setAttribute('name', argModel.name); + parameter.setAttribute('varid', argModel.getId()); + parameter.setAttribute('vartype', this.argumentstype_[i]); + if (opt_paramIds && this.paramIds_) { + parameter.setAttribute('paramId', this.paramIds_[i]); + } + container.appendChild(parameter); + } + + // Save whether the statement input is visible. + if (!this.hasStatements_) { + container.setAttribute('statements', 'false'); + } + return container; + }, + /** + * Parse XML to restore the argument inputs. + * @param {!Element} xmlElement XML storage element. + * @this {Blockly.Block} + */ + domToMutation: function (xmlElement) { + this.arguments_ = []; + this.argumentstype_ = [];//新增 + this.argumentVarModels_ = []; + for (var i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { + if (childNode.nodeName.toLowerCase() == 'arg') { + var varName = childNode.getAttribute('name'); + var varId = childNode.getAttribute('varid') || childNode.getAttribute('varId'); + var varType = childNode.getAttribute('vartype') || childNode.getAttribute('varType'); //新增 + this.arguments_.push(varName); + this.argumentstype_.push(varType); //新增 + var variable = Variables.getOrCreateVariablePackage( + this.workspace, varId, varName, ''); + if (variable != null) { + this.argumentVarModels_.push(variable); + } else { + console.log('Failed to create a variable with name ' + varName + ', ignoring.'); + } + } + } + this.updateParams_(); + Procedures.mutateCallers(this); + + // Show or hide the statement input. + this.setStatements_(xmlElement.getAttribute('statements') !== 'false'); + }, + /** + * Returns the state of this block as a JSON serializable object. + * + * @returns The state of this block, eg the parameters and statements. + */ + saveExtraState: function () { + if (!this.argumentVarModels_.length && this.hasStatements_) { + return null; + } + const state = Object.create(null); + if (this.argumentVarModels_.length) { + state['params'] = []; + for (let i = 0; i < this.argumentVarModels_.length; i++) { + state['params'].push({ + // We don't need to serialize the name, but just in case we decide + // to separate params from variables. + 'name': this.argumentVarModels_[i].name, + 'id': this.argumentVarModels_[i].getId(), + 'type': this.argumentstype_[i], + }); + } + } + if (!this.hasStatements_) { + state['hasStatements'] = false; + } + return state; + }, + /** + * Applies the given state to this block. + * + * @param state The state to apply to this block, eg the parameters + * and statements. + */ + loadExtraState: function (state) { + this.arguments_ = []; + this.argumentstype_ = []; + this.argumentVarModels_ = []; + if (state['params']) { + for (let i = 0; i < state['params'].length; i++) { + const param = state['params'][i]; + const variable = Variables.getOrCreateVariablePackage( + this.workspace, + param['id'], + param['name'], + '', + ); + this.arguments_.push(variable.name); + this.argumentstype_.push(param['type']); + this.argumentVarModels_.push(variable); + } + } + this.updateParams_(); + Procedures.mutateCallers(this); + this.setStatements_(state['hasStatements'] !== false); + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this {Blockly.Block} + */ + decompose: function (workspace) { + /* + * Creates the following XML: + * + * + * + * arg1_name + * etc... + * + * + * + */ + + var containerBlockNode = Blockly.utils.xml.createElement('block'); + containerBlockNode.setAttribute('type', 'procedures_mutatorcontainer'); + var statementNode = Blockly.utils.xml.createElement('statement'); + statementNode.setAttribute('name', 'STACK'); + containerBlockNode.appendChild(statementNode); + + var node = statementNode; + for (var i = 0; i < this.arguments_.length; i++) { + var argBlockNode = Blockly.utils.xml.createElement('block'); + argBlockNode.setAttribute('type', 'procedures_mutatorarg'); + var fieldNode = Blockly.utils.xml.createElement('field'); + fieldNode.setAttribute('name', 'NAME'); + var argumentName = Blockly.utils.xml.createTextNode(this.arguments_[i]); + fieldNode.appendChild(argumentName); + argBlockNode.appendChild(fieldNode); + + var fieldNode1 = Blockly.utils.xml.createElement('field'); + fieldNode1.setAttribute('name', 'TYPEVAR'); + var argumentName1 = Blockly.utils.xml.createTextNode(this.argumentstype_[i]); + fieldNode1.appendChild(argumentName1); + argBlockNode.appendChild(fieldNode1); + + var nextNode = Blockly.utils.xml.createElement('next'); + argBlockNode.appendChild(nextNode); + + node.appendChild(argBlockNode); + node = nextNode; + } + + var containerBlock = Blockly.Xml.domToBlock(containerBlockNode, workspace); + + if (this.type == 'procedures_defreturn') { + containerBlock.setFieldValue(this.hasStatements_, 'STATEMENTS'); + } else { + containerBlock.removeInput('STATEMENT_INPUT'); + } + + // Initialize procedure's callers with blank IDs. + Procedures.mutateCallers(this); + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this {Blockly.Block} + */ + compose: function (containerBlock) { + // Parameter list. + this.arguments_ = []; + this.argumentstype_ = [];//新增 + this.paramIds_ = []; + this.argumentVarModels_ = []; + var paramBlock = containerBlock.getInputTargetBlock('STACK'); + while (paramBlock && !paramBlock.isInsertionMarker()) { + var varName = paramBlock.getFieldValue('NAME'); + this.arguments_.push(varName); + var varType = paramBlock.getFieldValue('TYPEVAR'); + this.argumentstype_.push(varType); + var variable = this.workspace.getVariable(varName, ''); + this.argumentVarModels_.push(variable); + + this.paramIds_.push(paramBlock.id); + paramBlock = paramBlock.nextConnection && + paramBlock.nextConnection.targetBlock(); + } + this.updateParams_(); + Procedures.mutateCallers(this); + + // Show/hide the statement input. + var hasStatements = containerBlock.getFieldValue('STATEMENTS'); + if (hasStatements !== null) { + hasStatements = hasStatements == 'TRUE'; + if (this.hasStatements_ != hasStatements) { + if (hasStatements) { + this.setStatements_(true); + // Restore the stack, if one was saved. + this.statementConnection_ && this.statementConnection_.reconnect(this, 'STACK'); + this.statementConnection_ = null; + } else { + // Save the stack, then disconnect it. + var stackConnection = this.getInput('STACK').connection; + this.statementConnection_ = stackConnection.targetConnection; + if (this.statementConnection_) { + var stackBlock = stackConnection.targetBlock(); + stackBlock.unplug(); + stackBlock.bumpNeighbours(); + } + this.setStatements_(false); + } + } + } + }, + /** + * Return the signature of this procedure definition. + * @return {!Array} Tuple containing three elements: + * - the name of the defined procedure, + * - a list of all its arguments, + * - that it DOES NOT have a return value. + * @this {Blockly.Block} + */ + getProcedureDef: function () { + return [this.getFieldValue('NAME'), this.arguments_, false]; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Blockly.Block} + */ + getVars: function () { + return this.arguments_; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Blockly.Block} + */ + getVarModels: function () { + return this.argumentVarModels_; + }, + /** + * Notification that a variable is renaming. + * If the ID matches one of this block's variables, rename it. + * @param {string} oldId ID of variable to rename. + * @param {string} newId ID of new variable. May be the same as oldId, but + * with an updated name. Guaranteed to be the same type as the old + * variable. + * @override + * @this {Blockly.Block} + */ + renameVarById: function (oldId, newId) { + var oldVariable = this.workspace.getVariableById(oldId); + if (oldVariable.type != '') { + // Procedure arguments always have the empty type. + return; + } + var oldName = oldVariable.name; + var newVar = this.workspace.getVariableById(newId); + + var change = false; + for (var i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() == oldId) { + this.arguments_[i] = newVar.name; + this.argumentVarModels_[i] = newVar; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newVar.name); + Procedures.mutateCallers(this); + } + }, + /** + * Notification that a variable is renaming but keeping the same ID. If the + * variable is in use on this block, rerender to show the new name. + * @param {!Blockly.VariableModel} variable The variable being renamed. + * @package + * @override + * @this {Blockly.Block} + */ + updateVarName: function (variable) { + var newName = variable.name; + var change = false; + for (var i = 0; i < this.argumentVarModels_.length; i++) { + if (this.argumentVarModels_[i].getId() == variable.getId()) { + var oldName = this.arguments_[i]; + this.arguments_[i] = newName; + change = true; + } + } + if (change) { + this.displayRenamedVar_(oldName, newName); + Procedures.mutateCallers(this); + } + }, + /** + * Update the display to reflect a newly renamed argument. + * @param {string} oldName The old display name of the argument. + * @param {string} newName The new display name of the argument. + * @private + * @this {Blockly.Block} + */ + displayRenamedVar_: function (oldName, newName) { + this.updateParams_(); + const mutator = this.getIcon(Blockly.icons.MutatorIcon.TYPE); + // Update the mutator's variables if the mutator is open. + if (mutator && mutator.bubbleIsVisible()) { + var blocks = mutator.getWorkspace().getAllBlocks(false); + for (var i = 0, block; (block = blocks[i]); i++) { + if (block.type == 'procedures_mutatorarg' && + Blockly.Names.equals(oldName, block.getFieldValue('NAME'))) { + block.setFieldValue(newName, 'NAME'); + } + } + } + }, + /** + * Add custom menu options to this block's context menu. + * @param {!Array} options List of menu options to add to. + * @this {Blockly.Block} + */ + customContextMenu: function (options) { + if (this.isInFlyout) { + return; + } + // Add option to create caller. + var option = { enabled: true }; + var name = this.getFieldValue('NAME'); + option.text = Blockly.Msg['PROCEDURES_CREATE_DO'].replace('%1', name); + var xmlMutation = Blockly.utils.xml.createElement('mutation'); + xmlMutation.setAttribute('name', name); + for (var i = 0; i < this.arguments_.length; i++) { + var xmlArg = Blockly.utils.xml.createElement('arg'); + xmlArg.setAttribute('name', this.arguments_[i]); + //xmlArg.setAttribute('vartype', this.argumentstype_[i]); + xmlMutation.appendChild(xmlArg); + } + var xmlBlock = Blockly.utils.xml.createElement('block'); + xmlBlock.setAttribute('type', this.callType_); + xmlBlock.appendChild(xmlMutation); + option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock); + options.push(option); + + // Add options to create getters for each parameter. + if (!this.isCollapsed()) { + for (var i = 0; i < this.argumentVarModels_.length; i++) { + var argOption = { enabled: true }; + var argVar = this.argumentVarModels_[i]; + argOption.text = Blockly.Msg['VARIABLES_SET_CREATE_GET'] + .replace('%1', argVar.name); + + var argXmlField = Variables.generateVariableFieldDom(argVar); + var argXmlBlock = Blockly.utils.xml.createElement('block'); + argXmlBlock.setAttribute('type', 'variables_get'); + argXmlBlock.appendChild(argXmlField); + argOption.callback = + Blockly.ContextMenu.callbackFactory(this, argXmlBlock); + options.push(argOption); + } + } + }, + callType_: 'procedures_callnoreturn' +}; + +export const procedures_defreturn = { + /** + * Block for defining a procedure with a return value. + * @this {Blockly.Block} + */ + init: function () { + var initName = Procedures.findLegalName('', this); + var nameField = new Blockly.FieldTextInput(initName, + Procedures.rename); + nameField.setSpellcheck(false); + this.appendDummyInput() + .appendField(Blockly.Msg['PROCEDURES_DEFRETURN_TITLE']) + .appendField(nameField, 'NAME') + .appendField('', 'PARAMS'); + this.appendValueInput('RETURN') + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg['PROCEDURES_DEFRETURN_RETURN']) + .appendField(new Blockly.FieldDropdown(Procedures.DATA_TYPE, this.adjustReturnInput.bind(this)), "TYPE"); + this.setMutator(new Blockly.icons.MutatorIcon(['procedures_mutatorarg'], this)); + if ((this.workspace.options.comments || + (this.workspace.options.parentWorkspace && + this.workspace.options.parentWorkspace.options.comments)) && + Blockly.Msg['PROCEDURES_DEFRETURN_COMMENT']) { + this.setCommentText(Blockly.Msg['PROCEDURES_DEFRETURN_COMMENT']); + } + this.setStyle('procedure_blocks'); + this.setTooltip(Blockly.Msg['PROCEDURES_DEFRETURN_TOOLTIP']); + this.setHelpUrl(Blockly.Msg['PROCEDURES_DEFRETURN_HELPURL']); + this.arguments_ = []; + this.argumentVarModels_ = []; + this.setStatements_(true); + this.statementConnection_ = null; + this.returnType = 'void'; + }, + adjustReturnInput: function (value) { + const fieldName = 'RETRUN_TYPE'; + if (value === 'CUSTOM') { + if (!this.getField(fieldName)) { + this.getInput('RETURN').appendField( + new Blockly.FieldTextInput(this.returnType ?? ''), + fieldName, + ); + } + } else { + if (this.getField('RETRUN_TYPE')) { + this.returnType = this.getFieldValue('RETRUN_TYPE') || 'void'; + } + this.getInput('RETURN').removeField(fieldName, true); + } + }, + setStatements_: procedures_defnoreturn.setStatements_, + updateParams_: procedures_defnoreturn.updateParams_, + mutationToDom: procedures_defnoreturn.mutationToDom, + domToMutation: procedures_defnoreturn.domToMutation, + saveExtraState: function () { + const output = procedures_defnoreturn.saveExtraState.call(this) ?? {}; + if (this.getField('RETRUN_TYPE')) { + output['returnType'] = this.getFieldValue('RETRUN_TYPE'); + } + return output; + }, + loadExtraState: function (state) { + this.returnType = state?.returnType; + if (!this.getField('RETRUN_TYPE')) { + this.getInput('RETURN').appendField( + new Blockly.FieldTextInput(this.returnType ?? ''), + 'RETRUN_TYPE', + ); + } + procedures_defnoreturn.loadExtraState.call(this, state); + }, + decompose: procedures_defnoreturn.decompose, + compose: procedures_defnoreturn.compose, + /** + * Return the signature of this procedure definition. + * @return {!Array} Tuple containing three elements: + * - the name of the defined procedure, + * - a list of all its arguments, + * - that it DOES have a return value. + * @this {Blockly.Block} + */ + getProcedureDef: function () { + return [this.getFieldValue('NAME'), this.arguments_, true]; + }, + getVars: procedures_defnoreturn.getVars, + getVarModels: procedures_defnoreturn.getVarModels, + renameVarById: procedures_defnoreturn.renameVarById, + updateVarName: procedures_defnoreturn.updateVarName, + displayRenamedVar_: procedures_defnoreturn.displayRenamedVar_, + customContextMenu: procedures_defnoreturn.customContextMenu, + callType_: 'procedures_callreturn' +}; + +export const procedures_mutatorcontainer = { + /** + * Mutator block for procedure container. + * @this {Blockly.Block} + */ + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg['PROCEDURES_MUTATORCONTAINER_TITLE']); + this.appendStatementInput('STACK'); + this.appendDummyInput('STATEMENT_INPUT') + .appendField(Blockly.Msg['PROCEDURES_ALLOW_STATEMENTS']) + .appendField(new Blockly.FieldCheckbox('TRUE'), 'STATEMENTS'); + this.setStyle('procedure_blocks'); + this.setTooltip(Blockly.Msg['PROCEDURES_MUTATORCONTAINER_TOOLTIP']); + this.contextMenu = false; + }, +}; + +export const procedures_mutatorarg = { + /** + * Mutator block for procedure argument. + * @this {Blockly.Block} + */ + init: function () { + var field = new Blockly.FieldTextInput( + Procedures.DEFAULT_ARG, this.validator_); + // Hack: override showEditor to do just a little bit more work. + // We don't have a good place to hook into the start of a text edit. + field.oldShowEditorFn_ = field.showEditor_; + var newShowEditorFn = function () { + this.createdVariables_ = []; + this.oldShowEditorFn_(); + }; + field.showEditor_ = newShowEditorFn; + + this.appendDummyInput() + .appendField(Blockly.Msg.PROCEDURES_BEFORE_PARAMS) + .appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), "TYPEVAR") + .appendField(field, 'NAME'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setStyle('procedure_blocks'); + this.setTooltip(Blockly.Msg['PROCEDURES_MUTATORARG_TOOLTIP']); + this.contextMenu = false; + + // Create the default variable when we drag the block in from the flyout. + // Have to do this after installing the field on the block. + field.onFinishEditing_ = this.deleteIntermediateVars_; + // Create an empty list so onFinishEditing_ has something to look at, even + // though the editor was never opened. + field.createdVariables_ = []; + field.onFinishEditing_('x'); + }, + /** + * Obtain a valid name for the procedure argument. Create a variable if + * necessary. + * Merge runs of whitespace. Strip leading and trailing whitespace. + * Beyond this, all names are legal. + * @param {string} varName User-supplied name. + * @return {?string} Valid name, or null if a name was not specified. + * @private + * @this Blockly.FieldTextInput + */ + validator_: function (varName) { + var sourceBlock = this.getSourceBlock(); + var outerWs = sourceBlock.workspace.getRootWorkspace(); + varName = varName.replace(/[\s\xa0]+/g, ' ').replace(/^ | $/g, ''); + if (!varName) { + return null; + } + + // Prevents duplicate parameter names in functions + var workspace = sourceBlock.workspace.targetWorkspace || + sourceBlock.workspace; + var blocks = workspace.getAllBlocks(false); + var caselessName = varName.toLowerCase(); + for (var i = 0; i < blocks.length; i++) { + if (blocks[i].id == this.getSourceBlock().id) { + continue; + } + // Other blocks values may not be set yet when this is loaded. + var otherVar = blocks[i].getFieldValue('NAME'); + if (otherVar && otherVar.toLowerCase() == caselessName) { + return null; + } + } + + // Don't create variables for arg blocks that + // only exist in the mutator's flyout. + if (sourceBlock.isInFlyout) { + return varName; + } + + var model = outerWs.getVariable(varName, ''); + if (model && model.name != varName) { + // Rename the variable (case change) + outerWs.renameVariableById(model.getId(), varName); + } + if (!model) { + model = outerWs.createVariable(varName, ''); + if (model && this.createdVariables_) { + this.createdVariables_.push(model); + } + } + return varName; + }, + + /** + * Called when focusing away from the text field. + * Deletes all variables that were created as the user typed their intended + * variable name. + * @param {string} newText The new variable name. + * @private + * @this Blockly.FieldTextInput + */ + deleteIntermediateVars_: function (newText) { + var outerWs = this.getSourceBlock().workspace.getRootWorkspace(); + if (!outerWs) { + return; + } + for (var i = 0; i < this.createdVariables_.length; i++) { + var model = this.createdVariables_[i]; + if (model.name != newText) { + outerWs.deleteVariableById(model.getId()); + } + } + } +}; + +export const procedures_callnoreturn = { + /** + * Block for calling a procedure with no return value. + * @this Blockly.Block + */ + init: function () { + this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL); + this.setColour(PROCEDURES_HUE); + this.appendDummyInput('TOPROW') + .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO) + .appendField(this.id, 'NAME'); + this.setPreviousStatement(true); + this.setNextStatement(true); + // Tooltip is set in renameProcedure. + this.arguments_ = []; + this.quarkConnections_ = {}; + this.quarkIds_ = null; + }, + /** + * Returns the name of the procedure this block calls. + * @return {string} Procedure name. + * @this {Blockly.Block} + */ + getProcedureCall: function () { + // The NAME field is guaranteed to exist, null will never be returned. + return /** @type {string} */ (this.getFieldValue('NAME')); + }, + /** + * Notification that a procedure is renaming. + * If the name matches this block's procedure, rename it. + * @param {string} oldName Previous name of procedure. + * @param {string} newName Renamed procedure. + * @this {Blockly.Block} + */ + renameProcedure: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getProcedureCall())) { + this.setFieldValue(newName, 'NAME'); + var baseMsg = this.outputConnection ? + Blockly.Msg['PROCEDURES_CALLRETURN_TOOLTIP'] : + Blockly.Msg['PROCEDURES_CALLNORETURN_TOOLTIP']; + this.setTooltip(baseMsg.replace('%1', newName)); + } + }, + /** + * Notification that the procedure's parameters have changed. + * @param {!Array} paramNames New param names, e.g. ['x', 'y', 'z']. + * @param {!Array} paramIds IDs of params (consistent for each + * parameter through the life of a mutator, regardless of param renaming), + * e.g. ['piua', 'f8b_', 'oi.o']. + * @private + * @this {Blockly.Block} + */ + setProcedureParameters_: function (paramNames, paramIds) { + // Data structures: + // this.arguments = ['x', 'y'] + // Existing param names. + // this.quarkConnections_ {piua: null, f8b_: Connection} + // Look-up of paramIds to connections plugged into the call block. + // this.quarkIds_ = ['piua', 'f8b_'] + // Existing param IDs. + // Note that quarkConnections_ may include IDs that no longer exist, but + // which might reappear if a param is reattached in the mutator. + const defBlock = Procedures.getDefinition( + this.getProcedureCall(), + this.workspace, + ); + const mutatorIcon = defBlock && defBlock.getIcon(Blockly.icons.MutatorIcon.TYPE); + const mutatorOpen = mutatorIcon && mutatorIcon.bubbleIsVisible(); + if (!mutatorOpen) { + this.quarkConnections_ = {}; + this.quarkIds_ = null; + } else { + // fix #6091 - this call could cause an error when outside if-else + // expanding block while mutating prevents another error (ancient fix) + this.setCollapsed(false); + } + // Test arguments (arrays of strings) for changes. '\n' is not a valid + // argument name character, so it is a valid delimiter here. + if (paramNames.join('\n') === this.arguments_.join('\n')) { + // No change. + this.quarkIds_ = paramIds; + return; + } + if (paramIds.length !== paramNames.length) { + throw Error('paramNames and paramIds must be the same length.'); + } + if (!this.quarkIds_) { + // Initialize tracking for this block. + this.quarkConnections_ = {}; + this.quarkIds_ = []; + } + // Update the quarkConnections_ with existing connections. + for (let i = 0; i < this.arguments_.length; i++) { + const input = this.getInput('ARG' + i); + if (input) { + const connection = input?.connection?.targetConnection; + this.quarkConnections_[this.quarkIds_[i]] = connection; + if ( + mutatorOpen && + connection && + !paramIds.includes(this.quarkIds_[i]) + ) { + // This connection should no longer be attached to this block. + connection.disconnect(); + connection.getSourceBlock().bumpNeighbours(); + } + } + } + // Rebuild the block's arguments. + this.arguments_ = [].concat(paramNames); + // And rebuild the argument model list. + this.argumentVarModels_ = []; + for (var i = 0; i < this.arguments_.length; i++) { + var variable = Blockly.Variables.getOrCreateVariablePackage( + this.workspace, null, this.arguments_[i], ''); + this.argumentVarModels_.push(variable); + } + + this.updateShape_(); + this.quarkIds_ = paramIds; + // Reconnect any child blocks. + if (this.quarkIds_) { + for (let i = 0; i < this.arguments_.length; i++) { + const quarkId = this.quarkIds_[i]; // TODO(#6920) + if (quarkId in this.quarkConnections_) { + // TODO(#6920): investigate claimed circular initialisers. + const connection = this.quarkConnections_[quarkId]; + if (!connection?.reconnect(this, 'ARG' + i)) { + // Block no longer exists or has been attached elsewhere. + delete this.quarkConnections_[quarkId]; + } + } + } + } + }, + /** + * Modify this block to have the correct number of arguments. + * @private + * @this {Blockly.Block} + */ + updateShape_: function () { + for (var i = 0; i < this.arguments_.length; i++) { + var field = this.getField('ARGNAME' + i); + if (field) { + // Ensure argument name is up to date. + // The argument name field is deterministic based on the mutation, + // no need to fire a change event. + Blockly.Events.disable(); + try { + field.setValue(this.arguments_[i]); + } finally { + Blockly.Events.enable(); + } + } else { + // Add new input. + field = new Blockly.FieldLabel(this.arguments_[i]); + var input = this.appendValueInput('ARG' + i) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(field, 'ARGNAME' + i); + input.init(); + } + } + // Remove deleted inputs. + while (this.getInput('ARG' + i)) { + this.removeInput('ARG' + i); + i++; + } + // Add 'with:' if there are parameters, remove otherwise. + var topRow = this.getInput('TOPROW'); + if (topRow) { + if (this.arguments_.length) { + if (!this.getField('WITH')) { + topRow.appendField(Blockly.Msg['PROCEDURES_CALL_BEFORE_PARAMS'], 'WITH'); + topRow.init(); + } + } else { + if (this.getField('WITH')) { + topRow.removeField('WITH'); + } + } + } + }, + /** + * Create XML to represent the (non-editable) name and arguments. + * @return {!Element} XML storage element. + * @this {Blockly.Block} + */ + mutationToDom: function () { + var container = Blockly.utils.xml.createElement('mutation'); + container.setAttribute('name', this.getProcedureCall()); + for (var i = 0; i < this.arguments_.length; i++) { + var parameter = Blockly.utils.xml.createElement('arg'); + parameter.setAttribute('name', this.arguments_[i]); + container.appendChild(parameter); + } + return container; + }, + /** + * Parse XML to restore the (non-editable) name and parameters. + * @param {!Element} xmlElement XML storage element. + * @this {Blockly.Block} + */ + domToMutation: function (xmlElement) { + var name = xmlElement.getAttribute('name'); + this.renameProcedure(this.getProcedureCall(), name); + var args = []; + var paramIds = []; + for (var i = 0, childNode; (childNode = xmlElement.childNodes[i]); i++) { + if (childNode.nodeName.toLowerCase() == 'arg') { + args.push(childNode.getAttribute('name')); + paramIds.push(childNode.getAttribute('paramId')); + } + } + this.setProcedureParameters_(args, paramIds); + }, + /** + * Returns the state of this block as a JSON serializable object. + * + * @returns The state of this block, ie the params and procedure name. + */ + saveExtraState: function () { + const state = Object.create(null); + state['name'] = this.getProcedureCall(); + if (this.arguments_.length) { + state['params'] = this.arguments_; + } + return state; + }, + /** + * Applies the given state to this block. + * + * @param state The state to apply to this block, ie the params and + * procedure name. + */ + loadExtraState: function (state) { + this.renameProcedure(this.getProcedureCall(), state['name']); + const params = state['params']; + if (params) { + const ids = []; + ids.length = params.length; + ids.fill(null); // TODO(#6920) + this.setProcedureParameters_(params, ids); + } + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable names. + * @this {Blockly.Block} + */ + getVars: function () { + return this.arguments_; + }, + /** + * Return all variables referenced by this block. + * @return {!Array} List of variable models. + * @this {Blockly.Block} + */ + getVarModels: function () { + return this.argumentVarModels_; + }, + /** + * Procedure calls cannot exist without the corresponding procedure + * definition. Enforce this link whenever an event is fired. + * @param {!Blockly.Events.Abstract} event Change event. + * @this {Blockly.Block} + */ + onchange: function (event) { + if (!this.workspace || this.workspace.isFlyout) { + // Block is deleted or is in a flyout. + return; + } + if (!event.recordUndo) { + // Events not generated by user. Skip handling. + return; + } + if (event.type == Blockly.Events.BLOCK_CREATE && + event.ids.indexOf(this.id) != -1) { + // Look for the case where a procedure call was created (usually through + // paste) and there is no matching definition. In this case, create + // an empty definition block with the correct signature. + var name = this.getProcedureCall(); + var def = Procedures.getDefinition(name, this.workspace); + if (def && (def.type != this.defType_)) { + // The signatures don't match. + def = null; + } + if (!def) { + Blockly.Events.setGroup(event.group); + /** + * Create matching definition block. + * + * + * + * + * + * test + * + * + */ + var xml = Blockly.utils.xml.createElement('xml'); + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', this.defType_); + var xy = this.getRelativeToSurfaceXY(); + var x = xy.x + Blockly.SNAP_RADIUS * (this.RTL ? -1 : 1); + var y = xy.y + Blockly.SNAP_RADIUS * 2; + block.setAttribute('x', x); + block.setAttribute('y', y); + var mutation = this.mutationToDom(); + block.appendChild(mutation); + var field = Blockly.utils.xml.createElement('field'); + field.setAttribute('name', 'NAME'); + var callName = this.getProcedureCall(); + if (!callName) { + // Rename if name is empty string. + callName = Procedures.findLegalName('', this); + this.renameProcedure('', callName); + } + field.appendChild(Blockly.utils.xml.createTextNode(callName)); + block.appendChild(field); + xml.appendChild(block); + Blockly.Xml.domToWorkspace(xml, this.workspace); + Blockly.Events.setGroup(false); + } else { + if (JSON.stringify(def.getVars()) != JSON.stringify(this.arguments_)) { + let paramNames = def.arguments_; + let paramIds = []; + for (var i = 0; i < this.arguments_.length; i++) { + var input = this.getInput('ARG' + i); + if (!input) { + continue; + } + var connection = input.connection.targetConnection; + if (!connection) { + paramIds.push(null); + continue; + } + paramIds.push(connection.sourceBlock_.id); + } + this.setProcedureParameters_(paramNames, paramIds); + } + } + } else if (event.type == Blockly.Events.BLOCK_DELETE) { + // Look for the case where a procedure definition has been deleted, + // leaving this block (a procedure call) orphaned. In this case, delete + // the orphan. + var name = this.getProcedureCall(); + var def = Procedures.getDefinition(name, this.workspace); + if (!def) { + Blockly.Events.setGroup(event.group); + this.dispose(true); + Blockly.Events.setGroup(false); + } + } else if (event.type == Blockly.Events.CHANGE && event.element == 'disabled') { + var name = this.getProcedureCall(); + var def = Procedures.getDefinition(name, this.workspace); + if (def && def.id == event.blockId) { + // in most cases the old group should be '' + var oldGroup = Blockly.Events.getGroup(); + if (oldGroup) { + // This should only be possible programmatically and may indicate a problem + // with event grouping. If you see this message please investigate. If the + // use ends up being valid we may need to reorder events in the undo stack. + console.log('Saw an existing group while responding to a definition change'); + } + Blockly.Events.setGroup(event.group); + if (event.newValue) { + this.previousEnabledState_ = this.isEnabled(); + this.setEnabled(false); + } else { + this.setEnabled(this.previousEnabledState_); + } + Blockly.Events.setGroup(oldGroup); + } + } + }, + /** + * Add menu option to find the definition block for this call. + * @param {!Array} options List of menu options to add to. + * @this {Blockly.Block} + */ + customContextMenu: function (options) { + if (!this.workspace.isMovable()) { + // If we center on the block and the workspace isn't movable we could + // loose blocks at the edges of the workspace. + return; + } + + var option = { enabled: true }; + option.text = Blockly.Msg['PROCEDURES_HIGHLIGHT_DEF']; + var name = this.getProcedureCall(); + var workspace = this.workspace; + option.callback = function () { + var def = Procedures.getDefinition(name, workspace); + if (def) { + workspace.centerOnBlock(def.id); + def.select(); + } + }; + options.push(option); + }, + defType_: 'procedures_defnoreturn' +}; + +export const procedures_callreturn = { + /** + * Block for calling a procedure with a return value. + * @this Blockly.Block + */ + init: function () { + this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL); + this.setColour(PROCEDURES_HUE); + this.appendDummyInput('TOPROW') + .appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL) + .appendField('', 'NAME'); + this.setOutput(true); + // Tooltip is set in domToMutation. + this.arguments_ = []; + this.quarkConnections_ = {}; + this.quarkIds_ = null; + }, + getProcedureCall: procedures_callnoreturn.getProcedureCall, + renameProcedure: procedures_callnoreturn.renameProcedure, + setProcedureParameters_: + procedures_callnoreturn.setProcedureParameters_, + updateShape_: procedures_callnoreturn.updateShape_, + mutationToDom: procedures_callnoreturn.mutationToDom, + domToMutation: procedures_callnoreturn.domToMutation, + saveExtraState: procedures_callnoreturn.saveExtraState, + loadExtraState: procedures_callnoreturn.loadExtraState, + renameVar: procedures_callnoreturn.renameVar, + getVars: procedures_callnoreturn.getVars, + getVarModels: procedures_callnoreturn.getVarModels, + onchange: procedures_callnoreturn.onchange, + customContextMenu: procedures_callnoreturn.customContextMenu, + defType_: 'procedures_defreturn' +}; + +export const procedures_ifreturn = { + /** + * Block for conditionally returning a value from a procedure. + * @this Blockly.Block + */ + init: function () { + this.setColour(PROCEDURES_HUE); + this.appendValueInput('CONDITION') + .setCheck(Boolean) + .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF); + this.appendValueInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP); + this.hasReturnValue_ = true; + }, + /** + * Create XML to represent whether this block has a return value. + * @return {!Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement('mutation'); + container.setAttribute('value', Number(this.hasReturnValue_)); + return container; + }, + /** + * Parse XML to restore whether this block has a return value. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + var value = xmlElement.getAttribute('value'); + this.hasReturnValue_ = (value == 1); + if (!this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendDummyInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + } + }, + /** + * Called whenever anything on the workspace changes. + * Add warning if this flow block is not nested inside a loop. + * @param {!Blockly.Events.Abstract} e Change event. + * @this Blockly.Block + */ + onchange: function () { + var legal = false; + // Is the block nested in a procedure? + var block = this; + do { + if (this.FUNCTION_TYPES.indexOf(block.type) != -1) { + legal = true; + break; + } + block = block.getSurroundParent(); + } while (block); + if (legal) { + // If needed, toggle whether this block has a return value. + if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendDummyInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.hasReturnValue_ = false; + } else if (block.type == 'procedures_defreturn' && + !this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendValueInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.hasReturnValue_ = true; + } + this.setWarningText(null); + } else { + this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING); + } + }, + /** + * List of block types that are functions and thus do not need warnings. + * To add a new function type add this to your code: + * procedures_ifreturn.FUNCTION_TYPES.push('custom_func'); + */ + FUNCTION_TYPES: ['procedures_defnoreturn', 'procedures_defreturn'] +}; + + +export const procedures_return = { + /** + * Block for conditionally returning a value from a procedure. + * @this Blockly.Block + */ + init: function () { + this.setColour(PROCEDURES_HUE); + // this.appendValueInput('CONDITION') + // .setCheck(Boolean) + // .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF); + this.appendValueInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(); + this.hasReturnValue_ = true; + }, + /** + * Create XML to represent whether this block has a return value. + * @return {!Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement('mutation'); + container.setAttribute('value', Number(this.hasReturnValue_)); + return container; + }, + /** + * Parse XML to restore whether this block has a return value. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + var value = xmlElement.getAttribute('value'); + this.hasReturnValue_ = (value == 1); + if (!this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendDummyInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + } + }, + /** + * Called whenever anything on the workspace changes. + * Add warning if this flow block is not nested inside a loop. + * @param {!Blockly.Events.Abstract} e Change event. + * @this Blockly.Block + */ + onchange: function () { + var legal = false; + // Is the block nested in a procedure? + var block = this; + do { + if (this.FUNCTION_TYPES.indexOf(block.type) != -1) { + legal = true; + break; + } + block = block.getSurroundParent(); + } while (block); + if (legal) { + // If needed, toggle whether this block has a return value. + if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendDummyInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.hasReturnValue_ = false; + } else if (block.type == 'procedures_defreturn' && + !this.hasReturnValue_) { + this.removeInput('VALUE'); + this.appendValueInput('VALUE') + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.hasReturnValue_ = true; + } + this.setWarningText(null); + } else { + this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING); + } + }, + /** + * List of block types that are functions and thus do not need warnings. + * To add a new function type add this to your code: + * procedures_ifreturn.FUNCTION_TYPES.push('custom_func'); + */ + FUNCTION_TYPES: ['procedures_defnoreturn', 'procedures_defreturn'] +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/blocks/text.js b/mixly/boards/default_src/arduino/blocks/text.js new file mode 100644 index 00000000..f16eea02 --- /dev/null +++ b/mixly/boards/default_src/arduino/blocks/text.js @@ -0,0 +1,24 @@ +import * as Blockly from 'blockly/core'; + +const TEXTS_HUE = 160; + + +export const text_base64_url_codec = { + init: function () { + this.appendValueInput('VALUE') + .setCheck(null) + .setAlign(Blockly.inputs.Align.LEFT) + .appendField(new Blockly.FieldDropdown([ + ['Base64', 'BASE64'], + ['URL', 'URL'] + ]), 'TYPE') + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXPY_TEXT_ENCODE, 'ENCODE'], + [Blockly.Msg.MIXPY_TEXT_DECODE, 'DECODE'] + ]), 'OPTION'); + this.setOutput(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(''); + this.setHelpUrl(''); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/blocks/variables.js b/mixly/boards/default_src/arduino/blocks/variables.js new file mode 100644 index 00000000..77c6ca63 --- /dev/null +++ b/mixly/boards/default_src/arduino/blocks/variables.js @@ -0,0 +1,85 @@ +import * as Blockly from 'blockly/core'; +import { Variables } from 'blockly/core'; + +const VARIABLES_HUE = 330; + + +export const variables_declare = { + init: function () { + this.setColour(VARIABLES_HUE); + this.appendValueInput('VALUE', null) + .appendField(Blockly.Msg.MIXLY_DECLARE) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GLOBAL_VARIABLE, 'global_variate'], + [Blockly.Msg.MIXLY_LOCAL_VARIABLE, 'local_variate'] + ]), 'variables_type') + .appendField(new Blockly.FieldTextInput('item'), 'VAR') + .appendField(Blockly.Msg.MIXLY_AS) + .appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), 'TYPE') + .appendField(Blockly.Msg.MIXLY_VALUE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_VARIABLES_DECLARE); + }, + getVars: function () { + return [this.getFieldValue('VAR')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) { + this.setFieldValue(newName, 'VAR'); + } + } +}; + +export const variables_get = { + init: function () { + this.setColour(VARIABLES_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput('item'), 'VAR') + this.setOutput(true); + this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP); + }, + getVars: function () { + return [this.getFieldValue('VAR')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) { + this.setFieldValue(newName, 'VAR'); + } + } +}; + +export const variables_set = { + init: function () { + this.setColour(VARIABLES_HUE); + this.appendValueInput('VALUE') + .appendField(new Blockly.FieldTextInput('item'), 'VAR') + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP); + }, + getVars: function () { + return [this.getFieldValue('VAR')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) { + this.setFieldValue(newName, 'VAR'); + } + } +}; + +/** + * Block for basic data type change. + * @this Blockly.Block + */ +export const variables_change = { + init: function () { + this.setColour(VARIABLES_HUE); + this.appendValueInput('MYVALUE') + .appendField(new Blockly.FieldDropdown(Variables.DATA_TYPE), 'OP'); + // Assign 'this' to a variable for use in the tooltip closure below. + this.setOutput(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_VARIABLES_CHANGE); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/export.js b/mixly/boards/default_src/arduino/export.js new file mode 100644 index 00000000..4a8c935e --- /dev/null +++ b/mixly/boards/default_src/arduino/export.js @@ -0,0 +1,28 @@ +import * as ArduinoEthernetBlocks from './blocks/ethernet'; +import * as ArduinoProceduresBlocks from './blocks/procedures'; +import * as ArduinoTextBlocks from './blocks/text'; +import * as ArduinoVariablesBlocks from './blocks/variables'; +import * as ArduinoProceduresGenerators from './generators/procedures'; +import * as ArduinoEthernetGenerators from './generators/ethernet'; +import * as ArduinoTextGenerators from './generators/text'; +import * as ArduinoVariablesGenerators from './generators/variables'; +import Names from './others/names'; +import Procedures from './others/procedures'; +import Variables from './others/variables'; +import { ArduinoGenerator, Arduino } from './arduino_generator'; + +export { + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + Names, + Procedures, + Variables, + ArduinoGenerator, + Arduino +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/generators/ethernet.js b/mixly/boards/default_src/arduino/generators/ethernet.js new file mode 100644 index 00000000..242b275f --- /dev/null +++ b/mixly/boards/default_src/arduino/generators/ethernet.js @@ -0,0 +1,196 @@ +import * as Blockly from 'blockly/core'; +import * as Mixly from 'mixly'; +import CITYS_DATA from '../templates/json/cities.json'; + + +/** + * @name 模块名 Http GET请求 + * @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3} + */ +export const http_get = function () { + const BOARD_TYPE = Mixly.Boards.getType(); + const API = Blockly.Arduino.valueToCode(this, 'api', Blockly.Arduino.ORDER_ATOMIC); + let branch = Blockly.Arduino.statementToCode(this, 'success') || ''; + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + let branch1 = Blockly.Arduino.statementToCode(this, 'failure') || ''; + branch1 = branch1.replace(/(^\s*)|(\s*$)/g, ""); + let code = ''; + if (BOARD_TYPE == 'arduino_esp8266') { + Blockly.Arduino.definitions_['include_ESP8266WiFi'] = '#include '; + Blockly.Arduino.definitions_['include_ESP8266HTTPClient'] = '#include '; + code + = 'if (WiFi.status() == WL_CONNECTED) {\n' + + ' WiFiClient client;\n' + + ' HTTPClient http;\n' + + ' http.begin(client, ' + API + ');\n' + + ' int httpCode = http.GET();\n' + + ' if (httpCode > 0) {\n' + + ' String Request_result = http.getString();\n' + + ' ' + branch + '\n' + + ' } else {\n' + + ' ' + branch1 + '\n' + + ' }\n' + + ' http.end();\n' + + '}\n'; + } else { + Blockly.Arduino.definitions_['include_WiFi'] = '#include '; + Blockly.Arduino.definitions_['include_HTTPClient'] = '#include '; + code + = 'if (WiFi.status() == WL_CONNECTED) {\n' + + ' HTTPClient http;\n' + + ' http.begin(' + API + ');\n' + + ' int httpCode = http.GET();\n' + + ' if (httpCode > 0) {\n' + + ' String Request_result = http.getString();\n' + + ' ' + branch + '\n' + + ' }\n' + + ' else {\n' + + ' ' + branch1 + '\n' + + ' }\n' + + ' http.end();\n' + + '}\n'; + } + return code; +}; + +/** + * @name 模块名 Http PATCH|POST|PUT请求 + * @support 支持板卡 {ESP8266, ESP32, ESP32C3, ESP32S2, ESP32S3} + */ +export const http_post = function () { + const BOARD_TYPE = Mixly.Boards.getType(); + const FIELD_TYPE = this.getFieldValue("TYPE"); + const API = Blockly.Arduino.valueToCode(this, 'api', Blockly.Arduino.ORDER_ATOMIC); + const DATA = Blockly.Arduino.valueToCode(this, 'data', Blockly.Arduino.ORDER_ATOMIC); + let branch = Blockly.Arduino.statementToCode(this, 'success') || ''; + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + let branch1 = Blockly.Arduino.statementToCode(this, 'failure') || ''; + branch1 = branch1.replace(/(^\s*)|(\s*$)/g, ""); + let code = ''; + if (BOARD_TYPE == 'arduino_esp8266') { + Blockly.Arduino.definitions_['include_ESP8266WiFi'] = '#include '; + Blockly.Arduino.definitions_['include_ESP8266HTTPClient'] = '#include '; + code + = 'if (WiFi.status() == WL_CONNECTED) {\n' + + ' HTTPClient http;\n' + + ' WiFiClient client;\n' + + ' http.begin(client, ' + API + ');\n' + + ' http.addHeader("Content-Type", "application/json");\n' + + ' int httpCode = http.' + FIELD_TYPE + '(' + DATA + ');\n' + + ' if (httpCode > 0) {\n' + + ' String Request_result = http.getString();\n' + + ' ' + branch + '\n' + + ' } else {\n' + + ' ' + branch1 + '\n' + + ' }\n' + + ' http.end();\n' + + '}\n'; + } else { + Blockly.Arduino.definitions_['include_WiFi'] = '#include '; + Blockly.Arduino.definitions_['include_HTTPClient'] = '#include '; + code + = 'if (WiFi.status() == WL_CONNECTED) {\n' + + ' HTTPClient http;\n' + + ' http.begin(' + API + ');\n' + + ' http.addHeader("Content-Type", "application/json");\n' + + ' int httpCode = http.' + FIELD_TYPE + '(' + DATA + ');\n' + + ' if (httpCode > 0) {\n' + + ' String Request_result = http.getString();\n' + + ' ' + branch + '\n' + + ' }\n' + + ' else {\n' + + ' ' + branch1 + '\n' + + ' }\n' + + ' http.end();\n' + + '}\n'; + } + return code; +}; + +//网络天气 +export const china_city = function () { + var a = this.getFieldValue("province"); + var b = this.getFieldValue("city"); + var code = ""; + try { + code = '"' + CITYS_DATA[a][b].pinyin + '"'; + } catch (e) { + console.log(e); + } + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; + +export const weather_private_key = function () { + var a = this.getFieldValue("key"); + var code = '"' + a + '"'; + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; + +export const weather_seniverse_city_weather = function () { + var api = this.getFieldValue("api"); + var location = Blockly.Arduino.valueToCode(this, "location", Blockly.Arduino.ORDER_ATOMIC); + var private_key = Blockly.Arduino.valueToCode(this, "private_key", Blockly.Arduino.ORDER_ATOMIC); + //private_key = private_key.replace(/\"/g, "") + var language = this.getFieldValue("language"); + var unit = this.getFieldValue("unit"); + + Blockly.Arduino.definitions_['include_ESP8266_Seniverse'] = '#include '; + + Blockly.Arduino.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + + switch (api) { + case 'weather/now': + Blockly.Arduino.definitions_['var_declare_weatherNow'] = 'WeatherNow weatherNow;'; + Blockly.Arduino.setups_['setup_seniverse_weatherNow'] = 'weatherNow.config(' + private_key + ', ' + location + ', "' + unit + '", "' + language + '");'; + break; + case 'weather/daily': + Blockly.Arduino.definitions_['var_declare_forecast'] = 'Forecast forecast;'; + Blockly.Arduino.setups_['setup_seniverse_forecast'] = 'forecast.config(' + private_key + ', ' + location + ', "' + unit + '", "' + language + '");'; + break; + case 'life/suggestion': + default: + Blockly.Arduino.definitions_['var_declare_lifeInfo'] = 'LifeInfo lifeInfo;'; + Blockly.Arduino.setups_['setup_seniverse_lifeInfo'] = 'lifeInfo.config(' + private_key + ', ' + location + ', "' + unit + '", "' + language + '");'; + } + var code = ''; + + return code; +}; + +export const weather_get_seniverse_weather_info = function () { + var api = this.getFieldValue("api"); + var type = this.getFieldValue("type"); + var code = ''; + switch (api) { + case 'weather/now': + code = 'weatherNow.' + type + '()'; + break; + case 'weather/daily': + code = 'forecast.' + type + '()'; + break; + case 'life/suggestion': + default: + code = 'lifeInfo.' + type + '()'; + } + + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; + +export const weather_get_seniverse_weather_info1 = function () { + var type = this.getFieldValue("type"); + var code = 'weatherNow.' + type + '()'; + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; + +export const weather_get_seniverse_weather_info2 = function () { + var date = this.getFieldValue("date"); + var type = this.getFieldValue("type"); + var code = 'forecast.' + type + '(' + date + ')'; + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; + +export const weather_get_seniverse_weather_info3 = function () { + var type = this.getFieldValue("type"); + var code = 'lifeInfo.' + type + '()'; + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/generators/procedures.js b/mixly/boards/default_src/arduino/generators/procedures.js new file mode 100644 index 00000000..ab180a60 --- /dev/null +++ b/mixly/boards/default_src/arduino/generators/procedures.js @@ -0,0 +1,114 @@ +import { Variables, Procedures } from 'blockly/core'; + +export const procedures_defreturn = function (_, generator) { + // Define a procedure with a return value. + var funcName = generator.variableDB_.getName(this.getFieldValue('NAME'), + Procedures.NAME_TYPE); + var branch = (this.getInput('STACK') && generator.statementToCode(this, 'STACK')); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, + '\'' + this.id + '\'') + branch; + } + var returnValue = generator.valueToCode(this, 'RETURN', + generator.ORDER_NONE) || ''; + var type = this.getFieldValue('TYPE'); + if (type === 'CUSTOM') { + if (this.getField('RETRUN_TYPE')) { + type = this.getFieldValue('RETRUN_TYPE'); + } else { + type = 'void'; + } + } + if (returnValue) { + returnValue = ' return ' + returnValue + ';\n'; + } + var returnType = type ? type : 'void'; + var args = []; + for (var x = 0; x < this.arguments_.length; x++) { + args[x] = this.argumentstype_[x] + ' ' + generator.variableDB_.getName(this.arguments_[x], + Variables.NAME_TYPE); + } + var code = returnType + ' ' + funcName + '(' + args.join(', ') + ') {\n' + + branch + returnValue + '}\n'; + code = generator.scrub_(this, code); + generator.definitions_[funcName] = code; + return null; +} + +export const procedures_defnoreturn = function (_, generator) { + // Define a procedure with a return value. + var funcName = generator.variableDB_.getName(this.getFieldValue('NAME'), + Procedures.NAME_TYPE); + var branch = (this.getInput('STACK') && generator.statementToCode(this, 'STACK')); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, + '\'' + this.id + '\'') + branch; + } + var returnType = 'void'; + var args = []; + for (var x = 0; x < this.arguments_.length; x++) { + args[x] = this.argumentstype_[x] + ' ' + generator.variableDB_.getName(this.arguments_[x], + Variables.NAME_TYPE); + } + var code = returnType + ' ' + funcName + '(' + args.join(', ') + ') {\n' + + branch + '}\n'; + code = generator.scrub_(this, code); + generator.definitions_[funcName] = code; + return null; +} + +export const procedures_callreturn = function (_, generator) { + // Call a procedure with a return value. + var funcName = generator.variableDB_.getName(this.getFieldValue('NAME'), + Procedures.NAME_TYPE); + var args = []; + for (var x = 0; x < this.arguments_.length; x++) { + args[x] = generator.valueToCode(this, 'ARG' + x, + generator.ORDER_NONE) || 'null'; + } + var code = funcName + '(' + args.join(', ') + ')'; + return [code, generator.ORDER_UNARY_POSTFIX]; +} + +export const procedures_callnoreturn = function (_, generator) { + // Call a procedure with no return value. + var funcName = generator.variableDB_.getName(this.getFieldValue('NAME'), + Procedures.NAME_TYPE); + var args = []; + for (var x = 0; x < this.arguments_.length; x++) { + args[x] = generator.valueToCode(this, 'ARG' + x, + generator.ORDER_NONE) || 'null'; + } + var code = funcName + '(' + args.join(', ') + ');\n'; + return code; +} + +export const procedures_ifreturn = function (_, generator) { + // Conditionally return value from a procedure. + var condition = generator.valueToCode(this, 'CONDITION', + generator.ORDER_NONE) || 'false'; + var code = 'if (' + condition + ') {\n'; + if (this.hasReturnValue_) { + var value = generator.valueToCode(this, 'VALUE', + generator.ORDER_NONE) || ''; + code += ' return ' + value + ';\n'; + } else { + code += ' return;\n'; + } + code += '}\n'; + return code; +} + +export const procedures_return = function (_, generator) { + // Conditionally return value from a procedure. + var code = "" + if (this.hasReturnValue_) { + var value = generator.valueToCode(this, 'VALUE', + generator.ORDER_NONE) || 'None'; + code += 'return ' + value + ';\n'; + } else { + code += 'return;\n'; + } + code += '\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/generators/text.js b/mixly/boards/default_src/arduino/generators/text.js new file mode 100644 index 00000000..065f74e0 --- /dev/null +++ b/mixly/boards/default_src/arduino/generators/text.js @@ -0,0 +1,37 @@ +import * as Blockly from 'blockly/core'; + +export const text_base64_url_codec = function () { + const FIELD_TYPE = this.getFieldValue("TYPE"); + const FIELD_OPTION = this.getFieldValue("OPTION"); + const VALUE_INPUT_VALUE = Blockly.Arduino.valueToCode(this, "VALUE", Blockly.Arduino.ORDER_ATOMIC); + let code = ''; + if (FIELD_TYPE === 'BASE64') { + Blockly.Arduino.definitions_['include_rBase64'] = '#include '; + if (FIELD_OPTION === 'ENCODE') { + code = 'rbase64.encode(' + VALUE_INPUT_VALUE + ')'; + } else { + code = 'rbase64.decode(' + VALUE_INPUT_VALUE + ')'; + } + } else { + Blockly.Arduino.definitions_['include_URLCode'] = '#include '; + Blockly.Arduino.definitions_['var_declare_urlCode'] = 'URLCode urlCode;'; + if (FIELD_OPTION === 'ENCODE') { + Blockly.Arduino.definitions_['function_urlEncode'] + = 'String urlEncode(String urlStr) {\n' + + ' urlCode.strcode = urlStr;\n' + + ' urlCode.urlencode();\n' + + ' return urlCode.urlcode;\n' + + '}\n'; + code = 'urlEncode(' + VALUE_INPUT_VALUE + ')'; + } else { + Blockly.Arduino.definitions_['function_urlDecode'] + = 'String urlDecode(String urlStr) {\n' + + ' urlCode.urlcode = urlStr;\n' + + ' urlCode.urldecode();\n' + + ' return urlCode.strcode;\n' + + '}\n'; + code = 'urlDecode(' + VALUE_INPUT_VALUE + ')'; + } + } + return [code, Blockly.Arduino.ORDER_ATOMIC]; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/generators/variables.js b/mixly/boards/default_src/arduino/generators/variables.js new file mode 100644 index 00000000..cc3c6b52 --- /dev/null +++ b/mixly/boards/default_src/arduino/generators/variables.js @@ -0,0 +1,61 @@ +import { Variables } from 'blockly/core'; + +export const variables_get = function (_, generator) { + // Variable getter. + var code = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + return [code, generator.ORDER_ATOMIC]; +} + +export const variables_declare = function (_, generator) { + var dropdown_type = this.getFieldValue('TYPE'); + var dropdown_variables_type = this.getFieldValue('variables_type'); + var argument0; + var code = ''; + //TODO: settype to variable + if (dropdown_variables_type == 'global_variate') { + if (dropdown_type == 'String') { + argument0 = generator.valueToCode(this, 'VALUE', generator.ORDER_ASSIGNMENT) || '""'; + } else { + argument0 = generator.valueToCode(this, 'VALUE', generator.ORDER_ASSIGNMENT) || '0'; + } + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + if (dropdown_type == 'String' || dropdown_type == 'char*') + generator.definitions_['var_declare' + varName] = dropdown_type + ' ' + varName + ';'; + else + generator.definitions_['var_declare' + varName] = 'volatile ' + dropdown_type + ' ' + varName + ';'; + + generator.setups_['setup_var' + varName] = varName + ' = ' + argument0 + ';'; + } + else { + if (dropdown_type == 'String') { + argument0 = generator.valueToCode(this, 'VALUE', generator.ORDER_ASSIGNMENT) || '""'; + } else { + argument0 = generator.valueToCode(this, 'VALUE', generator.ORDER_ASSIGNMENT) || '0'; + } + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + code = dropdown_type + ' ' + varName + ' = ' + argument0 + ';\n'; + } + //generator.variableTypes_[varName] = dropdown_type;//处理变量类型 + return code; +} + +export const variables_set = function (_, generator) { + // Variable setter. + var argument0 = generator.valueToCode(this, 'VALUE', + generator.ORDER_ASSIGNMENT) || '0'; + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + return varName + ' = ' + argument0 + ';\n'; +} + +export const variables_change = function (_, generator) { + // Variable setter. + var operator = this.getFieldValue('OP'); + var varName = generator.valueToCode(this, 'MYVALUE', generator.ORDER_ASSIGNMENT); + //修复强制类型转换不正确的bug + var code = '((' + operator + ')(' + varName + '))'; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/index.js b/mixly/boards/default_src/arduino/index.js new file mode 100644 index 00000000..e69de29b diff --git a/mixly/boards/default_src/arduino/others/names.js b/mixly/boards/default_src/arduino/others/names.js new file mode 100644 index 00000000..2e69c902 --- /dev/null +++ b/mixly/boards/default_src/arduino/others/names.js @@ -0,0 +1,199 @@ +/** + * @license + * Visual Blocks Editor + * + * Copyright 2012 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Utility functions for handling variables and procedure names. + * @author fraser@google.com (Neil Fraser) + */ + +import { Variables } from 'blockly/core'; + +/** + * Class for a database of entity names (variables, functions, etc). + * @param {string} reservedWords A comma-separated string of words that are + * illegal for use as names in a language (e.g. 'new,if,this,...'). + * @param {string=} opt_variablePrefix Some languages need a '$' or a namespace + * before all variable names. + * @constructor + */ +const Names = function (reservedWords, opt_variablePrefix) { + this.variablePrefix_ = opt_variablePrefix || ''; + this.reservedDict_ = Object.create(null); + if (reservedWords) { + var splitWords = reservedWords.split(','); + for (var i = 0; i < splitWords.length; i++) { + this.reservedDict_[splitWords[i]] = true; + } + } + this.reset(); +}; + +/** + * Constant to separate developer variable names from user-defined variable + * names when running generators. + * A developer variable will be declared as a global in the generated code, but + * will never be shown to the user in the workspace or stored in the variable + * map. + */ +Names.DEVELOPER_VARIABLE_TYPE = 'DEVELOPER_VARIABLE'; + +/** + * When JavaScript (or most other languages) is generated, variable 'foo' and + * procedure 'foo' would collide. However, Blockly has no such problems since + * variable get 'foo' and procedure call 'foo' are unambiguous. + * Therefore, Blockly keeps a separate type name to disambiguate. + * getName('foo', 'variable') -> 'foo' + * getName('foo', 'procedure') -> 'foo2' + */ + +/** + * Empty the database and start from scratch. The reserved words are kept. + */ +Names.prototype.reset = function () { + this.db_ = Object.create(null); + this.dbReverse_ = Object.create(null); + this.variableMap_ = null; +}; + +/** + * Set the variable map that maps from variable name to variable object. + * @param {!Blockly.VariableMap} map The map to track. + * @package + */ +Names.prototype.setVariableMap = function (map) { + this.variableMap_ = map; +}; + +/** + * Get the name for a user-defined variable, based on its ID. + * This should only be used for variables of type Variables.NAME_TYPE. + * @param {string} id The ID to look up in the variable map. + * @return {?string} The name of the referenced variable, or null if there was + * no variable map or the variable was not found in the map. + * @private + */ +Names.prototype.getNameForUserVariable_ = function (id) { + if (!this.variableMap_) { + /* + console.log('Deprecated call to Names.prototype.getName without ' + + 'defining a variable map. To fix, add the folowing code in your ' + + 'generator\'s init() function:\n' + + 'Blockly.YourGeneratorName.variableDB_.setVariableMap(' + + 'workspace.getVariableMap());'); + */ + return null; + } + var variable = this.variableMap_.getVariableById(id); + if (variable) { + return variable.name; + } + return null; +}; + +/** + * Convert a Blockly entity name to a legal exportable entity name. + * @param {string} name The Blockly entity name (no constraints). + * @param {string} type The type of entity in Blockly + * ('VARIABLE', 'PROCEDURE', 'BUILTIN', etc...). + * @return {string} An entity name that is legal in the exported language. + */ +Names.prototype.getName = function (name, type) { + if (type == Variables.NAME_TYPE) { + var varName = this.getNameForUserVariable_(name); + if (varName) { + name = varName; + } + } + var normalized = name + '_' + type; + + var isVarType = type == Variables.NAME_TYPE || + type == Names.DEVELOPER_VARIABLE_TYPE; + + var prefix = isVarType ? this.variablePrefix_ : ''; + if (normalized in this.db_) { + return prefix + this.db_[normalized]; + } + var safeName = this.getDistinctName(name, type); + this.db_[normalized] = safeName.substr(prefix.length); + return safeName; +}; + +/** + * Convert a Blockly entity name to a legal exportable entity name. + * Ensure that this is a new name not overlapping any previously defined name. + * Also check against list of reserved words for the current language and + * ensure name doesn't collide. + * @param {string} name The Blockly entity name (no constraints). + * @param {string} type The type of entity in Blockly + * ('VARIABLE', 'PROCEDURE', 'BUILTIN', etc...). + * @return {string} An entity name that is legal in the exported language. + */ +Names.prototype.getDistinctName = function (name, type) { + var safeName = this.safeName_(name); + var i = ''; + while (this.dbReverse_[safeName + i] || + (safeName + i) in this.reservedDict_) { + // Collision with existing name. Create a unique name. + i = i ? i + 1 : 2; + } + safeName += i; + this.dbReverse_[safeName] = true; + var isVarType = type == Variables.NAME_TYPE || + type == Names.DEVELOPER_VARIABLE_TYPE; + var prefix = isVarType ? this.variablePrefix_ : ''; + return prefix + safeName; +}; + +/** + * Given a proposed entity name, generate a name that conforms to the + * [_A-Za-z][_A-Za-z0-9]* format that most languages consider legal for + * variables. + * @param {string} name Potentially illegal entity name. + * @return {string} Safe entity name. + * @private + */ +Names.prototype.safeName_ = function (name) { + if (!name) { + name = 'unnamed'; + } else { + // Unfortunately names in non-latin characters will look like + // _E9_9F_B3_E4_B9_90 which is pretty meaningless. + // https://github.com/google/blockly/issues/1654 + name = encodeURI(name.replace(/ /g, '_')).replace(/[^,\w]/g, '_'); + // Most languages don't allow names with leading numbers. + if ('0123456789'.indexOf(name[0]) != -1) { + name = 'my_' + name; + } + } + return name; +}; + +/** + * Do the given two entity names refer to the same entity? + * Blockly names are case-insensitive. + * @param {string} name1 First name. + * @param {string} name2 Second name. + * @return {boolean} True if names are the same. + */ +Names.equals = function (name1, name2) { + return name1 == name2; +}; + +export default Names; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/others/procedures.js b/mixly/boards/default_src/arduino/others/procedures.js new file mode 100644 index 00000000..d3d6d253 --- /dev/null +++ b/mixly/boards/default_src/arduino/others/procedures.js @@ -0,0 +1,338 @@ +/** + * @license + * Copyright 2012 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Utility functions for handling procedures. + * @author fraser@google.com (Neil Fraser) + */ + +/** + * @name Blockly.Procedures + * @namespace + */ +import * as Blockly from 'blockly/core'; +import Variables from './variables'; + +const Procedures = {}; + +Procedures.DATA_TYPE = [ + ...Variables.DATA_TYPE, + [Blockly.Msg.MIXLY_OTHER, 'CUSTOM'] +]; + +/** + * Constant to separate procedure names from variables and generated functions + * when running generators. + * @deprecated Use Blockly.PROCEDURE_CATEGORY_NAME + */ +Procedures.NAME_TYPE = Blockly.PROCEDURE_CATEGORY_NAME; + +/** + * Find all user-created procedure definitions in a workspace. + * @param {!Blockly.Workspace} root Root workspace. + * @return {!Array.>} Pair of arrays, the + * first contains procedures without return variables, the second with. + * Each procedure is defined by a three-element list of name, parameter + * list, and return value boolean. + */ +Procedures.allProcedures = function (root) { + var blocks = root.getAllBlocks(false); + var proceduresReturn = []; + var proceduresNoReturn = []; + for (var i = 0; i < blocks.length; i++) { + if (blocks[i].getProcedureDef) { + var tuple = blocks[i].getProcedureDef(); + if (tuple) { + if (tuple[2]) { + proceduresReturn.push(tuple); + } else { + proceduresNoReturn.push(tuple); + } + } + } + } + proceduresNoReturn.sort(Procedures.procTupleComparator_); + proceduresReturn.sort(Procedures.procTupleComparator_); + return [proceduresNoReturn, proceduresReturn]; +}; + +/** + * Comparison function for case-insensitive sorting of the first element of + * a tuple. + * @param {!Array} ta First tuple. + * @param {!Array} tb Second tuple. + * @return {number} -1, 0, or 1 to signify greater than, equality, or less than. + * @private + */ +Procedures.procTupleComparator_ = function (ta, tb) { + return ta[0].toLowerCase().localeCompare(tb[0].toLowerCase()); +}; + +/** + * Ensure two identically-named procedures don't exist. + * Take the proposed procedure name, and return a legal name i.e. one that + * is not empty and doesn't collide with other procedures. + * @param {string} name Proposed procedure name. + * @param {!Blockly.Block} block Block to disambiguate. + * @return {string} Non-colliding name. + */ +Procedures.findLegalName = function (name, block) { + if (block.isInFlyout) { + // Flyouts can have multiple procedures called 'do something'. + return name; + } + name = name || Blockly.Msg['UNNAMED_KEY'] || 'unnamed'; + while (!Procedures.isLegalName_(name, block.workspace, block)) { + // Collision with another procedure. + var r = name.match(/^(.*?)(\d+)$/); + if (!r) { + name += '2'; + } else { + name = r[1] + (parseInt(r[2], 10) + 1); + } + } + return name; +}; + +/** + * Does this procedure have a legal name? Illegal names include names of + * procedures already defined. + * @param {string} name The questionable name. + * @param {!Blockly.Workspace} workspace The workspace to scan for collisions. + * @param {Blockly.Block=} opt_exclude Optional block to exclude from + * comparisons (one doesn't want to collide with oneself). + * @return {boolean} True if the name is legal. + * @private + */ +Procedures.isLegalName_ = function (name, workspace, opt_exclude) { + return !Procedures.isNameUsed(name, workspace, opt_exclude); +}; + +/** + * Return if the given name is already a procedure name. + * @param {string} name The questionable name. + * @param {!Blockly.Workspace} workspace The workspace to scan for collisions. + * @param {Blockly.Block=} opt_exclude Optional block to exclude from + * comparisons (one doesn't want to collide with oneself). + * @return {boolean} True if the name is used, otherwise return false. + */ +Procedures.isNameUsed = function (name, workspace, opt_exclude) { + var blocks = workspace.getAllBlocks(false); + // Iterate through every block and check the name. + for (var i = 0; i < blocks.length; i++) { + if (blocks[i] == opt_exclude) { + continue; + } + if (blocks[i].getProcedureDef) { + var procName = blocks[i].getProcedureDef(); + if (Blockly.Names.equals(procName[0], name)) { + return true; + } + } + } + return false; +}; + +/** + * Rename a procedure. Called by the editable field. + * @param {string} name The proposed new name. + * @return {string} The accepted name. + * @this {Blockly.Field} + */ +Procedures.rename = function (name) { + // Strip leading and trailing whitespace. Beyond this, all names are legal. + name = name.trim(); + + var legalName = Procedures.findLegalName(name, this.getSourceBlock()); + var oldName = this.getValue(); + if (oldName != name && oldName != legalName) { + // Rename any callers. + var blocks = this.getSourceBlock().workspace.getAllBlocks(false); + for (var i = 0; i < blocks.length; i++) { + if (blocks[i].renameProcedure) { + blocks[i].renameProcedure(oldName, legalName); + } + } + } + return legalName; +}; + +/** + * Construct the blocks required by the flyout for the procedure category. + * @param {!Blockly.Workspace} workspace The workspace containing procedures. + * @return {!Array.} Array of XML block elements. + */ +Procedures.flyoutCategory = function (workspace) { + var xmlList = []; + if (Blockly.Blocks['procedures_defnoreturn']) { + // + // do something + // + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'procedures_defnoreturn'); + block.setAttribute('gap', 16); + var nameField = Blockly.utils.xml.createElement('field'); + nameField.setAttribute('name', 'NAME'); + nameField.appendChild(Blockly.utils.xml.createTextNode( + Blockly.Msg['PROCEDURES_DEFNORETURN_PROCEDURE'])); + block.appendChild(nameField); + xmlList.push(block); + } + if (Blockly.Blocks['procedures_defreturn']) { + // + // do something + // + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'procedures_defreturn'); + block.setAttribute('gap', 16); + let nameField = Blockly.utils.xml.createElement('field'); + nameField.setAttribute('name', 'NAME'); + nameField.appendChild(Blockly.utils.xml.createTextNode( + Blockly.Msg['PROCEDURES_DEFRETURN_PROCEDURE'])); + block.appendChild(nameField); + xmlList.push(block); + } + if (Blockly.Blocks['procedures_return']) { + // + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'procedures_return'); + block.setAttribute('gap', 16); + xmlList.push(block); + } + if (Blockly.Blocks['procedures_ifreturn']) { + // + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'procedures_ifreturn'); + block.setAttribute('gap', 16); + xmlList.push(block); + } + if (xmlList.length) { + // Add slightly larger gap between system blocks and user calls. + xmlList[xmlList.length - 1].setAttribute('gap', 24); + } + + function populateProcedures(procedureList, templateName) { + for (var i = 0; i < procedureList.length; i++) { + var name = procedureList[i][0]; + var args = procedureList[i][1]; + // + // + // + // + // + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', templateName); + block.setAttribute('gap', 16); + var mutation = Blockly.utils.xml.createElement('mutation'); + mutation.setAttribute('name', name); + block.appendChild(mutation); + for (var j = 0; j < args.length; j++) { + var arg = Blockly.utils.xml.createElement('arg'); + arg.setAttribute('name', args[j]); + mutation.appendChild(arg); + } + xmlList.push(block); + } + } + + var tuple = Procedures.allProcedures(workspace); + populateProcedures(tuple[0], 'procedures_callnoreturn'); + populateProcedures(tuple[1], 'procedures_callreturn'); + return xmlList; +}; + +/** + * Find all the callers of a named procedure. + * @param {string} name Name of procedure. + * @param {!Blockly.Workspace} workspace The workspace to find callers in. + * @return {!Array.} Array of caller blocks. + */ +Procedures.getCallers = function (name, workspace) { + var callers = []; + var blocks = workspace.getAllBlocks(false); + // Iterate through every block and check the name. + for (var i = 0; i < blocks.length; i++) { + if (blocks[i].getProcedureCall) { + var procName = blocks[i].getProcedureCall(); + // Procedure name may be null if the block is only half-built. + if (procName && Blockly.Names.equals(procName, name)) { + callers.push(blocks[i]); + } + } + } + return callers; +}; + +/** + * When a procedure definition changes its parameters, find and edit all its + * callers. + * @param {!Blockly.Block} defBlock Procedure definition block. + */ +Procedures.mutateCallers = function (defBlock) { + const oldRecordUndo = Blockly.Events.getRecordUndo(); + const procedureBlock = defBlock; + const name = procedureBlock.getProcedureDef()[0]; + const xmlElement = defBlock.mutationToDom(true); + const callers = Procedures.getCallers(name, defBlock.workspace); + for (let i = 0, caller; (caller = callers[i]); i++) { + const oldMutationDom = caller.mutationToDom(); + const oldMutation = oldMutationDom && Blockly.utils.xml.domToText(oldMutationDom); + if (caller.domToMutation) { + caller.domToMutation(xmlElement); + } + const newMutationDom = caller.mutationToDom(); + const newMutation = newMutationDom && Blockly.utils.xml.domToText(newMutationDom); + if (oldMutation !== newMutation) { + // Fire a mutation on every caller block. But don't record this as an + // undo action since it is deterministically tied to the procedure's + // definition mutation. + Blockly.Events.setRecordUndo(false); + Blockly.Events.fire( + new (Blockly.Events.get(Blockly.Events.BLOCK_CHANGE))( + caller, + 'mutation', + null, + oldMutation, + newMutation, + ), + ); + Blockly.Events.setRecordUndo(oldRecordUndo); + } + } +}; + +/** + * Find the definition block for the named procedure. + * @param {string} name Name of procedure. + * @param {!Blockly.Workspace} workspace The workspace to search. + * @return {Blockly.Block} The procedure definition block, or null not found. + */ +Procedures.getDefinition = function (name, workspace) { + // Assume that a procedure definition is a top block. + var blocks = workspace.getTopBlocks(false); + for (var i = 0; i < blocks.length; i++) { + if (blocks[i].getProcedureDef) { + var tuple = blocks[i].getProcedureDef(); + if (tuple && Blockly.Names.equals(tuple[0], name)) { + return blocks[i]; + } + } + } + return null; +}; + +export default Procedures; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/others/variables.js b/mixly/boards/default_src/arduino/others/variables.js new file mode 100644 index 00000000..c210e042 --- /dev/null +++ b/mixly/boards/default_src/arduino/others/variables.js @@ -0,0 +1,255 @@ +/** + * @license + * Visual Blocks Editor + * + * Copyright 2012 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Utility functions for handling variables. + * @author fraser@google.com (Neil Fraser) + */ +import * as Blockly from 'blockly/core'; + +const Variables = {}; + +/** + * Category to separate variable names from procedures and generated functions. + */ +Variables.NAME_TYPE = 'VARIABLE'; + +Variables.DATA_TYPE = [ + [Blockly.Msg.LANG_MATH_INT, 'int'], + [Blockly.Msg.LANG_MATH_UNSIGNED_INT, 'unsigned int'], + [Blockly.Msg.LANG_MATH_WORD, 'word'], + [Blockly.Msg.LANG_MATH_LONG, 'long'], + [Blockly.Msg.LANG_MATH_UNSIGNED_LONG, 'unsigned long'], + [Blockly.Msg.LANG_MATH_FLOAT, 'float'], + [Blockly.Msg.LANG_MATH_DOUBLE, 'double'], + [Blockly.Msg.LANG_MATH_BOOLEAN, 'bool'], + [Blockly.Msg.LANG_MATH_BYTE, 'byte'], + [Blockly.Msg.LANG_MATH_CHAR, 'char'], + [Blockly.Msg.LANG_MATH_UNSIGNED_CHAR, 'unsigned char'], + [Blockly.Msg.LANG_MATH_STRING, 'String'], + ['uint8_t', 'uint8_t'], + ['uint16_t', 'uint16_t'], + ['uint32_t', 'uint32_t'], + ['uint64_t', 'uint64_t'], + ['int*', 'int*'], + ['unsigned int*', 'unsigned int*'], + ['word*', 'word*'], + ['long*', 'long*'], + ['unsigned long*', 'unsigned long*'], + ['float*', 'float*'], + ['double*', 'double*'], + ['bool*', 'bool*'], + ['byte*', 'byte*'], + ['char*', 'char*'], + ['unsigned char*', 'unsigned char*'], + ['String*', 'String*'], + ['uint8_t*', 'uint8_t*'], + ['uint16_t*', 'uint16_t*'], + ['uint32_t*', 'uint32_t*'], + ['uint64_t*', 'uint64_t*'] +]; + +/** + * Find all user-created variables. + * @param {!Blockly.Block|!Blockly.Workspace} root Root block or workspace. + * @return {!Array.} Array of variable names. + */ +Variables.allVariables = function (root) { + var blocks; + if (root.getDescendants) { + // Root is Block. + blocks = root.getDescendants(); + } else if (root.getAllBlocks) { + // Root is Workspace. + blocks = root.getAllBlocks(); + } else { + throw 'Not Block or Workspace: ' + root; + } + var variableHash = Object.create(null); + // Iterate through every block and add each variable to the hash. + for (var x = 0; x < blocks.length; x++) { + var blockVariables = blocks[x].getVars(); + for (var y = 0; y < blockVariables.length; y++) { + var varName = blockVariables[y]; + // Variable name may be null if the block is only half-built. + if (varName) { + variableHash[varName] = varName; + } + } + } + // Flatten the hash into a list. + var variableList = []; + for (var name in variableHash) { + variableList.push(variableHash[name]); + } + return variableList; +}; + +/** + * Find all instances of the specified variable and rename them. + * @param {string} oldName Variable to rename. + * @param {string} newName New variable name. + * @param {!Blockly.Workspace} workspace Workspace rename variables in. + */ +Variables.renameVariable = function (oldName, newName, workspace) { + Blockly.Events.setGroup(true); + var blocks = workspace.getAllBlocks(); + // Iterate through every block. + for (var i = 0; i < blocks.length; i++) { + blocks[i].renameVar(oldName, newName); + } + Blockly.Events.setGroup(false); +}; + +/** + * Construct the blocks required by the flyout for the variable category. + * @param {!Blockly.Workspace} workspace The workspace contianing variables. + * @return {!Array.} Array of XML block elements. + */ +Variables.flyoutCategory = function (workspace) { + var variableList = Variables.allVariables(workspace); + //variableList.sort(goog.string.caseInsensitiveCompare); + + // In addition to the user's variables, we also want to display the default + // variable name at the top. We also don't want this duplicated if the + // user has created a variable of the same name. + + //在变量分类里添加默认变量取值与赋值模块时使用 + //goog.array.remove(variableList, Blockly.Msg.VARIABLES_DEFAULT_NAME); + //variableList.unshift(Blockly.Msg.VARIABLES_DEFAULT_NAME); + + var xmlList = []; + + + if (Blockly.Blocks['variables_declare']) { + //增加variables_declare模块 + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_declare'); + xmlList.push(block); + } + + //在变量分类里添加默认变量取值与赋值模块时使用 + /* + if (Blockly.Blocks['variables_set']) { + //增加variables_declare模块 + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_set'); + xmlList.push(block); + } + if (Blockly.Blocks['variables_get']) { + //增加variables_declare模块 + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_get'); + xmlList.push(block); + } + */ + + //change tyep + if (Blockly.Blocks['variables_change']) { + //增加variables_declare模块 + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_change'); + xmlList.push(block); + } + for (var i = 0; i < variableList.length; i++) { + //if(i==0&&!(Blockly.Arduino.definitions_['var_declare'+'item'])){ + // continue; + //} + + if (Blockly.Blocks['variables_set']) { + let block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_set'); + if (Blockly.Blocks['variables_get']) { + block.setAttribute('gap', 8); + } + let field = Blockly.utils.xml.createElement('field', null, variableList[i]); + field.setAttribute('name', 'VAR'); + let name = Blockly.utils.xml.createTextNode(variableList[i]); + field.appendChild(name); + block.appendChild(field); + xmlList.push(block); + } + if (Blockly.Blocks['variables_get']) { + var block = Blockly.utils.xml.createElement('block'); + block.setAttribute('type', 'variables_get'); + if (Blockly.Blocks['variables_set']) { + block.setAttribute('gap', 24); + } + let field = Blockly.utils.xml.createElement('field', null, variableList[i]); + field.setAttribute('name', 'VAR'); + let name = Blockly.utils.xml.createTextNode(variableList[i]); + field.appendChild(name); + block.appendChild(field); + xmlList.push(block); + } + } + return xmlList; +}; + +/** +* Return a new variable name that is not yet being used. This will try to +* generate single letter variable names in the range 'i' to 'z' to start with. +* If no unique name is located it will try 'i' to 'z', 'a' to 'h', +* then 'i2' to 'z2' etc. Skip 'l'. + * @param {!Blockly.Workspace} workspace The workspace to be unique in. +* @return {string} New variable name. +*/ +Variables.generateUniqueName = function (workspace) { + var variableList = Variables.allVariables(workspace); + var newName = ''; + if (variableList.length) { + var nameSuffix = 1; + var letters = 'ijkmnopqrstuvwxyzabcdefgh'; // No 'l'. + var letterIndex = 0; + var potName = letters.charAt(letterIndex); + while (!newName) { + var inUse = false; + for (var i = 0; i < variableList.length; i++) { + if (variableList[i] == potName) { + // This potential name is already used. + inUse = true; + break; + } + } + if (inUse) { + // Try the next potential name. + letterIndex++; + if (letterIndex == letters.length) { + // Reached the end of the character sequence so back to 'i'. + // a new suffix. + letterIndex = 0; + nameSuffix++; + } + potName = letters.charAt(letterIndex); + if (nameSuffix > 1) { + potName += nameSuffix; + } + } else { + // We can use the current potential name. + newName = potName; + } + } + } else { + newName = 'i'; + } + return newName; +}; + +export default Variables; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/package.json b/mixly/boards/default_src/arduino/package.json new file mode 100644 index 00000000..88453e87 --- /dev/null +++ b/mixly/boards/default_src/arduino/package.json @@ -0,0 +1,32 @@ +{ + "name": "@mixly/arduino", + "version": "1.8.0", + "description": "适用于mixly的arduino模块", + "scripts": { + "build:dev": "webpack --config=webpack.dev.js", + "build:prod": "npm run build:examples & webpack --config=webpack.prod.js", + "build:examples": "node ../../../scripts/build-examples.js -t special", + "build:examples:ob": "node ../../../scripts/build-examples.js -t special --obfuscate", + "publish:board": "npm publish --registry https://registry.npmjs.org/" + }, + "main": "./export.js", + "author": "Mixly Team", + "keywords": [ + "mixly", + "mixly-plugin", + "arduino" + ], + "homepage": "https://gitee.com/bnu_mixly/mixly3/tree/master/boards/default_src/arduino", + "bugs": { + "url": "https://gitee.com/bnu_mixly/mixly3/issues" + }, + "repository": { + "type": "git", + "url": "https://gitee.com/bnu_mixly/mixly3.git", + "directory": "default_src/arduino" + }, + "publishConfig": { + "access": "public" + }, + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/template.xml b/mixly/boards/default_src/arduino/template.xml new file mode 100644 index 00000000..e69de29b diff --git a/mixly/boards/default_src/arduino/templates/json/cities.json b/mixly/boards/default_src/arduino/templates/json/cities.json new file mode 100644 index 00000000..5206fa72 --- /dev/null +++ b/mixly/boards/default_src/arduino/templates/json/cities.json @@ -0,0 +1,1185 @@ +{ + "本地": { + "-": { + "pinyin": "ip" + } + }, + "北京": { + "-": { + "pinyin": "beijing" + } + }, + "天津": { + "-": { + "pinyin": "tianjin" + } + }, + "河北": { + "石家庄": { + "pinyin": "shijiazhuang" + }, + "邯郸": { + "pinyin": "handan" + }, + "邢台": { + "pinyin": "xingtai" + }, + "衡水": { + "pinyin": "hengshui" + }, + "保定": { + "pinyin": "baoding" + }, + "沧州": { + "pinyin": "cangzhou" + }, + "张家口": { + "pinyin": "zhangjiakou" + }, + "廊坊": { + "pinyin": "langfang" + }, + "承德": { + "pinyin": "chengde" + }, + "唐山": { + "pinyin": "tangshan" + }, + "秦皇岛": { + "pinyin": "qinhuangdao" + } + }, + "山西": { + "太原": { + "pinyin": "taiyuan" + }, + "运城": { + "pinyin": "yuncheng" + }, + "临汾": { + "pinyin": "linfen" + }, + "吕梁": { + "pinyin": "lvliang" + }, + "朔州": { + "pinyin": "shuozhou" + }, + "晋城": { + "pinyin": "jincheng" + }, + "长治": { + "pinyin": "changzhi" + }, + "晋中": { + "pinyin": "jinzhong" + }, + "阳泉": { + "pinyin": "yangquan" + }, + "忻州": { + "pinyin": "xinzhou" + }, + "大同": { + "pinyin": "datong" + } + }, + "内蒙古": { + "呼和浩特": { + "pinyin": "huhehaote" + }, + "阿左旗": { + "pinyin": "azuoqi" + }, + "乌海": { + "pinyin": "wuhai" + }, + "临河": { + "pinyin": "linhe" + }, + "鄂尔多斯": { + "pinyin": "eerduosi" + }, + "包头": { + "pinyin": "baotou" + }, + "集宁": { + "pinyin": "jining" + }, + "锡林浩特": { + "pinyin": "xilinhaote" + }, + "赤峰": { + "pinyin": "chifeng" + }, + "通辽": { + "pinyin": "tongliao" + }, + "乌兰浩特": { + "pinyin": "wulanhaote" + }, + "海拉尔": { + "pinyin": "hailaer" + } + }, + "辽宁": { + "沈阳": { + "pinyin": "shenyang" + }, + "大连": { + "pinyin": "dalian" + }, + "葫芦岛": { + "pinyin": "huludao" + }, + "朝阳": { + "pinyin": "chaoyang" + }, + "营口": { + "pinyin": "yingkou" + }, + "锦州": { + "pinyin": "jinzhou" + }, + "盘锦": { + "pinyin": "panjin" + }, + "阜新": { + "pinyin": "fuxin" + }, + "鞍山": { + "pinyin": "anshan" + }, + "辽阳": { + "pinyin": "liaoyang" + }, + "丹东": { + "pinyin": "dandong" + }, + "本溪": { + "pinyin": "benxi" + }, + "抚顺": { + "pinyin": "fushun" + }, + "铁岭": { + "pinyin": "tieling" + } + }, + "吉林": { + "长春": { + "pinyin": "changchun" + }, + "通化": { + "pinyin": "tonghua" + }, + "白山": { + "pinyin": "baishan" + }, + "辽源": { + "pinyin": "liaoyuan" + }, + "四平": { + "pinyin": "siping" + }, + "吉林": { + "pinyin": "jilin" + }, + "延吉": { + "pinyin": "yanji" + }, + "白城": { + "pinyin": "baicheng" + }, + "松原": { + "pinyin": "songyuan" + } + }, + "黑龙江": { + "哈尔滨": { + "pinyin": "haerbin" + }, + "牡丹江": { + "pinyin": "mudanjiang" + }, + "大庆": { + "pinyin": "daqing" + }, + "齐齐哈尔": { + "pinyin": "qiqihaer" + }, + "绥化": { + "pinyin": "suihua" + }, + "伊春": { + "pinyin": "yichun" + }, + "大兴安岭": { + "pinyin": "daxinganling" + }, + "黑河": { + "pinyin": "heihe" + }, + "鸡西": { + "pinyin": "jixi" + }, + "七台河": { + "pinyin": "qitaihe" + }, + "佳木斯": { + "pinyin": "jiamusi" + }, + "鹤岗": { + "pinyin": "hegang" + }, + "双鸭山": { + "pinyin": "shuangyashan" + } + }, + "上海": { + "-": { + "pinyin": "shanghai" + } + }, + "江苏": { + "南京": { + "pinyin": "nanjing" + }, + "镇江": { + "pinyin": "zhenjiang" + }, + "苏州": { + "pinyin": "suzhou" + }, + "无锡": { + "pinyin": "wuxi" + }, + "常州": { + "pinyin": "changzhou" + }, + "南通": { + "pinyin": "nantong" + }, + "扬州": { + "pinyin": "yangzhou" + }, + "淮安": { + "pinyin": "huaian" + }, + "泰州": { + "pinyin": "taizhou" + }, + "盐城": { + "pinyin": "yancheng" + }, + "徐州": { + "pinyin": "xuzhou" + }, + "宿迁": { + "pinyin": "suqian" + }, + "连云港": { + "pinyin": "lianyungang" + } + }, + "浙江": { + "杭州": { + "pinyin": "hangzhou" + }, + "温州": { + "pinyin": "wenzhou" + }, + "衢州": { + "pinyin": "quzhou" + }, + "丽水": { + "pinyin": "lishui" + }, + "金华": { + "pinyin": "jinhua" + }, + "绍兴": { + "pinyin": "shaoxing" + }, + "湖州": { + "pinyin": "huzhou" + }, + "嘉兴": { + "pinyin": "jiaxing" + }, + "台州": { + "pinyin": "taizhou" + }, + "宁波": { + "pinyin": "ningbo" + }, + "舟山": { + "pinyin": "zhoushan" + } + }, + "安徽": { + "合肥": { + "pinyin": "hefei" + }, + "安庆": { + "pinyin": "anqing" + }, + "池州": { + "pinyin": "chizhou" + }, + "铜陵": { + "pinyin": "tongling" + }, + "六安": { + "pinyin": "luan" + }, + "阜阳": { + "pinyin": "fuyang" + }, + "淮南": { + "pinyin": "huainan" + }, + "蚌埠": { + "pinyin": "bengbu" + }, + "宿州": { + "pinyin": "suzhou" + }, + "黄山": { + "pinyin": "huangshan" + }, + "宣城": { + "pinyin": "xuancheng" + }, + "芜湖": { + "pinyin": "wuhu" + }, + "马鞍山": { + "pinyin": "maanshan" + }, + "滁州": { + "pinyin": "chuzhou" + }, + "亳州": { + "pinyin": "bozhou" + }, + "淮北": { + "pinyin": "huaibei" + } + }, + "福建": { + "福州": { + "pinyin": "fuzhou" + }, + "漳州": { + "pinyin": "zhangzhou" + }, + "厦门": { + "pinyin": "xiamen" + }, + "龙岩": { + "pinyin": "longyan" + }, + "三明": { + "pinyin": "sanming" + }, + "泉州": { + "pinyin": "quanzhou" + }, + "莆田": { + "pinyin": "putian" + }, + "南平": { + "pinyin": "nanping" + }, + "宁德": { + "pinyin": "ningde" + } + }, + "江西": { + "南昌": { + "pinyin": "nanchang" + }, + "赣州": { + "pinyin": "ganzhou" + }, + "萍乡": { + "pinyin": "pingxiang" + }, + "吉安": { + "pinyin": "jian" + }, + "宜春": { + "pinyin": "yichun" + }, + "新余": { + "pinyin": "xinyu" + }, + "抚州": { + "pinyin": "fuzhou" + }, + "鹰潭": { + "pinyin": "yingtan" + }, + "上饶": { + "pinyin": "shangrao" + }, + "景德镇": { + "pinyin": "jingdezhen" + }, + "九江": { + "pinyin": "jiujiang" + } + }, + "山东": { + "济南": { + "pinyin": "jinan" + }, + "枣庄": { + "pinyin": "zaozhuang" + }, + "菏泽": { + "pinyin": "heze" + }, + "济宁": { + "pinyin": "jining" + }, + "聊城": { + "pinyin": "liaocheng" + }, + "泰安": { + "pinyin": "taian" + }, + "莱芜": { + "pinyin": "laiwu" + }, + "德州": { + "pinyin": "dezhou" + }, + "淄博": { + "pinyin": "zibo" + }, + "滨州": { + "pinyin": "binzhou" + }, + "临沂": { + "pinyin": "linyi" + }, + "日照": { + "pinyin": "rizhao" + }, + "青岛": { + "pinyin": "qingdao" + }, + "潍坊": { + "pinyin": "weifang" + }, + "东营": { + "pinyin": "dongying" + }, + "烟台": { + "pinyin": "yantai" + }, + "威海": { + "pinyin": "weihai" + } + }, + "河南": { + "郑州": { + "pinyin": "zhengzhou" + }, + "三门峡": { + "pinyin": "sanmenxia" + }, + "洛阳": { + "pinyin": "luoyang" + }, + "信阳": { + "pinyin": "xinyang" + }, + "南阳": { + "pinyin": "nanyang" + }, + "驻马店": { + "pinyin": "zhumadian" + }, + "漯河": { + "pinyin": "luohe" + }, + "周口": { + "pinyin": "zhoukou" + }, + "平顶山": { + "pinyin": "pingdingshan" + }, + "许昌": { + "pinyin": "xuchang" + }, + "济源": { + "pinyin": "jiyuan" + }, + "开封": { + "pinyin": "kaifeng" + }, + "焦作": { + "pinyin": "jiaozuo" + }, + "新乡": { + "pinyin": "xinxiang" + }, + "鹤壁": { + "pinyin": "hebi" + }, + "濮阳": { + "pinyin": "puyang" + }, + "安阳": { + "pinyin": "anyang" + }, + "商丘": { + "pinyin": "shangqiu" + } + }, + "湖北": { + "武汉": { + "pinyin": "wuhan" + }, + "恩施": { + "pinyin": "enshi" + }, + "宜昌": { + "pinyin": "yichang" + }, + "荆州": { + "pinyin": "jingzhou" + }, + "神农架": { + "pinyin": "shennongjia" + }, + "荆门": { + "pinyin": "jingmen" + }, + "襄阳": { + "pinyin": "xiangyang" + }, + "十堰": { + "pinyin": "shiyan" + }, + "潜江": { + "pinyin": "qianjiang" + }, + "天门": { + "pinyin": "tianmen" + }, + "仙桃": { + "pinyin": "xiantao" + }, + "咸宁": { + "pinyin": "xianning" + }, + "黄石": { + "pinyin": "huangshi" + }, + "孝感": { + "pinyin": "xiaogan" + }, + "鄂州": { + "pinyin": "ezhou" + }, + "黄冈": { + "pinyin": "huanggang" + }, + "随州": { + "pinyin": "suizhou" + } + }, + "湖南": { + "长沙": { + "pinyin": "changsha" + }, + "永州": { + "pinyin": "yongzhou" + }, + "怀化": { + "pinyin": "huaihua" + }, + "邵阳": { + "pinyin": "shaoyang" + }, + "娄底": { + "pinyin": "loudi" + }, + "吉首": { + "pinyin": "jishou" + }, + "张家界": { + "pinyin": "zhangjiajie" + }, + "益阳": { + "pinyin": "yiyang" + }, + "常德": { + "pinyin": "changde" + }, + "郴州": { + "pinyin": "chenzhou" + }, + "衡阳": { + "pinyin": "hengyang" + }, + "湘潭": { + "pinyin": "xiangtan" + }, + "株洲": { + "pinyin": "zhuzhou" + }, + "岳阳": { + "pinyin": "yueyang" + } + }, + "广东": { + "广州": { + "pinyin": "guangzhou" + }, + "湛江": { + "pinyin": "zhanjiang" + }, + "茂名": { + "pinyin": "maoming" + }, + "阳江": { + "pinyin": "yangjiang" + }, + "珠海": { + "pinyin": "zhuhai" + }, + "云浮": { + "pinyin": "yunfu" + }, + "肇庆": { + "pinyin": "zhaoqing" + }, + "江门": { + "pinyin": "jiangmen" + }, + "佛山": { + "pinyin": "foshan" + }, + "中山": { + "pinyin": "zhongshan" + }, + "东莞": { + "pinyin": "dongguan" + }, + "清远": { + "pinyin": "qingyuan" + }, + "深圳": { + "pinyin": "shenzhen" + }, + "惠州": { + "pinyin": "huizhou" + }, + "河源": { + "pinyin": "heyuan" + }, + "韶关": { + "pinyin": "shaoguan" + }, + "汕尾": { + "pinyin": "shanwei" + }, + "汕头": { + "pinyin": "shantou" + }, + "揭阳": { + "pinyin": "jieyang" + }, + "潮州": { + "pinyin": "chaozhou" + }, + "梅州": { + "pinyin": "meizhou" + } + }, + "广西": { + "南宁": { + "pinyin": "nanning" + }, + "崇左": { + "pinyin": "chongzuo" + }, + "防城港": { + "pinyin": "fangchenggang" + }, + "北海": { + "pinyin": "beihai" + }, + "钦州": { + "pinyin": "qinzhou" + }, + "百色": { + "pinyin": "baise" + }, + "贵港": { + "pinyin": "guigang" + }, + "来宾": { + "pinyin": "laibin" + }, + "河池": { + "pinyin": "hechi" + }, + "柳州": { + "pinyin": "liuzhou" + }, + "玉林": { + "pinyin": "yulin" + }, + "梧州": { + "pinyin": "wuzhou" + }, + "桂林": { + "pinyin": "guilin" + }, + "贺州": { + "pinyin": "hezhou" + } + }, + "海南": { + "海口": { + "pinyin": "haikou" + }, + "西沙": { + "pinyin": "xisha" + }, + "三亚": { + "pinyin": "sanya" + }, + "乐东": { + "pinyin": "ledong" + }, + "五指山": { + "pinyin": "wuzhishan" + }, + "东方": { + "pinyin": "dongfang" + }, + "昌江": { + "pinyin": "changjiang" + }, + "白沙": { + "pinyin": "baisha" + }, + "儋州": { + "pinyin": "danzhou" + }, + "保亭": { + "pinyin": "baoting" + }, + "陵水": { + "pinyin": "lingshui" + }, + "万宁": { + "pinyin": "wanning" + }, + "琼中": { + "pinyin": "qiongzhong" + }, + "屯昌": { + "pinyin": "tunchang" + }, + "琼海": { + "pinyin": "qionghai" + }, + "文昌": { + "pinyin": "wenchang" + }, + "临高": { + "pinyin": "lingao" + }, + "澄迈": { + "pinyin": "chengmai" + }, + "定安": { + "pinyin": "dingan" + }, + "南沙": { + "pinyin": "nansha" + }, + "中沙": { + "pinyin": "wuzhishan" + } + }, + "重庆": { + "-": { + "pinyin": "chongqing" + } + }, + "四川": { + "成都": { + "pinyin": "chengdu" + }, + "甘孜": { + "pinyin": "ganzi" + }, + "攀枝花": { + "pinyin": "panzhihua" + }, + "凉山": { + "pinyin": "liangshan" + }, + "雅安": { + "pinyin": "yaan" + }, + "乐山": { + "pinyin": "leshan" + }, + "眉山": { + "pinyin": "meishan" + }, + "宜宾": { + "pinyin": "yibin" + }, + "泸州": { + "pinyin": "luzhou" + }, + "自贡": { + "pinyin": "zigong" + }, + "资阳": { + "pinyin": "ziyang" + }, + "内江": { + "pinyin": "neijiang" + }, + "遂宁": { + "pinyin": "suining" + }, + "南充": { + "pinyin": "nanchong" + }, + "广安": { + "pinyin": "guangan" + }, + "阿坝": { + "pinyin": "aba" + }, + "德阳": { + "pinyin": "deyang" + }, + "绵阳": { + "pinyin": "mianyang" + }, + "巴中": { + "pinyin": "bazhong" + }, + "广元": { + "pinyin": "guangyuan" + }, + "达州": { + "pinyin": "dazhou" + } + }, + "贵州": { + "贵阳": { + "pinyin": "guiyang" + }, + "兴义": { + "pinyin": "xingyi" + }, + "水城": { + "pinyin": "shuicheng" + }, + "安顺": { + "pinyin": "anshun" + }, + "毕节": { + "pinyin": "bijie" + }, + "都匀": { + "pinyin": "duyun" + }, + "凯里": { + "pinyin": "kaili" + }, + "遵义": { + "pinyin": "zunyi" + }, + "铜仁": { + "pinyin": "tongren" + } + }, + "云南": { + "昆明": { + "pinyin": "kunming" + }, + "景洪": { + "pinyin": "jinghong" + }, + "普洱": { + "pinyin": "puer" + }, + "临沧": { + "pinyin": "lincang" + }, + "德宏": { + "pinyin": "dehong" + }, + "保山": { + "pinyin": "baoshan" + }, + "怒江": { + "pinyin": "nujiang" + }, + "大理": { + "pinyin": "dali" + }, + "香格里拉": { + "pinyin": "xianggelila" + }, + "丽江": { + "pinyin": "lijiang" + }, + "红河": { + "pinyin": "honghe" + }, + "玉溪": { + "pinyin": "yuxi" + }, + "楚雄": { + "pinyin": "chuxiong" + }, + "文山": { + "pinyin": "wenshan" + }, + "曲靖": { + "pinyin": "qujing" + }, + "昭通": { + "pinyin": "zhaotong" + } + }, + "西藏": { + "拉萨": { + "pinyin": "lasa" + }, + "阿里": { + "pinyin": "ali" + }, + "日喀则": { + "pinyin": "rikaze" + }, + "山南": { + "pinyin": "shannan" + }, + "林芝": { + "pinyin": "linzhi" + }, + "那曲": { + "pinyin": "naqu" + }, + "昌都": { + "pinyin": "changdu" + } + }, + "陕西": { + "西安": { + "pinyin": "xian" + }, + "汉中": { + "pinyin": "hanzhong" + }, + "安康": { + "pinyin": "ankang" + }, + "宝鸡": { + "pinyin": "baoji" + }, + "杨凌": { + "pinyin": "yangling" + }, + "咸阳": { + "pinyin": "xianyang" + }, + "铜川": { + "pinyin": "tongchuan" + }, + "渭南": { + "pinyin": "weinan" + }, + "商洛": { + "pinyin": "shangluo" + }, + "延安": { + "pinyin": "yanan" + }, + "榆林": { + "pinyin": "yulin" + } + }, + "甘肃": { + "兰州": { + "pinyin": "lanzhou" + }, + "武都": { + "pinyin": "wudu" + }, + "张掖": { + "pinyin": "zhangye" + }, + "嘉峪关": { + "pinyin": "jiayuguan" + }, + "酒泉": { + "pinyin": "jiuquan" + }, + "合作": { + "pinyin": "hezuo" + }, + "临夏": { + "pinyin": "linxia" + }, + "天水": { + "pinyin": "tianshui" + }, + "定西": { + "pinyin": "dingxi" + }, + "白银": { + "pinyin": "baiyin" + }, + "平凉": { + "pinyin": "pingliang" + }, + "武威": { + "pinyin": "wuwei" + }, + "金昌": { + "pinyin": "jinchang" + }, + "庆阳": { + "pinyin": "qingyang" + } + }, + "青海": { + "西宁": { + "pinyin": "xining" + }, + "玉树": { + "pinyin": "yushu" + }, + "格尔木": { + "pinyin": "geermu" + }, + "果洛": { + "pinyin": "guoluo" + }, + "海南": { + "pinyin": "hainan" + }, + "海西": { + "pinyin": "haixi" + }, + "海北": { + "pinyin": "haibei" + }, + "黄南": { + "pinyin": "huangnan" + }, + "海东": { + "pinyin": "haidong" + } + }, + "宁夏": { + "银川": { + "pinyin": "yinchuan" + }, + "固原": { + "pinyin": "guyuan" + }, + "中卫": { + "pinyin": "zhongwei" + }, + "吴忠": { + "pinyin": "wuzhong" + }, + "石嘴山": { + "pinyin": "shizuishan" + } + }, + "新疆": { + "乌鲁木齐": { + "pinyin": "wulumuqi" + }, + "喀什": { + "pinyin": "kashi" + }, + "阿图什": { + "pinyin": "atushi" + }, + "和田": { + "pinyin": "hetian" + }, + "阿拉尔": { + "pinyin": "alaer" + }, + "阿克苏": { + "pinyin": "akesu" + }, + "伊宁": { + "pinyin": "yining" + }, + "博乐": { + "pinyin": "bole" + }, + "库尔勒": { + "pinyin": "kuerle" + }, + "石河子": { + "pinyin": "shihezi" + }, + "吐鲁番": { + "pinyin": "tulufan" + }, + "昌吉": { + "pinyin": "changji" + }, + "五家渠": { + "pinyin": "wujiaqu" + }, + "塔城": { + "pinyin": "tacheng" + }, + "克拉玛依": { + "pinyin": "kelamayi" + }, + "阿勒泰": { + "pinyin": "aletai" + }, + "哈密": { + "pinyin": "hami" + } + }, + "香港": { + "-": { + "pinyin": "hong kong" + } + }, + "澳门": { + "-": { + "pinyin": "macao" + } + }, + "台湾": { + "台北": { + "pinyin": "taipei" + }, + "高雄": { + "pinyin": "gaoxiong" + }, + "台中": { + "pinyin": "taizhong" + } + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/webpack.common.js b/mixly/boards/default_src/arduino/webpack.common.js new file mode 100644 index 00000000..5e590020 --- /dev/null +++ b/mixly/boards/default_src/arduino/webpack.common.js @@ -0,0 +1,13 @@ +const common = require('../../../webpack.common'); +const { merge } = require('webpack-merge'); + +module.exports = merge(common, { + module: { + rules: [ + { + test: /\.(txt|c|cpp|h|hpp)$/, + type: 'asset/source' + } + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/webpack.dev.js b/mixly/boards/default_src/arduino/webpack.dev.js new file mode 100644 index 00000000..34785049 --- /dev/null +++ b/mixly/boards/default_src/arduino/webpack.dev.js @@ -0,0 +1,21 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ESLintPlugin = require('eslint-webpack-plugin'); + +module.exports = merge(common, { + mode: 'development', + devtool: 'source-map', + plugins: [ + new ESLintPlugin({ + context: process.cwd(), + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: false + }), + ] +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino/webpack.prod.js b/mixly/boards/default_src/arduino/webpack.prod.js new file mode 100644 index 00000000..331b45f4 --- /dev/null +++ b/mixly/boards/default_src/arduino/webpack.prod.js @@ -0,0 +1,27 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const TerserPlugin = require('terser-webpack-plugin'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = merge(common, { + mode: 'production', + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + extractComments: false, + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: { + removeAttributeQuotes: true, + collapseWhitespace: true, + removeComments: true, + } + }) + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/.npmignore b/mixly/boards/default_src/arduino_avr/.npmignore new file mode 100644 index 00000000..21ab2a3e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/.npmignore @@ -0,0 +1,3 @@ +node_modules +build +origin \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/actuator.js b/mixly/boards/default_src/arduino_avr/blocks/actuator.js new file mode 100644 index 00000000..f9f4b7c3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/actuator.js @@ -0,0 +1,1392 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const ACTUATOR_HUE = 100; + +export const servo_move = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput("DEGREE", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DEGREE_0_180); + this.appendValueInput("DELAY_TIME", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DELAY + '(' + Blockly.Msg.MIXLY_MILLIS + ')'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_MOVE); + // this.setFieldValue("2", "PIN"); + } +}; + +export const servo_writeMicroseconds = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput("DEGREE", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SERVO_WRITEMICROSECONDS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERVO_WRITEMICROSECONDS); + // this.setFieldValue("2", "PIN"); + } +}; + +export const servo_read_degrees = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_READ_DEGREES) + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_READ); + // this.setFieldValue("2", "PIN"); + } +}; + +export const servo_move1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField("模式") + .appendField(new Blockly.FieldDropdown([["Servo", "0"], ["Timer2ServoPwm", "1"]]), "mode"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput("DEGREE", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DEGREE_0_180); + this.appendValueInput("DELAY_TIME", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DELAY + '(' + Blockly.Msg.MIXLY_MILLIS + ')'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_MOVE); + // this.setFieldValue("2", "PIN"); + } +}; + +export const servo_writeMicroseconds1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField("模式") + .appendField(new Blockly.FieldDropdown([["Servo", "0"], ["Timer2ServoPwm", "1"]]), "mode"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput("DEGREE", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SERVO_WRITEMICROSECONDS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERVO_WRITEMICROSECONDS); + // this.setFieldValue("2", "PIN"); + } +}; + +export const servo_read_degrees1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField("模式") + .appendField(new Blockly.FieldDropdown([["Servo", "0"], ["Timer2ServoPwm", "1"]]), "mode"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SERVO) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_READ_DEGREES) + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_READ); + // this.setFieldValue("2", "PIN"); + } +}; + +export const tone_notes = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(tone_notes.TONE_NOTES), 'STAT'); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TONE_NOTE); + }, + TONE_NOTES: [ + ["NOTE_C3", "131"], + ["NOTE_D3", "147"], + ["NOTE_E3", "165"], + ["NOTE_F3", "175"], + ["NOTE_G3", "196"], + ["NOTE_A3", "220"], + ["NOTE_B3", "247"], + ["NOTE_C4", "262"], + ["NOTE_D4", "294"], + ["NOTE_E4", "330"], + ["NOTE_F4", "349"], + ["NOTE_G4", "392"], + ["NOTE_A4", "440"], + ["NOTE_B4", "494"], + ["NOTE_C5", "523"], + ["NOTE_D5", "587"], + ["NOTE_E5", "659"], + ["NOTE_F5", "698"], + ["NOTE_G5", "784"], + ["NOTE_A5", "880"], + ["NOTE_B5", "988"], + ["NOTE_C6", "1047"], + ["NOTE_D6", "1175"], + ["NOTE_E6", "1319"], + ["NOTE_F6", "1397"], + ["NOTE_G6", "1568"], + ["NOTE_A6", "1760"], + ["NOTE_B6", "1976"], + ["NOTE_C7", "2093"], + ["NOTE_D7", "2349"], + ["NOTE_E7", "2637"], + ["NOTE_F7", "2794"], + ["NOTE_G7", "3136"], + ["NOTE_A7", "3520"], + ["NOTE_B7", "3951"] + ] +}; + +export const controls_tone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_TONE) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput('FREQUENCY') + .setCheck(Number) + //.setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_FREQUENCY); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE); + } +}; + +export const controls_notone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_NOTONE) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_NOTONE); + } +}; + +export const controls_tone_noTimer = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_TONE_NOTIMER) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput('FREQUENCY') + .setCheck(Number) + //.setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_FREQUENCY); + this.appendValueInput('DURATION') + .setCheck(Number) + //.setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DURATION); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE2); + } +}; + +export const controls_notone_noTimer = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_NOTONE_NOTIMER) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_NOTONE); + } +}; + +export const group_stepper_setup = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_STEPPER_SETUP_STEPPER) + .appendField(new Blockly.FieldTextInput('mystepper'), 'VAR'); + this.appendValueInput("PIN1", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN1) + .setCheck(Number); + this.appendValueInput("PIN2", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN2) + .setCheck(Number); + this.appendValueInput('steps') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPSPERREVOLUTION); + this.appendValueInput('speed') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_SET_SPEED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_STEP); + } +}; + +export const group_stepper_setup2 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_STEPPER_SETUP_STEPPER) + .appendField(new Blockly.FieldTextInput('mystepper'), 'VAR'); + this.appendValueInput("PIN1", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN1) + .setCheck(Number); + this.appendValueInput("PIN2", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN2) + .setCheck(Number); + this.appendValueInput("PIN3", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN3) + .setCheck(Number); + this.appendValueInput("PIN4", Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_PIN4) + .setCheck(Number); + this.appendValueInput('steps') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPSPERREVOLUTION); + this.appendValueInput('speed') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_SET_SPEED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_STEP2); + } +}; + +export const group_stepper_move = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_STEPPER) + .appendField(new Blockly.FieldTextInput('mystepper'), 'VAR'); + this.appendValueInput('step') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEPPER_STEP); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STEPPER_MOVE); + } +}; + +export const RGB_color_seclet = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldColour("ff0000"), "COLOR"); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.OLED_DRAW_PIXE_TOOLTIP); + } +}; + +export const RGB_color_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("R") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_R); + this.appendValueInput("G") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_G); + this.appendValueInput("B") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_B); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(''); + } +}; + +//RGB +export const display_rgb_init = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB + Blockly.Msg.MIXLY_SETUP) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_TYPE) + .appendField(new Blockly.FieldDropdown(display_rgb_init.DISPLAY_RGB_TYPE), "TYPE"); + this.appendValueInput("LEDCOUNT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_COUNT); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + // this.setFieldValue("12", "PIN"); + }, + DISPLAY_RGB_TYPE: [ + ["NEO_GRB", "NEO_GRB"], + ["NEO_RGB", "NEO_RGB"], + ["NEO_RGBW", "NEO_RGBW"] + ] +}; + +export const display_rgb_Brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + // this.setFieldValue("12", "PIN"); + } +}; + +export const display_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + // this.setFieldValue("12", "PIN"); + } +}; + +export const display_rgb_show = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_SHOW) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const display_rgb_rainbow1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("WAIT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGBdisplay_rgb_rainbow1); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + // this.setFieldValue("12", "PIN"); + } +}; + +export const display_rgb_rainbow2 = { + init: function () { + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("WAIT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGBdisplay_rgb_rainbow2); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + //this.setFieldValue("12", "PIN"); + } +}; + +export const display_rgb_rainbow3 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(display_rgb_rainbow3.DISPLAY_RAINBOW_TYPE), "TYPE"); + this.appendValueInput("rainbow_color") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_display_rgb_rainbow3); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + // this.setFieldValue("12", "PIN"); + }, + DISPLAY_RAINBOW_TYPE: [ + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"], + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"] + ] +}; + +export const RGB_color_HSV = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendValueInput("H") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_H); + this.appendValueInput("S") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_S); + this.appendValueInput("V") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_V); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip('色调范围0-65536;饱和度范围0-255;明度范围0-255'); + } +}; + +export const Mixly_motor = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown(Mixly_motor.MOTOR_TYPE), "MOTOR_TYPE"); + this.appendDummyInput("") + this.appendValueInput("PIN1") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MOTOR_DIR_PIN + "1"); + this.appendValueInput("PIN2") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MOTOR_DIR_PIN + "2"); + this.appendValueInput("PIN_EN") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("EN" + Blockly.Msg.MIXLY_PIN); + this.appendValueInput('speed') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MOTOR_SPEED); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + }, + MOTOR_TYPE: [ + ["L293", "L293"], + ["L298", "L298"], + ["TB6612FNG", "TB6612FNG"] + ] +}; + +export const Motor_8833 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("L293/298/DRV8833") + .appendField(Blockly.Msg.MIXLY_MOTOR); + this.appendDummyInput("") + this.appendValueInput("PIN1") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MOTOR_SPEED_PIN); + this.appendValueInput("PIN2") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MOTOR_DIR_PIN); + this.appendValueInput('speed') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MOTOR_SPEED); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +//GD5800 MP3播放设备选择 +export const GD5800_MP3_Set_Device = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MP3_SOURCE) + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown(GD5800_MP3_Set_Device.GD5800_MP3_Device), "DEVICEID"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + }, + GD5800_MP3_Device: [ + ["Flash", "MP3_DEVICE_FLASH"],//内部Flash + [Blockly.Msg.MIXLY_MP3_UDISK, "MP3_DEVICE_UDISK"]//外部U盘 + ] +}; + +//GD5800 MP3模块 +export const GD5800_MP3_CONTROL = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown(GD5800_MP3_CONTROL.GD5800_MP3_CONTROL_TYPE), "CONTROL_TYPE"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + }, + GD5800_MP3_CONTROL_TYPE: [ + [Blockly.Msg.MIXLY_MP3_PLAY, "play();"], + [Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"], + [Blockly.Msg.MIXLY_MP3_NEXT, "next();"], + [Blockly.Msg.MIXLY_MP3_PREV, "prev();"], + [Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp();"], + [Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDn();"] + ] +}; + +//GD5800 MP3模块循环模式 +export const GD5800_MP3_LOOP_MODE = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MP3_LOOP_MODE) + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown(GD5800_MP3_LOOP_MODE.GD5800_MP3_LOOP_MODE_TYPE), "LOOP_MODE"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + }, + GD5800_MP3_LOOP_MODE_TYPE: [ + [Blockly.Msg.MIXLY_MP3_LOOP_ALL, "MP3_LOOP_ALL"], + [Blockly.Msg.MIXLY_MP3_LOOP_FOLDER, "MP3_LOOP_FOLDER"], + [Blockly.Msg.MIXLY_MP3_LOOP_ONE, "MP3_LOOP_ONE"], + [Blockly.Msg.MIXLY_MP3_LOOP_RAM, "MP3_LOOP_RAM"] + ] +}; + +//GD5800 MP3模块EQ模式 +export const GD5800_MP3_EQ_MODE = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MP3_EQ_MODE) + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown(GD5800_MP3_EQ_MODE.GD5800_MP3_EQ_MODE_TYPE), "EQ_MODE"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + }, + GD5800_MP3_EQ_MODE_TYPE: [ + [Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "MP3_EQ_NORMAL"], + [Blockly.Msg.MIXLY_MP3_EQ_POP, "MP3_EQ_POP"], + [Blockly.Msg.MIXLY_MP3_EQ_ROCK, "MP3_EQ_ROCK"], + [Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "MP3_EQ_JAZZ"], + [Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "MP3_EQ_CLASSIC"], + [Blockly.Msg.MIXLY_MP3_EQ_BASS, "MP3_EQ_BASS"] + ] +}; + +//GD5800 MP3模块设置音量 +export const GD5800_MP3_VOL = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MP3_VOL); + this.appendValueInput("vol", Number) + .appendField(Blockly.Msg.MIXLY_STAT) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//GD5800 MP3模块播放第N首 +export const GD5800_MP3_PLAY_NUM = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("GD5800" + Blockly.Msg.GD5800_MP3); + this.appendValueInput("RXPIN", Number) + .appendField("TX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("TXPIN", Number) + .appendField("RX" + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_MP3_PLAY_NUM) + .setCheck(Number); + this.appendDummyInput("") + .appendField("首"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const voice_module = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("语音模块(68段日常用语)"); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MP3_PLAY) + .appendField(new Blockly.FieldDropdown(voice_module.VOICE_LIST), "VOICE"); + this.appendValueInput("WAIT").setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MICROBIT_WAIT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + }, + VOICE_LIST: [ + ["老师", "0x00"], + ["爸爸", "0x01"], + ["妈妈", "0x02"], + ["爷爷", "0x03"], + ["奶奶", "0x04"], + ["姥姥", "0x05"], + ["姥爷", "0x06"], + ["哥哥", "0x07"], + ["姐姐", "0x08"], + ["叔叔", "0x09"], + ["阿姨", "0x0A"], + ["上午", "0x0B"], + ["下午", "0x0C"], + ["晚上", "0x0D"], + ["前方", "0x0E"], + ["厘米", "0x0F"], + ["新年快乐", "0x10"], + ["身体健康", "0x11"], + ["工作顺利", "0x12"], + ["学习进步", "0x13"], + ["您好", "0x14"], + ["谢谢", "0x15"], + ["的", "0x16"], + ["祝", "0x17"], + ["慢走", "0x18"], + ["欢迎光临", "0x19"], + ["亲爱的", "0x1A"], + ["同学们", "0x1B"], + ["工作辛苦了", "0x1C"], + ["点", "0x1D"], + ["打开", "0x1E"], + ["关闭", "0x1F"], + ["千", "0x20"], + ["百", "0x21"], + ["十", "0x22"], + ["1", "0x23"], + ["2", "0x24"], + ["3", "0x25"], + ["4", "0x26"], + ["5", "0x27"], + ["6", "0x28"], + ["7", "0x29"], + ["8", "0x2A"], + ["9", "0x2B"], + ["0", "0x2C"], + ["当前", "0x2D"], + ["转", "0x2E"], + ["左", "0x2F"], + ["右", "0x30"], + ["请", "0x31"], + ["已", "0x32"], + ["现在", "0x33"], + ["是", "0x34"], + ["红灯", "0x35"], + ["绿灯", "0x36"], + ["黄灯", "0x37"], + ["温度", "0x38"], + ["湿度", "0x39"], + ["欢迎常来", "0x3A"], + ["还有", "0x3B"], + ["秒", "0x3C"], + ["分", "0x3D"], + ["变", "0x3E"], + ["等", "0x3F"], + ["下一次", "0x40"], + ["功能", "0x41"], + ["障碍物", "0x42"], + ["世界那么大,我想去看看", "0x43"] + ] +}; + + +//DCMotorRun +export const AFMotorRun = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("AFMotor" + Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown(AFMotorRun.MOTOR), "motor") + .appendField(Blockly.Msg.MIXLY_MICROBIT_Direction) + .appendField(new Blockly.FieldDropdown(AFMotorRun.DIRECTION), "direction") + .appendField(Blockly.Msg.MIXLY_SPEED); + this.appendValueInput("speed", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(''); + }, + MOTOR: [ + ["M1", "1"], + ["M2", "2"], + ["M3", "3"], + ["M4", "4"], + ], + DIRECTION: [ + [Blockly.Msg.MIXLY_FORWARD, "FORWARD"], + [Blockly.Msg.MIXLY_BACKWARD, "BACKWARD"], + ] +}; + +//DCMotorStop +export const AFMotorStop = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_STOP + "AFMotor" + Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown(AFMotorStop.MOTOR), "motor"); + this.setPreviousStatement(true); + this.setNextStatement(true); + }, + MOTOR: [ + ["M1", "1"], + ["M2", "2"], + ["M3", "3"], + ["M4", "4"], + ] +}; + +//初始化DFPlayer Mini +export const arduino_dfplayer_mini_begin = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + " " + Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("dfplayer_pin") + .setCheck(null) + .appendField(Blockly.Msg.USE_SERIAL_PORT); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.MIXLY_SETUP + " DFPlayer Mini"); + this.setHelpUrl(""); + } +}; + +//定义DFPlayer Mini 所使用的串口类型 +export const arduino_dfplayer_mini_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + ["Serial", "Serial"], + ["SoftwareSerial", "mySerial"], + ["SoftwareSerial1", "mySerial1"], + ["SoftwareSerial2", "mySerial2"], + ["SoftwareSerial3", "mySerial3"] + ]), "pin_type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(65); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 设置串口通信的超时时间 +export const arduino_dfplayer_mini_setTimeOut = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("timeout_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_SET_TIMEOUT); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_SET_TIMEOUT_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 设置音量 +export const arduino_dfplayer_mini_volume = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("volume_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_SET_VOLUME); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_SET_VOLUME_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 音量+|- +export const arduino_dfplayer_mini_volume_up_down = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_MP3_VOL_UP, "volumeUp"], + [Blockly.Msg.MIXLY_MP3_VOL_DOWN, "volumeDown"] + ]), "volume_type"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_VOLUME_UP_DOWN_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 设置音效 +export const arduino_dfplayer_mini_EQ = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("eq_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_SET_EQ); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_SET_EQ_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 定义音效类型 +export const arduino_dfplayer_mini_EQ_type = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_MP3_EQ_NORMAL, "DFPLAYER_EQ_NORMAL"], + [Blockly.Msg.MIXLY_MP3_EQ_POP, "DFPLAYER_EQ_POP"], + [Blockly.Msg.MIXLY_MP3_EQ_ROCK, "DFPLAYER_EQ_ROCK"], + [Blockly.Msg.MIXLY_MP3_EQ_CLASSIC, "DFPLAYER_EQ_CLASSIC"], + [Blockly.Msg.MIXLY_MP3_EQ_JAZZ, "DFPLAYER_EQ_JAZZ"], + [Blockly.Msg.MIXLY_MP3_EQ_BASS, "DFPLAYER_EQ_BASS"] + ]), "eq_type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 指定播放设备 +export const arduino_dfplayer_mini_outputDevice = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("outputdevice_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_SET_OUTPUTDEVICE); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_SET_OUTPUTDEVICE_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 定义播放设备类型 +export const arduino_dfplayer_mini_outputDevice_type = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + ["SD卡", "DFPLAYER_DEVICE_SD"], + ["U盘", "DFPLAYER_DEVICE_U_DISK"], + ["AUX", "DFPLAYER_DEVICE_AUX"], + ["SLEEP", "DFPLAYER_DEVICE_SLEEP"], + ["FLASH", "DFPLAYER_DEVICE_FLASH"] + ]), "outputdevice_type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 设置-1 +export const arduino_dfplayer_set_1 = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name") + .appendField(" ") + .appendField(new Blockly.FieldDropdown(arduino_dfplayer_set_1.DATA), "set_data"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + }, + DATA: [ + [Blockly.Msg.MIXLY_MP3_PREV, "previous"], + [Blockly.Msg.MIXLY_MP3_NEXT, "next"], + [Blockly.Msg.MIXLY_MP3_PLAY, "start"], + [Blockly.Msg.MIXLY_MP3_PAUSE, "pause"], + [Blockly.Msg.DFPLAYER_MINI_STOP_ADVERTISE, "stopAdvertise"], + [Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP, "enableLoop"], + [Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP, "disableLoop"], + [Blockly.Msg.DFPLAYER_MINI_ENABLE_LOOP_ALL, "enableLoopAll"], + [Blockly.Msg.DFPLAYER_MINI_DISABLE_LOOP_ALL, "disableLoopAll"], + [Blockly.Msg.DFPLAYER_MINI_RANDOM_ALL, "randomAll"], + [Blockly.Msg.DFPLAYER_MINI_ENABLE_DAC, "enableDAC"], + [Blockly.Msg.DFPLAYER_MINI_DISABLE_DAC, "disableDAC"], + [Blockly.Msg.DFPLAYER_MINI_SLEEP, "sleep"], + [Blockly.Msg.HTML_RESET, "reset"] + ] +}; + +//DFPlayer Mini 播放和循环指定曲目 +export const arduino_dfplayer_play_loop = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("play_data") + .setCheck(null) + .appendField(" ") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_MP3_PLAY, "play"], + [Blockly.Msg.MIXLY_MP3_LOOP_ONE, "loop"], + [Blockly.Msg.DFPLAYER_MINI_ADVERTISE, "advertise"], + [Blockly.Msg.DFPLAYER_MINI_PLAYMP3FOLDER, "playMp3Folder"] + ]), "play_type") + .appendField(Blockly.Msg.DFPLAYER_MINI_SONG); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_LOOP_TOOLTIP); + this.setHelpUrl(""); + }, + onchange: function () { + var dropdown_play_type = this.getFieldValue('play_type'); + if (dropdown_play_type == 'advertise') + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_ADVERTISE_TOOLTIP); + else if (dropdown_play_type == 'playMp3Folder') + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_PLAYMP3FOLDER_TOOLTIP); + else + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_LOOP_TOOLTIP); + } +}; + +//DFPlayer Mini 播放指定文件夹下的曲目 +export const arduino_dfplayer_playFolder = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("fold_data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MP3_PLAY) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.DFPLAYER_MINI_FOLDER, "playFolder"], + [Blockly.Msg.DFPLAYER_MINI_LARGEFOLDER, "playLargeFolder"] + ]), "fold_type"); + this.appendValueInput("play_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_SONG); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_PLAYFOLDER_TOOLTIP); + this.setHelpUrl(""); + }, + onchange: function () { + var dropdown_fold_type = this.getFieldValue('fold_type'); + if (dropdown_fold_type == 'playFolder') + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_PLAYFOLDER_TOOLTIP); + else + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_PLAY_PLAYLARGEFOLDER_TOOLTIP); + } +}; + +//DFPlayer Mini 循环播放指定文件夹下的曲目 +export const arduino_dfplayer_loopFolder = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("fold_data") + .setCheck(null) + .appendField(Blockly.Msg.DFPLAYER_MINI_LOOP_FOLDER); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_LOOP_FOLDER_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 获取当前信息 +export const arduino_dfplayer_read_now = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendDummyInput() + .appendField(' ' + Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PULSEIN_STAT, "readState"], + [Blockly.Msg.MIXLY_MP3_VOL, "readVolume"], + [Blockly.Msg.MIXLY_MP3_EQ_MODE, "readEQ"] + ]), "read_type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_READ_NOW_DATA_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 获取U盘|SD卡|FLASH的总文件数 +export const arduino_dfplayer_readFileCounts = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("device_type") + .setCheck(null) + .appendField(' ' + Blockly.Msg.MIXLY_GET); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS, "readFileCounts"], + [Blockly.Msg.DFPLAYER_MINI_READ_CURRENT_FILE_NUMBER, "readCurrentFileNumber"] + ]), "play_data"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS_TOOLTIP); + this.setHelpUrl(""); + } +}; + +//DFPlayer Mini 获取指定文件夹下的文件数 +export const arduino_dfplayer_readFileCountsInFolder = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendValueInput("folder_data") + .setCheck(null) + .appendField(' ' + Blockly.Msg.MIXLY_GET + ' ' + Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_MKDIR); + this.appendDummyInput() + .appendField(Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_READ_FILE_COUNTS_INFOLDER_TOOLTIP); + this.setHelpUrl(""); + } +}; + +export const arduino_dfplayer_available = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.YX5200_MP3) + .appendField(new Blockly.FieldTextInput("myPlayer"), "dfplayer_name"); + this.appendDummyInput() + .appendField(".") + .appendField(new Blockly.FieldDropdown([ + ["available", "available"], + ["readType", "readType"], ["read", "read"] + ]), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_AVAILABLE_TOOLTIP); + this.setHelpUrl(""); + }, + onchange: function () { + var dropdown_type = this.getFieldValue('type'); + if (dropdown_type == 'available') + this.setTooltip(Blockly.Msg.DFPLAYER_MINI_AVAILABLE_TOOLTIP); + else if (dropdown_type == 'readType') + this.setTooltip( + Blockly.Msg.DFPLAYER_MINI_READ_TYPE_TOOLTIP + + "\n" + Blockly.Msg.RETURN_DATA_ANALYSIS + ":" + + "\n0 - TimeOut" + + "\n1 - WrongStack" + + "\n2 - DFPlayerCardInserted" + + "\n3 - DFPlayerCardRemoved" + + "\n4 - DFPlayerCardOnline" + + "\n5 - DFPlayerUSBInserted" + + "\n6 - DFPlayerUSBRemoved" + + "\n7 - DFPlayerPlayFinished" + + "\n8 - DFPlayerError" + ); + else + this.setTooltip( + Blockly.Msg.DFPLAYER_MINI_READ_TOOLTIP + + "\n" + Blockly.Msg.RETURN_DATA_ANALYSIS + ":" + + "\n1 - Busy" + + "\n2 - Sleeping" + + "\n3 - SerialWrongStack" + + "\n4 - CheckSumNotMatch" + + "\n5 - FileIndexOut" + + "\n6 - FileMismatch" + + "\n7 - Advertise" + ); + } +}; + +export const I2Cmotor = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField("I2C" + Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown(I2Cmotor.I2C_Motor_SELECT), "motor"); + this.appendValueInput("SPEED") + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MOTOR_SPEED); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + }, + I2C_Motor_SELECT: [ + ["M0", "0"], + ["M1", "1"], + ["M2", "2"], + ["M3", "3"], + ["M4", "4"], + ["M5", "5"], + ["M6", "6"], + ["M7", "7"] + ] +}; + +export const M9101X_S_MP3_CONTROL = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("").appendField("N9X01 " + Blockly.Msg.GD5800_MP3); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown(M9101X_S_MP3_CONTROL.M9101X_S_MP3_CONTROL_TYPE), "CONTROL_TYPE"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + }, + M9101X_S_MP3_CONTROL_TYPE: [ + [Blockly.Msg.MIXLY_MP3_PLAY, "play();"], + [Blockly.Msg.MIXLY_MP3_PAUSE, "pause();"], + [Blockly.Msg.MIXLY_STOP, "stop();"], + [Blockly.Msg.MIXLY_MP3_NEXT, "play_down();"], + [Blockly.Msg.MIXLY_MP3_PREV, "play_up();"], + [Blockly.Msg.MIXLY_MP3_LOOP_ALL, "cycle_all();"], + [Blockly.Msg.MIXLY_MP3_LOOP_ONE, "cycle_single();"], + ["切换到TF卡", "set_sd();"], + ["切换到" + Blockly.Msg.MIXLY_MP3_UDISK, "set_usb_flash();"], + ["切换到MP3模式", "set_mp3();"], + ["切换到flash模式", "set_flash();"], + ["切换音乐风格", "set_eq();"], + ] +}; + +//N910X MP3模块 音量设置 +export const M9101X_S_MP3_VOL_CONTROL = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("").appendField("N9X01 " + Blockly.Msg.GD5800_MP3); + this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number); + this.appendDummyInput("").appendField(Blockly.Msg.MIXLY_MP3_VOL); + this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_STAT).setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//N910X MP3模块播放第N首 +export const M9101X_S_MP3_PLAY_NUM = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("").appendField("N9X01 " + Blockly.Msg.GD5800_MP3); + this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number); + this.appendValueInput("NUM", Number).appendField(Blockly.Msg.MIXLY_MP3_PLAY_NUM).setCheck(Number); + this.appendDummyInput("").appendField("首"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/blynk.js b/mixly/boards/default_src/arduino_avr/blocks/blynk.js new file mode 100644 index 00000000..7f5b7ba5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/blynk.js @@ -0,0 +1,1376 @@ +import * as Blockly from 'blockly/core'; + +// const BLYNK0_HUE = 0; //红色 +const BLYNK1_HUE = 159; //Mountain Meadow + +//物联网-服务器信息 +export const blynk_usb_server = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 25, 25)) + .appendField(Blockly.Msg.blynk_USB_SERVER_INFO); + this.appendValueInput("auth_key", String) + .appendField(Blockly.Msg.blynk_IOT_AUTH) + .setCheck([String, Number]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-一键配网 +export const blynk_smartconfig = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField("SmartConfig" + Blockly.Msg.blynk_smartconfig); + this.appendValueInput("server_add") + .appendField(Blockly.Msg.blynk_SERVER_ADD) + .setCheck(String); + this.appendValueInput("auth_key", String) + .appendField(Blockly.Msg.blynk_IOT_AUTH) + .setCheck([String, Number]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl("https://gitee.com/hznupeter/Blynk_IOT/wikis/pages"); + } +}; + +//物联网-服务器信息_uno +export const blynk_server = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_SERVER_INFO); + this.appendValueInput("server_add") + .appendField(Blockly.Msg.blynk_SERVER_ADD) + .setCheck(String); + this.appendValueInput("wifi_ssid") + .appendField(Blockly.Msg.blynk_WIFI_SSID) + .setCheck(String); + this.appendValueInput("wifi_pass") + .appendField(Blockly.Msg.blynk_WIFI_PASS) + .setCheck(String); + this.appendValueInput("auth_key", String) + .appendField(Blockly.Msg.blynk_IOT_AUTH) + .setCheck([String, Number]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl("https://gitee.com/hznupeter/Blynk_IOT/wikis/pages"); + } +}; + +//虚拟管脚选择 +const BLYNK_VIRTUALPIN_SELECT = [ + ["V0", "V0"], + ["V1", "V1"], + ["V2", "V2"], + ["V3", "V3"], + ["V4", "V4"], + ["V5", "V5"], + ["V6", "V6"], + ["V7", "V7"], + ["V8", "V8"], + ["V9", "V9"], + ["V10", "V10"], + ["V11", "V11"], + ["V12", "V12"], + ["V13", "V13"], + ["V14", "V14"], + ["V15", "V15"], + ["V16", "V16"], + ["V17", "V17"], + ["V18", "V18"], + ["V19", "V19"], + ["V20", "V20"], + ["V21", "V21"], + ["V22", "V22"], + ["V23", "V23"], + ["V24", "V24"], + ["V25", "V25"], + ["V26", "V26"], + ["V27", "V27"], + ["V28", "V28"], + ["V29", "V29"], + ["V30", "V30"], + ["V31", "V31"], + ["V32", "V32"], + ["V33", "V33"], + ["V34", "V34"], + ["V35", "V35"], + ["V36", "V36"], + ["V37", "V37"], + ["V38", "V38"], + ["V39", "V39"], + ["V40", "V40"] +]; + +//定时器选择 +const BLYNK_TIMER_SELECT = [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"], + ["9", "9"], + ["10", "10"], + ["11", "11"], + ["12", "12"], + ["13", "13"], + ["14", "14"], + ["15", "15"], + ["16", "16"], +]; + +//物联网-发送数据到app +export const blynk_iot_push_data = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_PUSH_DATA); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendValueInput("data") + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +//从app端获取数据 +export const blynk_iot_get_data = { + /** + * Block for defining a procedure with no return value. + * @this Blockly.Block + */ + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_GET_DATA); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendDummyInput() + .appendField("", "PARAMS"); + this.setMutator(new Blockly.icons.MutatorIcon(["procedures_mutatorarg"], this));//添加齿轮 + this.arguments_ = [];//新增参数名称 + this.argumentstype_ = [];//新增参数类型 + this.setStatements_(true); + this.setInputsInline(true); + this.setPreviousStatement(false, null); + this.setNextStatement(false, null); + this.statementConnection_ = null; + }, + getVars: function () { + return [this.getFieldValue("VAR")]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue("VAR"))) { + this.setTitleValue(newName, "VAR"); + } + }, + /** + * Add or remove the statement block from this function definition. + * @param {boolean} hasStatements True if a statement block is needed. + * @this Blockly.Block + */ + setStatements_: function (hasStatements) { + if (this.hasStatements_ === hasStatements) { + return; + } + if (hasStatements) { + this.appendStatementInput("STACK") + .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO); + if (this.getInput("RETURN")) { + this.moveInputBefore("STACK", "RETURN"); + } + } else { + this.removeInput("STACK", true); + } + this.hasStatements_ = hasStatements; + }, + /** + * Update the display of parameters for this procedure definition block. + * Display a warning if there are duplicately named parameters. + * @private + * @this Blockly.Block + */ + updateParams_: function () { + // Check for duplicated arguments. + var badArg = false; + var hash = {}; + for (var i = 0; i < this.arguments_.length; i++) { + if (hash["arg_" + this.arguments_[i].toLowerCase()]) { + badArg = true; + break; + } + hash["arg_" + this.arguments_[i].toLowerCase()] = true; + } + if (badArg) { + this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING); + } else { + this.setWarningText(null); + } + // Merge the arguments into a human-readable list. + var paramString = ""; + if (this.arguments_.length) { + paramString = Blockly.Msg.PROCEDURES_BEFORE_PARAMS + + " " + this.arguments_.join(", "); + } + // The params field is deterministic based on the mutation, + // no need to fire a change event. + Blockly.Events.disable(); + this.setFieldValue(paramString, "PARAMS"); + Blockly.Events.enable(); + }, + /** + * Create XML to represent the argument inputs. + * @param {=boolean} opt_paramIds If true include the IDs of the parameter + * quarks. Used by Blockly.Procedures.mutateCallers for reconnection. + * @return {!Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement("mutation"); + for (var i = 0; i < this.arguments_.length; i++) { + var parameter = document.createElement("arg"); + parameter.setAttribute("name", this.arguments_[i]); + parameter.setAttribute("vartype", this.argumentstype_[i]);//新增 + container.appendChild(parameter); + } + + // Save whether the statement input is visible. + if (!this.hasStatements_) { + container.setAttribute("statements", "false"); + } + return container; + }, + /** + * Parse XML to restore the argument inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.arguments_ = []; + this.argumentstype_ = [];//新增 + for (var i = 0; xmlElement.childNodes[i]; i++) { + let childNode = xmlElement.childNodes[i] + if (childNode.nodeName.toLowerCase() == "arg") { + this.arguments_.push(childNode.getAttribute("name")); + this.argumentstype_.push(childNode.getAttribute("vartype"));//新增 + } + } + this.updateParams_(); + // Blockly.Procedures.mutateCallers(this); + // Show or hide the statement input. + this.setStatements_(xmlElement.getAttribute("statements") !== "false"); + }, + /** + * Populate the mutator"s dialog with this block"s components. + * @param {!Blockly.Workspace} workspace Mutator"s workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = workspace.newBlock("procedures_mutatorcontainer"); + containerBlock.initSvg(); + + // Check/uncheck the allow statement box. + if (this.getInput("RETURN")) { + containerBlock.setFieldValue(this.hasStatements_ ? "TRUE" : "FALSE", + "STATEMENTS"); + } else { + containerBlock.getInput("STATEMENT_INPUT").setVisible(false); + } + + // Parameter list. + var connection = containerBlock.getInput("STACK").connection; + for (var i = 0; i < this.arguments_.length; i++) { + var paramBlock = workspace.newBlock("procedures_mutatorarg"); + paramBlock.initSvg(); + paramBlock.setFieldValue(this.arguments_[i], "NAME"); + paramBlock.setFieldValue(this.argumentstype_[i], "TYPEVAR");//新增 + // Store the old location. + paramBlock.oldLocation = i; + connection.connect(paramBlock.previousConnection); + connection = paramBlock.nextConnection; + } + // Initialize procedure"s callers with blank IDs. + // Blockly.Procedures.mutateCallers(this); + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog"s components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + // Parameter list. + this.arguments_ = []; + this.paramIds_ = []; + this.argumentstype_ = [];//新增 + var paramBlock = containerBlock.getInputTargetBlock("STACK"); + while (paramBlock) { + this.arguments_.push(paramBlock.getFieldValue("NAME")); + this.argumentstype_.push(paramBlock.getFieldValue("TYPEVAR"));//新增 + this.paramIds_.push(paramBlock.id); + paramBlock = paramBlock.nextConnection && + paramBlock.nextConnection.targetBlock(); + } + this.updateParams_(); + // Blockly.Procedures.mutateCallers(this); + + // Show/hide the statement input. + var hasStatements = containerBlock.getFieldValue("STATEMENTS"); + if (hasStatements !== null) { + hasStatements = hasStatements == "TRUE"; + if (this.hasStatements_ != hasStatements) { + if (hasStatements) { + this.setStatements_(true); + // Restore the stack, if one was saved. + this.statementConnection_ && this.statementConnection_.reconnect(this, "STACK"); + this.statementConnection_ = null; + } else { + // Save the stack, then disconnect it. + var stackConnection = this.getInput("STACK").connection; + this.statementConnection_ = stackConnection.targetConnection; + if (this.statementConnection_) { + var stackBlock = stackConnection.targetBlock(); + stackBlock.unplug(); + stackBlock.bumpNeighbours_(); + } + this.setStatements_(false); + } + } + } + }, + /** + * Dispose of any callers. + * @this Blockly.Block + */ + dispose: function () { + // var name = this.getFieldValue("NAME"); + // Blockly.Procedures.disposeCallers(name, this.workspace); + // Call parent"s destructor. + this.constructor.prototype.dispose.apply(this, arguments); + }, + /** + * Return the signature of this procedure definition. + * @return {!Array} Tuple containing three elements: + * - the name of the defined procedure, + * - a list of all its arguments, + * - that it DOES NOT have a return value. + * @this Blockly.Block + */ + // getProcedureDef: function () { + // return ["ignoreProcedureIotGetData", this.arguments_, false]; + // }, + /** + * Return all variables referenced by this block. + * @return {!Array.} List of variable names. + * @this Blockly.Block + */ + // eslint-disable-next-line no-dupe-keys + getVars: function () { + return this.arguments_; + }, + /** + * Notification that a variable is renaming. + * If the name matches one of this block"s variables, rename it. + * @param {string} oldName Previous name of variable. + * @param {string} newName Renamed variable. + * @this Blockly.Block + */ + // eslint-disable-next-line no-dupe-keys + renameVar: function (oldName, newName) { + var change = false; + for (var i = 0; i < this.arguments_.length; i++) { + if (Blockly.Names.equals(oldName, this.arguments_[i])) { + this.arguments_[i] = newName; + change = true; + } + } + if (change) { + this.updateParams_(); + // Update the mutator"s variables if the mutator is open. + if (this.mutator.isVisible()) { + var blocks = this.mutator.workspace_.getAllBlocks(); + for (var i = 0; blocks[i]; i++) { + let block = blocks[i]; + if (block.type == "procedures_mutatorarg" && + Blockly.Names.equals(oldName, block.getFieldValue("NAME"))) { + block.setFieldValue(newName, "NAME"); + } + } + } + } + }, + /** + * Add custom menu options to this block"s context menu. + * @param {!Array} options List of menu options to add to. + * @this Blockly.Block + */ + customContextMenu: function (options) { + // Add option to create caller. + var option = { enabled: true }; + var name = this.getFieldValue("NAME"); + option.text = Blockly.Msg.PROCEDURES_CREATE_DO.replace("%1", name); + var xmlMutation = Blockly.utils.xml.createElement("mutation"); + xmlMutation.setAttribute("name", name); + for (var i = 0; i < this.arguments_.length; i++) { + var xmlArg = Blockly.utils.xml.createElement("arg"); + xmlArg.setAttribute("name", this.arguments_[i]); + xmlArg.setAttribute("type", this.argumentstype_[i]);//新增 + xmlMutation.appendChild(xmlArg); + } + var xmlBlock = Blockly.utils.xml.createElement("block", null, xmlMutation); + xmlBlock.setAttribute("type", this.callType_); + option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock); + options.push(option); + + // Add options to create getters for each parameter. + if (!this.isCollapsed()) { + for (var i = 0; i < this.arguments_.length; i++) { + var option = { enabled: true }; + var name = this.arguments_[i]; + option.text = Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1", name); + var xmlField = Blockly.utils.xml.createElement("field", null, name); + xmlField.setAttribute("name", "VAR"); + xmlField.setAttribute("type", "TYPEVAR");//新增 + var xmlBlock = Blockly.utils.xml.createElement("block", null, xmlField); + xmlBlock.setAttribute("type", "variables_get"); + option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock); + options.push(option); + } + } + }, + callType_: "procedures_callnoreturn" +}; + +//blynk定时器 +export const Blynk_iot_timer = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendValueInput("TIME") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.blynk_TIMER) + .appendField(new Blockly.FieldDropdown(BLYNK_TIMER_SELECT), "timerNo"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.appendStatementInput("DO") + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setPreviousStatement(false); + this.setNextStatement(false); + } +}; + +//blynk服务器连接状态 +export const Blynk_connect_state = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.Blynk_connect_state); + this.setOutput(true, null); + this.setHelpUrl(""); + } +}; + +const BLYNK_CONNECT_STATE_SELECT = [ + [Blockly.Msg.BLYNK_CONNECTED, 'BLYNK_CONNECTED'], + [Blockly.Msg.BLYNK_DISCONNECTED, 'BLYNK_DISCONNECTED'], + [Blockly.Msg.BLYNK_APP_CONNECTED, 'BLYNK_APP_CONNECTED'], + [Blockly.Msg.BLYNK_APP_DISCONNECTED, 'BLYNK_APP_DISCONNECTED'], +]; + +//blynk 连接状态函数 +export const Blynk_iot_CONNECT_STATE = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_CONNECT_STATE_SELECT), "state"); + this.appendStatementInput("DO") + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setPreviousStatement(false); + this.setNextStatement(false); + } +}; + +//blynk同步所有管脚状态 +export const Blynk_iot_BLYNK_syncAll = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.BLYNK_syncAll); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +//blynk同步虚拟管脚状态 +export const blynk_iot_syncVirtual = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_syncVirtual); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +//物联网-LED组件颜色&开关 +export const blynk_iot_WidgetLED_COLOR = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_led.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_WidgetLED); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.appendValueInput("STAT") + .appendField(Blockly.Msg.MIXLY_STAT) + .setCheck([Number, Boolean]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +//物联网-LED组件颜色&亮度 +export const blynk_iot_WidgetLED_VALUE = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_led.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_WidgetLED); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +const AC_TYPE = [ + [Blockly.Msg.blynk_IOT_GREE, "Gree"], + [Blockly.Msg.blynk_IOT_MIDEA, "Midea"], +]; + +const AC_POWER = [ + [Blockly.Msg.MIXLY_ON, "true"], + [Blockly.Msg.MIXLY_OFF, "false"] +]; + +const AC_MODE = [ + [Blockly.Msg.blynk_IOT_FAN, "FAN"], + [Blockly.Msg.blynk_IOT_HEAT, "HEAT"], + [Blockly.Msg.blynk_IOT_COOL, "COOL"], + [Blockly.Msg.blynk_IOT_DRY, "DRY"], + [Blockly.Msg.blynk_IOT_AUTO, "AUTO"] +]; + +const AC_FAN = [ + [Blockly.Msg.blynk_IOT_FAN_3, "FAN_3"], + [Blockly.Msg.blynk_IOT_FAN_2, "FAN_2"], + [Blockly.Msg.blynk_IOT_FAN_1, "FAN_1"], + [Blockly.Msg.blynk_IOT_FAN_0, "FAN_0"] +]; + +//红外控制空调 +export const blynk_iot_ir_send_ac = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.blynk_IOT_IR_SEND) + .appendField(new Blockly.FieldDropdown(AC_TYPE), "AC_TYPE"); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.blynk_IOT_IR_POWER) + .appendField(new Blockly.FieldDropdown(AC_POWER), "AC_POWER"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown(AC_MODE), "AC_MODE"); + this.appendDummyInput("") + .appendField(Blockly.Msg.blynk_IOT_IR_FAN) + .appendField(new Blockly.FieldDropdown(AC_FAN), "AC_FAN"); + this.appendValueInput("AC_TEMP", Number) + .appendField(Blockly.Msg.blynk_IOT_IR_TEMP) + .setCheck(Number); + this.setPreviousStatement(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_IR_SEND_NEC_TOOLTIP); + } +}; + +//红外接收模块(raw) +export const blynk_iot_ir_recv_raw = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.blynk_IOT_IR_RECEIVE_RAW) + .setCheck(Number); + // this.appendValueInput("PIN", Number).appendField(Blockly.Msg.MIXLY_PIN).setCheck(Number); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.blynk_IOT_IR_RECEIVE_RAW_TOOLTIP); + } +}; + +//红外发送 +export const blynk_iot_ir_send = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.blynk_IOT_IR_SEND) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.blynk_IOT_IR_SEND_CODE) + .appendField(new Blockly.FieldTextInput('0,0,0'), 'IR_CODE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.blynk_IOT_IR_SEND_CODE_TOOLTIP); + } +} + +//物联网-发送邮件 +export const blynk_email = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_email.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_EMAIL); + this.appendValueInput("email_add") + .appendField(Blockly.Msg.blynk_EMAIL_ADD) + .setCheck(String); + this.appendValueInput("Subject") + .appendField(Blockly.Msg.blynk_EMAIL_SUBJECT) + .setCheck(String); + this.appendValueInput("content") + .appendField(Blockly.Msg.blynk_EMAIL_CONTENT) + .setCheck(String); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-发送通知 +export const blynk_notify = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_push_notifications.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_NOTIFY); + this.appendValueInput("content") + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([String, Number, Boolean]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-终端组件显示文本 +export const blynk_terminal = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_terminal.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_terminal) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + this.appendValueInput("content") + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([String, Number, Boolean]); + this.appendDummyInput(""); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-视频流 +export const blynk_videourl = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_video.png'), 20, 20)) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendValueInput("url") + .appendField(Blockly.Msg.blynk_VIDEOURL) + .setCheck(String); + this.appendDummyInput(""); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-桥接授权码 +export const blynk_bridge_auth = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_bridge.png'), 20, 20)) + .appendField(Blockly.Msg.BLYNK_BRIDGE_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendValueInput("auth") + .appendField(Blockly.Msg.blynk_BRIDGE_AUTH) + .setCheck(String); + this.appendDummyInput(""); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-桥接数字输出 +export const blynk_bridge_digitalWrite = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_bridge.png'), 20, 20)); + this.appendDummyInput("") + .appendField(Blockly.Msg.BLYNK_BRIDGE_VIRTUALPIN); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendValueInput("PIN", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_DIGITALWRITE_PIN); + this.appendValueInput("STAT") + .appendField(Blockly.Msg.MIXLY_STAT) + .setCheck([Number, Boolean]); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-桥接模拟输出 +export const blynk_bridge_AnaloglWrite = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_bridge.png'), 20, 20)); + this.appendDummyInput("") + .appendField(Blockly.Msg.BLYNK_BRIDGE_VIRTUALPIN); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendValueInput("PIN", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_ANALOGWRITE_PIN); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_VALUE2) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-桥接虚拟管脚 +export const blynk_bridge_VPin = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_bridge.png'), 20, 20)); + this.appendDummyInput("") + .appendField(Blockly.Msg.BLYNK_BRIDGE_VIRTUALPIN); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendDummyInput("") + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin2"); + this.appendValueInput("NUM") + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//物联网-RTC组件初始化 +export const blynk_WidgetRTC_init = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_rtc.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_WidgetRTC_init); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.blynk_WidgetRTC_setSyncInterval) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.blynk_WidgetRTC_mintues); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//传感器-实时时钟块_时间变量 +var BLYNK_RTC_TIME_TYPE = [ + [Blockly.Msg.MIXLY_YEAR, "year"], + [Blockly.Msg.MIXLY_MONTH, "month"], + [Blockly.Msg.MIXLY_DAY, "day"], + [Blockly.Msg.MIXLY_HOUR, "hour"], + [Blockly.Msg.MIXLY_MINUTE, "minute"], + [Blockly.Msg.MIXLY_SECOND, "second"], + [Blockly.Msg.MIXLY_WEEK, "weekday"] +]; + +//传感器-实时时钟块_获取时间 +export const blynk_WidgetRTC_get_time = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_rtc.png'), 20, 20)) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.blynk_WidgetRTC_get_time); + + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(BLYNK_RTC_TIME_TYPE), "TIME_TYPE"); + this.setInputsInline(true); + this.setOutput(true, Number); + } +}; + +//播放音乐 +export const blynk_iot_playmusic = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_player.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_iot_playmusic); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(""); + } +}; + +//从终端获取字符串 +export const blynk_iot_terminal_get = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_terminal.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_IOT_terminal_get); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(""); + } +}; + +//光线传感器 +export const blynk_light = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_light_sensor.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_LIGHT); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(""); + } +}; + +//重力传感器 +export const blynk_gravity = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_gravity_sensor.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_GRAVITY); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(""); + } +}; + +//加速度传感器 +export const blynk_acc = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_accelerometer_sensor.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_ACC); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.blynk_ACC_tooltip); + } +}; + +//时间输入-简单 +export const blynk_time_input_1 = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/widget_timeinput.png'), 20, 20)) + .appendField(Blockly.Msg.blynk_time_input_1); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput('DO') + .appendField(''); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.blynk_ACC_tooltip); + } +}; + +//lm35温度传感器-arduino +export const LM35ESP = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_LM35); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(''); + } +}; + +//一键配网(无需安可信) +export const blynk_AP_config = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_AP_config); + this.appendValueInput("server_add") + .setCheck(String) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendValueInput("auth_key") + .setCheck(String) + .appendField(Blockly.Msg.blynk_IOT_AUTH) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.blynk_AP_config_tooltip); + this.setHelpUrl(""); + } +}; + +//一键配网手动配置授权码 +export const blynk_AP_config_2 = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_AP_config2); + this.appendValueInput("server_add") + .setCheck(String) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.blynk_AP_config_tooltip); + this.setHelpUrl(""); + } +}; + +//Blynk终端清屏 +export const blynk_terminal_clear = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_terminal_clear); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setHelpUrl(""); + } +}; + +//Blynk LCD显示 +export const blynk_lcd = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_lcd) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_MIXGO_MUSIC_SHOW_IN + Blockly.Msg.MIXLY_4DIGITDISPLAY_NOMBER1); + this.appendValueInput("x") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.DATAFRAME_COLUMN + Blockly.Msg.MIXLY_4DIGITDISPLAY_NOMBER1); + this.appendValueInput("y") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.DATAFRAME_RAW); + this.appendValueInput("value") + .appendField(Blockly.Msg.OLEDDISPLAY) + .setCheck(null); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setHelpUrl(""); + this.setInputsInline(true); + } +}; + +//Blynk LCD清屏 +export const blynk_lcd_clear = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_lcd) + .appendField(Blockly.Msg.MIXLY_LCD_STAT_CLEAR); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setHelpUrl(""); + } +}; + +//ESP32 blynk BLE连接方式 +export const blynk_esp32_ble = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_esp32_ble); + this.appendValueInput("auth") + .appendField(Blockly.Msg.blynk_IOT_AUTH); + this.appendValueInput("name") + .setCheck(String) + .appendField("BLE") + .appendField(Blockly.Msg.HTML_NAME); + this.setHelpUrl(""); + } +}; + +//ESP32 blynk Bluetooth连接方式 +export const blynk_esp32_Bluetooth = { + init: function () { + this.setColour(BLYNK1_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_esp32_Bluetooth); + this.appendValueInput("auth") + .setCheck(String) + .appendField(Blockly.Msg.blynk_IOT_AUTH); + this.appendValueInput("name") + .setCheck(String) + .appendField("Bluetooth") + .appendField(Blockly.Msg.HTML_NAME); + this.setHelpUrl(""); + } +}; + +//Arduino blynk Bluetooth 连接方式 +export const arduino_blynk_bluetooth = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.arduino_blynk_bluetooth); + this.appendValueInput("auth") + .setCheck(String) + .appendField(Blockly.Msg.blynk_IOT_AUTH); + this.appendValueInput("RX") + .setCheck(null) + .appendField("RX"); + this.appendValueInput("TX") + .setCheck(null) + .appendField("TX"); + this.setColour(BLYNK1_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件添加数据 +export const blynk_table = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField("ID"); + this.appendValueInput("id") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.HTML_NAME); + this.appendValueInput("mingcheng") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendValueInput("shujv") + .setCheck(null); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件更新数据 +export const blynk_table_update = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table_update) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField("ID"); + this.appendValueInput("id") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.HTML_NAME); + this.appendValueInput("mingcheng") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendValueInput("shujv") + .setCheck(null); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件高亮显示数据 +export const blynk_table_highlight = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table_highlight) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField("ID"); + this.appendValueInput("id") + .setCheck(null); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件选择数据 +export const blynk_table_select = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table_select) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField("ID"); + this.appendValueInput("id") + .setCheck(null); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件取消选择数据 +export const blynk_table_unselect = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table_unselect) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField("ID"); + this.appendValueInput("id") + .setCheck(null); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//Blynk Table小部件数据清除 +export const blynk_table_cleardata = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_table_cleardata) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//ESP32 CAM相机 +export const esp_camera = { + init: function () { + this.appendDummyInput() + .appendField("ESP32 CAM mode") + .appendField(new Blockly.FieldDropdown([["STA", "1"], ["AP", "0"]]), "mode"); + this.appendValueInput("wifi_ssid") + .setCheck(null) + .appendField(Blockly.Msg.blynk_WIFI_SSID); + this.appendValueInput("wifi_pass") + .setCheck(null) + .appendField(Blockly.Msg.blynk_WIFI_PASS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(Blockly.Msg.esp_camera); + this.setHelpUrl(""); + } +}; + +//ESP32 CAM相机 & blynk +export const esp_camera_blynk = { + init: function () { + this.appendDummyInput() + .appendField("ESP32 CAM & Blynk"); + this.appendValueInput("wifi_ssid") + .setCheck(null) + .appendField(Blockly.Msg.blynk_WIFI_SSID); + this.appendValueInput("wifi_pass") + .setCheck(null) + .appendField(Blockly.Msg.blynk_WIFI_PASS); + this.appendValueInput("server") + .setCheck(null) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendValueInput("auth") + .setCheck(null) + .appendField(Blockly.Msg.blynk_IOT_AUTH); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(Blockly.Msg.esp_camera); + this.setHelpUrl(""); + } +}; + +export const take_a_photo1 = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.take_a_photo1); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(Blockly.Msg.take_a_photo1); + this.setHelpUrl(""); + } +}; + +export const blynk_table_click = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.BLYNK_TABLE_CLICK) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput("function") + .setCheck(null); + this.setColour(BLYNK1_HUE); + this.setTooltip(""); + this.setHelpUrl("https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/Table/Table_Advanced/Table_Advanced.ino"); + } +}; + +export const blynk_table_order = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.BLYNK_TABLE_ORDER) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin"); + this.appendStatementInput("function") + .setCheck(null); + this.setColour(BLYNK1_HUE); + this.setTooltip(""); + this.setHelpUrl("https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/Table/Table_Advanced/Table_Advanced.ino"); + } +}; + +export const blynk_table_add_data = { + init: function () { + this.appendValueInput("name") + .appendField(Blockly.Msg.blynk_table) + .appendField(Blockly.Msg.BLYNK_VIRTUALPIN) + .appendField(new Blockly.FieldDropdown(BLYNK_VIRTUALPIN_SELECT), "Vpin") + .appendField(Blockly.Msg.HTML_NAME); + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(BLYNK1_HUE); + this.setTooltip(""); + this.setHelpUrl("https://github.com/blynkkk/blynk-library/blob/master/examples/Widgets/Table/Table_Advanced/Table_Advanced.ino"); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/communicate.js b/mixly/boards/default_src/arduino_avr/blocks/communicate.js new file mode 100644 index 00000000..d2fd513e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/communicate.js @@ -0,0 +1,776 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const COMMUNICATE_HUE = 140; + +//红外接收模块 +export const ir_recv = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("PIN", Number) + .appendField(new Blockly.FieldTextInput('ir_item'), 'VAR') + .appendField(Blockly.Msg.MIXLY_IR_RECEIVE) + .setCheck(Number); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_IR_RECEIVE_YES); + this.appendStatementInput('DO2') + .appendField(Blockly.Msg.MIXLY_IR_RECEIVE_NO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_IR_RECIEVE_TOOLTIP); + }, + getVars: function () { + return [this.getFieldValue('VAR')]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) { + this.setTitleValue(newName, 'VAR'); + } + } +}; + +const TYPE = [ + ['RC5', 'RC5'], + ['RC6', 'RC6'], + ['NEC', 'NEC'], + ['Sony', 'Sony'], + ['Panasonic', 'Panasonic'], + ['JVC', 'JVC'], + ['SAMSUNG', 'SAMSUNG'], + ['Whynter', 'Whynter'], + ['AiwaRCT501', 'AiwaRCT501'], + ['LG', 'LG'], + ['Sanyo', 'Sanyo'], + ['Mitsubishi', 'Mitsubishi'], + ['DISH', 'DISH'], + ['SharpRaw', 'SharpRaw'], + ['Denon', 'Denon'] +]; + +//红外发射模块(NEC) +export const ir_send_nec = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_IR_SEND_NEC1) + .appendField(new Blockly.FieldDropdown(TYPE), 'TYPE') + .appendField(Blockly.Msg.MIXLY_IR_SEND_NEC2) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput('data') + .setCheck(Number) + .appendField(' ' + Blockly.Msg.MIXLY_DATA); + this.appendValueInput('bits') + .setCheck(Number) + .appendField(' ' + Blockly.Msg.MIXLY_BITS); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_IR_SEND_NEC_TOOLTIP); + } +} + +//红外接收使能 +export const ir_recv_enable = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_IR_RECEIVE_ENABLE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_IR_ENABLE); + } +}; + +//红外接收模块(raw) +export const ir_recv_raw = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_IR_RECEIVE_RAW) + .setCheck(Number); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_IR_RECIEVE_RAW_TOOLTIP); + } +}; + +//红外发射模块(raw) +export const ir_send_raw = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_IR_SEND_RAW) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendDummyInput("") + .appendField(' ' + Blockly.Msg.MIXLY_I2C_SLAVE_WRITE_ARRAY_ARRAYNAME) + .appendField(new Blockly.FieldTextInput('0,0,0'), 'TEXT'); + this.appendValueInput('length') + .setCheck(Number) + .appendField(' ' + Blockly.Msg.MIXLY_LIST_LENGTH); + this.appendValueInput('freq') + .setCheck(Number) + .appendField(' ' + Blockly.Msg.MIXLY_FREQUENCY); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_IR_SEND_RAW_TOOLTIP); + } +}; + +// IIC通信 +// IIC初始化主机 +export const i2c_master_Init = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + 'I2C' + Blockly.Msg.MIXLY_MASTER); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +// IIC初始化从机 +export const i2c_slave_Init = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + 'I2C' + Blockly.Msg.MIXLY_SALVE + Blockly.Msg.MIXLY_LCD_ADDRESS); + this.appendValueInput("i2c_address") + .setCheck(null); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(Blockly.Msg.MIXLY_I2C_MASTER_INITHelp); + this.setHelpUrl(""); + } +}; + +//IIC主机发送数据 +export const i2c_begin_end_transmission = { + init: function () { + this.appendDummyInput() + .appendField("I2C" + Blockly.Msg.MIXLY_MASTER + Blockly.Msg.MIXLY_SEND_DATA); + this.appendValueInput("i2c_address") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_ADDRESS); + this.appendStatementInput("transmission_data") + .setCheck(null); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//IIC写入主从机数据 +export const i2c_write = { + init: function () { + this.appendValueInput("i2c_write_data") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("I2C" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + } +}; + +// IIC写入数线数据 +export const i2c_slave_write_array = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('array') + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_WRITE_ARRAY) + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_WRITE_ARRAY_ARRAYNAME); + this.appendValueInput('length') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LIST_LEN); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_SLAVE_WRITE_ARRAY); + } +}; + +// IIC从机读取字节数 +export const i2c_howmany = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_I2C_HOWMANY); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_HOWMANY); + } +}; + +// IIC主机或从机读取成功吗? +export const i2c_available = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_I2C_AVAILABLE); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_AVAILABLE); + } +}; + +// IIC主机或从机读取的数据 +export const i2c_read = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_READ2); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_MASTER_READ2); + } +}; + +//写入寄存器地址 +export const i2c_master_writerReg = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('device') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_WRITE); + this.appendValueInput('regadd') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_REGADD); + this.appendValueInput('value') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_I2C_VALUE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +//读取寄存器地址 +export const i2c_master_readerReg = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('device') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_READ); + this.appendValueInput('regadd') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_REGADD); + this.appendValueInput('bytes') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_BYTES); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +export const i2c_slave_onrequest = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_ONREQUEST); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_SLAVE_ONREQUEST); + } +}; + +export const i2c_master_writer = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('device') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_WRITE); + this.appendValueInput('value') + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HTML_VALUE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_MASTER_WRITE); + } +}; + +export const i2c_master_reader = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('device') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_READ); + this.appendValueInput('bytes') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_BYTES); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_MASTER_READ); + } +}; + +export const i2c_master_reader2 = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_I2C_MASTER_READ2); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_MASTER_READ2); + } +}; + +export const i2c_slave_onreceive = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_ONRECEIVE); + this.appendValueInput("onReceive_length") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_I2C_BYTES); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_SLAVE_ONRECEIVE); + } +}; + +export const i2c_slave_write = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('value') + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_WRITE) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HTML_VALUE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_I2C_SLAVE_WRITE); + } +}; + +//SPI +export const spi_transfer = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput('pin') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.TO_SPI_SLAVE_PIN); + this.appendValueInput('value') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.SPI_TRANSFER); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + const pinValue = Blockly.Arduino.valueToCode(this, 'pin', Blockly.Arduino.ORDER_ATOMIC); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SPI_TRANSFER.replace('%1', pinValue)); + } +}; + +//RFID +export const RFID_init = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_INITIAL); + this.appendDummyInput("") + .appendField("SDA") + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SDA"); + this.appendDummyInput("") + .appendField("SCK") + .appendField(new Blockly.FieldDropdown(Profile.default.SCK), "SCK"); + this.appendDummyInput("") + .appendField("MOSI") + .appendField(new Blockly.FieldDropdown(Profile.default.MOSI), "MOSI"); + this.appendDummyInput("") + .appendField("MISO") + .appendField(new Blockly.FieldDropdown(Profile.default.MISO), "MISO"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_INIT); + // this.setFieldValue("10", "SDA"); + } +}; + +export const RFID_on = { + init: function () { + this.appendDummyInput("") + .appendField("RFID") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_ON_DETECTED); + this.appendStatementInput("do_"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_ON); + } +}; + +//读卡号 +export const RFID_readcardnum = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_READ_CARDNUM) + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_READ); + + } +}; + +//串口打印卡号 +/* export const RFID_serialprintcardnum = { + init: function() { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField('打印RFID卡号'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; */ + +export const RFID_in = { + init: function () { + this.appendValueInput("uid_") + .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF) + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_READ_CARDNUM_IS); + this.appendStatementInput("do_") + .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(''); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_IN); + } +}; + +//写数据块 +export const RFID_writecarddata = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("address1") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_WRITE) + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_DATA_BLOCK) + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_WRITE_NUM) + .appendField(new Blockly.FieldTextInput('mylist'), 'data1') + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_WRITEBLOCK); + } +}; + +//读数据块的内容 +export const RFID_readcarddata = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("address") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_READ) + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_DATA_BLOCK) + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_DATA_FROM) + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_READBLOCK); + } +}; + +/* //串口打印数据内容 +export const RFID_serialprintcarddata = { + init: function() { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("address") + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField("打印RFID数据块"); + this.appendDummyInput("") + .appendField("内容") + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +};*/ + +//关闭RFID +export const RFID_off = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_RFID_OFF); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RFID_OFF); + } +}; + +//初始化RFID +export const MFRC522_init = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + " RFID") + .appendField(new Blockly.FieldTextInput("rfid"), "rfid_name"); + this.appendValueInput("PIN_SDA") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(" SDA"); + this.appendValueInput("PIN_SCK") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("SCK"); + this.appendValueInput("PIN_MOSI") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MOSI"); + this.appendValueInput("PIN_MISO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MISO"); + this.appendValueInput("PIN_RST") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("RST"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//RFID侦测到信号 +export const MFRC522_IsNewCard = { + init: function () { + this.appendDummyInput() + .appendField("RFID") + .appendField(new Blockly.FieldTextInput("rfid"), "rfid_name") + .appendField(" " + Blockly.Msg.MIXLY_COMMUNICATION_RFID_ON_DETECTED); + this.appendStatementInput("DO") + .setCheck(null); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//RFID读取卡号 +export const MFRC522_ReadCardUID = { + init: function () { + this.appendDummyInput() + .appendField("RFID") + .appendField(new Blockly.FieldTextInput("rfid"), "rfid_name") + .appendField(" " + Blockly.Msg.MIXLY_RFID_READ_CARD_UID); + this.setInputsInline(false); + this.setOutput(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//RFID写卡 +export const MFRC522_WriteCard = { + init: function () { + this.appendDummyInput() + .appendField("RFID") + .appendField(new Blockly.FieldTextInput("rfid"), "rfid_name") + .appendField(" " + Blockly.Msg.MIXLY_RFID_WRITE_CARD); + this.appendValueInput("block") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_DATA_BLOCK); + this.appendValueInput("buffer") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RFID_BYTE_ARRAY); + this.appendValueInput("length") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_WRITE_ARRAY_ARRAYLENGTH); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//RFID读卡 +export const MFRC522_ReadCard = { + init: function () { + this.appendDummyInput() + .appendField("RFID") + .appendField(new Blockly.FieldTextInput("rfid"), "rfid_name") + .appendField(" " + Blockly.Msg.MIXLY_RFID_READ_CARD); + this.appendValueInput("block") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_COMMUNICATION_DATA_BLOCK); + this.appendValueInput("buffer") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.SAVETO + " " + Blockly.Msg.MIXLY_RFID_BYTE_ARRAY); + this.appendValueInput("length") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_I2C_SLAVE_WRITE_ARRAY_ARRAYLENGTH); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//SPI 初始化从机 +export const spi_begin_slave = { + init: function () { + this.appendDummyInput() + .appendField( + Blockly.Msg.MIXLY_SETUP + + "SPI" + Blockly.Msg.MIXLY_DEVICE + + Blockly.Msg.MIXLY_AS + + Blockly.Msg.MIXLY_SALVE + ); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_begin_master = { + init: function () { + this.appendDummyInput() + .appendField( + Blockly.Msg.MIXLY_SETUP + + "SPI" + Blockly.Msg.MIXLY_DEVICE + + Blockly.Msg.MIXLY_AS + + Blockly.Msg.MIXLY_MASTER + ); + this.appendValueInput("spi_slave_pin") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SALVE + Blockly.Msg.MIXLY_PIN); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_transfer_Init = { + init: function () { + this.appendValueInput("slave_pin") + .setCheck(null) + .appendField( + "SPI" + Blockly.Msg.MIXLY_SEND_DATA + + Blockly.Msg.MIXLY_SALVE + + Blockly.Msg.MIXLY_PIN + ); + this.appendStatementInput("transfer_data") + .setCheck(null); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_transfer_1 = { + init: function () { + this.appendValueInput("transfer_data") + .setCheck(null) + .appendField("SPI" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_transfer_2 = { + init: function () { + this.appendValueInput("transfer_data") + .setCheck(null) + .appendField("SPI" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RETURN_DATA); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_slave_interrupt = { + init: function () { + this.appendValueInput("slave_interrupt_input") + .setCheck(null) + .appendField( + "SPI " + Blockly.Msg.MIXLY_STM32_I2C_SLAVE_RECEIVE_EVENT + + " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA + ); + this.appendStatementInput("slave_interrupt_data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const spi_slave_receive = { + init: function () { + this.appendValueInput("slave_receive_data") + .setCheck(null) + .appendField( + "SPI " + Blockly.Msg.MIXLY_SALVE + + " " + Blockly.Msg.MIXLY_STM32_SPI_GET_REGISTER_DATA + ); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(COMMUNICATE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/control.js b/mixly/boards/default_src/arduino_avr/blocks/control.js new file mode 100644 index 00000000..d8102747 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/control.js @@ -0,0 +1,962 @@ +import * as Blockly from "blockly/core"; + +const LOOPS_HUE = 120; + +export const base_setup = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField(Blockly.Msg.MIXLY_SETUP); + this.appendStatementInput("DO").appendField(""); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_SETUP); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id2" + ); + } +}; + +export const controls_delay = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendValueInput("DELAY_TIME", Number) + .appendField(Blockly.Msg.MIXLY_DELAY) + .appendField(new Blockly.FieldDropdown(controls_delay.UNIT), "UNIT") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_DELAY); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id9" + ); + }, + UNIT: [ + [Blockly.Msg.MIXLY_MILLIS, "delay"], + [Blockly.Msg.MIXLY_MILLISECOND, "delayMicroseconds"], + ] +}; + +export const controls_for = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.LANG_CONTROLS_FOR_INPUT_WITH) + .appendField(new Blockly.FieldTextInput("i"), "VAR"); + this.appendValueInput("FROM") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.LANG_CONTROLS_FOR_INPUT_FROM); + this.appendValueInput("TO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.LANG_CONTROLS_FOR_INPUT_TO); + this.appendValueInput("STEP") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_STEP); + this.appendStatementInput("DO").appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#for" + ); + var thisBlock = this; + this.setTooltip(function () { + return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace( + "%1", + thisBlock.getFieldValue("VAR") + ); + }); + }, + getVars: function () { + return [this.getFieldValue("VAR")]; + }, + renameVar: function (oldName, newName) { + if (Blockly.Names.equals(oldName, this.getFieldValue("VAR"))) { + this.setTitleValue(newName, "VAR"); + } + } +}; + +export const controls_whileUntil = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendValueInput("BOOL") + .setCheck([Boolean, Number]) + .appendField(Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT) + .appendField(new Blockly.FieldDropdown(controls_whileUntil.OPERATORS), "MODE"); + this.appendStatementInput("DO") + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#while" + ); + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue("MODE"); + var TOOLTIPS = { + WHILE: Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE, + UNTIL: Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL, + }; + return TOOLTIPS[op]; + }); + }, + OPERATORS: [ + [Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, "WHILE"], + [Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, "UNTIL"] + ] +}; + +export const controls_flow_statements = { + init: function () { + this.setColour(LOOPS_HUE); + var dropdown = new Blockly.FieldDropdown(controls_flow_statements.OPERATORS); + this.appendDummyInput() + .appendField(dropdown, "FLOW") + .appendField(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP); + this.setPreviousStatement(true); + var thisBlock = this; + this.setHelpUrl( + "https://mixly.readthedocs.io/zh_CN/latest/arduino/03.Control.html#id2" + ); + this.setTooltip(function () { + var op = thisBlock.getFieldValue("FLOW"); + var TOOLTIPS = { + BREAK: Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK, + CONTINUE: Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE, + }; + return TOOLTIPS[op]; + }); + }, + onchange: function () { + if (!this.workspace) { + // Block has been deleted. + return; + } + var legal = false; + // Is the block nested in a control statement? + var block = this; + do { + if ( + block.type == "controls_repeat" || + block.type == "controls_forEach" || + block.type == "controls_for" || + block.type == "controls_whileUntil" + ) { + legal = true; + break; + } + block = block.getSurroundParent(); + } while (block); + if (legal) { + this.setWarningText(null); + } else { + this.setWarningText(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_WARNING); + } + }, + OPERATORS: [ + [Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK, "BREAK"], + [Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE, "CONTINUE"], + ] +}; + +export const controls_millis = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_RUNTIME) + .appendField(new Blockly.FieldDropdown(controls_millis.UNIT), "UNIT"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MILLIS); + }, + UNIT: [ + [Blockly.Msg.MIXLY_MILLIS, "millis"], + [Blockly.Msg.MIXLY_MILLISECOND, "micros"], + ] +}; + +export const controls_if = { + /** + * Block for if/elseif/else condition. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.CONTROLS_IF_HELPURL); + this.setColour(LOOPS_HUE); + this.appendValueInput("IF0") + .setCheck([Boolean, Number]) + .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF); + this.appendStatementInput("DO0").appendField( + Blockly.Msg.CONTROLS_IF_MSG_THEN + ); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#if" + ); + this.setMutator( + new Blockly.icons.MutatorIcon( + ["controls_if_elseif", "controls_if_else"], + this + ) + ); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + if (!thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_1; + } else if (!thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_2; + } else if (thisBlock.elseifCount_ && !thisBlock.elseCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_3; + } else if (thisBlock.elseifCount_ && thisBlock.elseCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_4; + } + return ""; + }); + this.elseifCount_ = 0; + this.elseCount_ = 0; + }, + /** + * Create XML to represent the number of else-if and else inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + if (!this.elseifCount_ && !this.elseCount_) { + return null; + } + var container = document.createElement("mutation"); + if (this.elseifCount_) { + container.setAttribute("elseif", this.elseifCount_); + } + if (this.elseCount_) { + container.setAttribute("else", 1); + } + return container; + }, + /** + * Parse XML to restore the else-if and else inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + var containerBlock = this; + var valueConnections = []; + var statementConnections = []; + // var elseStatementConnection = null; + if (this.elseCount_) { + // if (containerBlock.getInputTargetBlock('ELSE') && containerBlock.getInputTargetBlock('ELSE').previousConnection) + // elseStatementConnection = containerBlock.getInputTargetBlock('ELSE').previousConnection; + this.removeInput("ELSE"); + } + for (var i = this.elseifCount_; i > 0; i--) { + if ( + containerBlock.getInputTargetBlock("IF" + i) && + containerBlock.getInputTargetBlock("IF" + i).previousConnection + ) + valueConnections[i] = containerBlock.getInputTargetBlock( + "IF" + i + ).previousConnection; + else valueConnections[i] = null; + this.removeInput("IF" + i); + if ( + containerBlock.getInputTargetBlock("DO" + i) && + containerBlock.getInputTargetBlock("DO" + i).previousConnection + ) + statementConnections[i] = containerBlock.getInputTargetBlock( + "DO" + i + ).previousConnection; + else statementConnections[i] = null; + this.removeInput("DO" + i); + } + this.elseifCount_ = parseInt(xmlElement.getAttribute("elseif"), 10); + this.elseCount_ = parseInt(xmlElement.getAttribute("else"), 10); + //this.compose(containerBlock); + for (var i = 1; i <= this.elseifCount_; i++) { + this.appendValueInput("IF" + i) + .setCheck([Boolean, Number]) + .appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF); + this.appendStatementInput("DO" + i).appendField( + Blockly.Msg.CONTROLS_IF_MSG_THEN + ); + } + if (this.elseCount_) { + this.appendStatementInput("ELSE").appendField( + Blockly.Msg.CONTROLS_IF_MSG_ELSE + ); + } + for (var i = valueConnections.length - 2; i > 0; i--) { + if (valueConnections[i]) valueConnections[i].reconnect(this, "IF" + i); + } + for (var i = statementConnections.length - 2; i > 0; i--) { + if (statementConnections[i]) + statementConnections[i].reconnect(this, "DO" + i); + } + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = workspace.newBlock("controls_if_if"); + containerBlock.initSvg(); + var connection = containerBlock.getInput("STACK").connection; + for (var i = 1; i <= this.elseifCount_; i++) { + var elseifBlock = workspace.newBlock("controls_if_elseif"); + elseifBlock.initSvg(); + connection.connect(elseifBlock.previousConnection); + connection = elseifBlock.nextConnection; + } + if (this.elseCount_) { + var elseBlock = workspace.newBlock("controls_if_else"); + elseBlock.initSvg(); + connection.connect(elseBlock.previousConnection); + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + // Disconnect the else input blocks and remove the inputs. + if (this.elseCount_) { + this.removeInput("ELSE"); + } + this.elseCount_ = 0; + // Disconnect all the elseif input blocks and remove the inputs. + for (var i = this.elseifCount_; i > 0; i--) { + this.removeInput("IF" + i); + this.removeInput("DO" + i); + } + this.elseifCount_ = 0; + // Rebuild the block's optional inputs. + var clauseBlock = containerBlock.getInputTargetBlock("STACK"); + var valueConnections = [null]; + var statementConnections = [null]; + var elseStatementConnection = null; + while (clauseBlock) { + switch (clauseBlock.type) { + case "controls_if_elseif": + this.elseifCount_++; + valueConnections.push(clauseBlock.valueConnection_); + statementConnections.push(clauseBlock.statementConnection_); + break; + case "controls_if_else": + this.elseCount_++; + elseStatementConnection = clauseBlock.statementConnection_; + break; + default: + throw Error("Unknown block type: " + clauseBlock.type); + } + clauseBlock = + clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock(); + } + + this.updateShape_(); + // Reconnect any child blocks. + this.reconnectChildBlocks_( + valueConnections, + statementConnections, + elseStatementConnection + ); + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var clauseBlock = containerBlock.getInputTargetBlock("STACK"); + var i = 1; + while (clauseBlock) { + switch (clauseBlock.type) { + case "controls_if_elseif": + var inputIf = this.getInput("IF" + i); + var inputDo = this.getInput("DO" + i); + clauseBlock.valueConnection_ = + inputIf && inputIf.connection.targetConnection; + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + i++; + break; + case "controls_if_else": + var inputDo = this.getInput("ELSE"); + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + break; + default: + throw "Unknown block type."; + } + clauseBlock = + clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock(); + } + }, + /** + * Reconstructs the block with all child blocks attached. + */ + rebuildShape_: function () { + var valueConnections = [null]; + var statementConnections = [null]; + var elseStatementConnection = null; + + if (this.getInput("ELSE")) { + elseStatementConnection = + this.getInput("ELSE").connection.targetConnection; + } + var i = 1; + while (this.getInput("IF" + i)) { + var inputIf = this.getInput("IF" + i); + var inputDo = this.getInput("DO" + i); + console.log(inputIf.connection.targetConnection); + valueConnections.push(inputIf.connection.targetConnection); + statementConnections.push(inputDo.connection.targetConnection); + i++; + } + this.updateShape_(); + this.reconnectChildBlocks_( + valueConnections, + statementConnections, + elseStatementConnection + ); + }, + /** + * Modify this block to have the correct number of inputs. + * @this Blockly.Block + * @private + */ + updateShape_: function () { + // Delete everything. + if (this.getInput("ELSE")) { + this.removeInput("ELSE"); + } + var i = 1; + while (this.getInput("IF" + i)) { + this.removeInput("IF" + i); + this.removeInput("DO" + i); + i++; + } + // Rebuild block. + for (var i = 1; i <= this.elseifCount_; i++) { + this.appendValueInput("IF" + i) + .setCheck([Number, Boolean]) + .appendField(Blockly.Msg["CONTROLS_IF_MSG_ELSEIF"]); + this.appendStatementInput("DO" + i).appendField( + Blockly.Msg["CONTROLS_IF_MSG_THEN"] + ); + } + if (this.elseCount_) { + this.appendStatementInput("ELSE").appendField( + Blockly.Msg["CONTROLS_IF_MSG_ELSE"] + ); + } + }, + /** + * Reconnects child blocks. + * @param {!Array} valueConnections List of value + * connectsions for if input. + * @param {!Array} statementConnections List of + * statement connections for do input. + * @param {?Blockly.RenderedConnection} elseStatementConnection Statement + * connection for else input. + */ + reconnectChildBlocks_: function ( + valueConnections, + statementConnections, + elseStatementConnection + ) { + for (var i = 1; i <= this.elseifCount_; i++) { + valueConnections[i] && valueConnections[i].reconnect(this, "IF" + i); + statementConnections[i] && + statementConnections[i].reconnect(this, "DO" + i); + } + elseStatementConnection && elseStatementConnection.reconnect(this, "ELSE"); + } +}; + +export const controls_if_if = { + /** + * Mutator block for if container. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF); + this.appendStatementInput("STACK"); + this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP); + this.contextMenu = false; + } +}; + +export const controls_if_elseif = { + /** + * Mutator bolck for else-if condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField( + Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF + ); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP); + this.contextMenu = false; + } +}; + +export const controls_if_else = { + /** + * Mutator block for else condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField( + Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE + ); + this.setPreviousStatement(true); + this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP); + this.contextMenu = false; + } +}; + +export const controls_switch_case = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendValueInput("IF0") + .setCheck([Number, Boolean]) + .appendField("switch"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#switch" + ); + this.setMutator( + new Blockly.icons.MutatorIcon(["controls_case", "controls_default"], this) + ); + this.elseifCount_ = 0; + this.elseCount_ = 0; + }, + /** + * Create XML to represent the number of else-if and else inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + if (!this.elseifCount_ && !this.elseCount_) { + return null; + } + var container = document.createElement("mutation"); + if (this.elseifCount_) { + container.setAttribute("elseif", this.elseifCount_); + } + if (this.elseCount_) { + container.setAttribute("else", 1); + } + return container; + }, + /** + * Parse XML to restore the else-if and else inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.compose(this); + this.elseifCount_ = parseInt(xmlElement.getAttribute("elseif"), 10); + this.elseCount_ = parseInt(xmlElement.getAttribute("else"), 10); + for (var i = 1; i <= this.elseifCount_; i++) { + this.appendValueInput("IF" + i) + .setCheck([Number, Boolean]) + .appendField("case"); + this.appendStatementInput("DO" + i).appendField(""); + } + if (this.elseCount_) { + this.appendStatementInput("ELSE").appendField("default"); + } + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = workspace.newBlock("controls_switch"); + containerBlock.initSvg(); + var connection = containerBlock.getInput("STACK").connection; + for (var i = 1; i <= this.elseifCount_; i++) { + var elseifBlock = workspace.newBlock("controls_case"); + elseifBlock.initSvg(); + connection.connect(elseifBlock.previousConnection); + connection = elseifBlock.nextConnection; + } + if (this.elseCount_) { + var elseBlock = workspace.newBlock("controls_default"); + elseBlock.initSvg(); + connection.connect(elseBlock.previousConnection); + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + // console.log(arguments.callee.caller.name); + // Disconnect the else input blocks and remove the inputs. + if (this.elseCount_) { + this.removeInput("ELSE"); + } + this.elseCount_ = 0; + // Disconnect all the elseif input blocks and remove the inputs. + for (var i = this.elseifCount_; i > 0; i--) { + this.removeInput("IF" + i); + this.removeInput("DO" + i); + } + this.elseifCount_ = 0; + // Rebuild the block's optional inputs. + var clauseBlock = containerBlock.getInputTargetBlock("STACK"); + while (clauseBlock) { + switch (clauseBlock.type) { + case "controls_case": + this.elseifCount_++; + var ifInput = this.appendValueInput("IF" + this.elseifCount_) + .setCheck([Number, Boolean]) + .appendField("case"); + var doInput = this.appendStatementInput("DO" + this.elseifCount_); + doInput.appendField(""); + // Reconnect any child blocks. + if (clauseBlock.valueConnection_) { + ifInput.connection.connect(clauseBlock.valueConnection_); + } + if (clauseBlock.statementConnection_) { + doInput.connection.connect(clauseBlock.statementConnection_); + } + break; + case "controls_default": + this.elseCount_++; + var elseInput = this.appendStatementInput("ELSE"); + elseInput.appendField("default"); + // Reconnect any child blocks. + if (clauseBlock.statementConnection_) { + elseInput.connection.connect(clauseBlock.statementConnection_); + } + break; + default: + throw "Unknown block type."; + } + clauseBlock = + clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock(); + } + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var clauseBlock = containerBlock.getInputTargetBlock("STACK"); + var i = 1; + while (clauseBlock) { + switch (clauseBlock.type) { + case "controls_case": + var inputIf = this.getInput("IF" + i); + var inputDo = this.getInput("DO" + i); + clauseBlock.valueConnection_ = + inputIf && inputIf.connection.targetConnection; + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + i++; + break; + case "controls_default": + var inputDo = this.getInput("ELSE"); + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + break; + default: + throw "Unknown block type."; + } + clauseBlock = + clauseBlock.nextConnection && clauseBlock.nextConnection.targetBlock(); + } + } +}; + +export const controls_switch = { + /** + * Mutator block for if container. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField("switch"); + this.appendStatementInput("STACK"); + this.contextMenu = false; + } +}; + +export const controls_case = { + /** + * Mutator bolck for else-if condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField("case"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.contextMenu = false; + } +}; + +export const controls_default = { + /** + * Mutator block for else condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField("default"); + this.setPreviousStatement(true); + this.contextMenu = false; + } +}; + +export const controls_mstimer2 = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendValueInput("TIME") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MsTimer2" + Blockly.Msg.MIXLY_MSTIMER2_EVERY); + this.appendDummyInput().appendField("ms"); + this.appendStatementInput("DO") + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#mstimer2" + ); + } +}; + +export const controls_mstimer2_start = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput().appendField( + "MsTimer2" + Blockly.Msg.MIXLY_MSTIMER2_START + ); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id36" + ); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2_START); + } +}; + +export const controls_mstimer2_stop = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField("MsTimer2") + .appendField(Blockly.Msg.MIXLY_STOP); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2_STOP); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id38" + ); + } +}; + +export const controls_end_program = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_CONTROL_END_PROGRAM); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_END_PROGRAM); + } +}; +export const controls_soft_reset = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.SOFT_RESET); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_END_PROGRAM); + } +}; + +export const controls_interrupts = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_CONTROL_INTERRUPTS); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_ALLOW_INTERRUPT); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id43" + ); + } +}; + +export const controls_nointerrupts = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_CONTROL_NOINTERRUPTS); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_CONTROL_NOINTERRUPTS); + this.setHelpUrl( + "https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id46" + ); + } +}; +export const base_delay = controls_delay; + +//简单定时器 +export const simple_timer = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SIMPLE_TIMER) + .appendField(new Blockly.FieldDropdown(simple_timer.NUMBER), "NO") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL); + this.appendValueInput("timein") + .setCheck(null); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_mSecond); + this.appendStatementInput("zxhs") + .setCheck(null) + .appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO); + this.setColour(120); + this.setTooltip(); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#id40"); + }, + NUMBER: [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"], + ["9", "9"], + ["10", "10"], + ["11", "11"], + ["12", "12"], + ["13", "13"], + ["14", "14"], + ["15", "15"], + ["16", "16"], + ] +}; + +//do-while循环 +export const do_while = { + init: function () { + this.appendStatementInput("input_data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_DO); + this.appendValueInput("select_data") + .setCheck(null) + .appendField(Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_TITLE_REPEAT) + .appendField( + new Blockly.FieldDropdown([ + [Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_WHILE, "true"], + [Blockly.Msg.LANG_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL, "false"], + ]), + "type" + ); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(120); + this.setTooltip("do-while loop"); + this.setHelpUrl(""); + }, +}; + +//注册超级延时函数 +export const super_delay_function1 = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.super_delay_function) + .appendField(new Blockly.FieldDropdown(super_delay_function1.NUMBER), "number"); + this.appendStatementInput("delay_function") + .setCheck(null); + this.setColour(120); + this.setTooltip(Blockly.Msg.super_delay_function_help); + this.setHelpUrl(""); + }, + NUMBER: [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"], + ["9", "9"], + ["10", "10"], + ["11", "11"], + ["12", "12"], + ["13", "13"], + ["14", "14"], + ["15", "15"], + ["16", "16"], + ] +}; + +//执行超级延时函数 +export const execute_super_delay_function1 = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.execute_super_delay_function) + .appendField(new Blockly.FieldDropdown(execute_super_delay_function1.NUMBER), "number"); + this.appendValueInput("time_interval") + .setCheck(null) + .appendField(Blockly.Msg.time_interval); + this.appendValueInput("frequency") + .setCheck(null) + .appendField(Blockly.Msg.number_of_executions); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(120); + this.setTooltip(Blockly.Msg.execute_super_delay_function_help); + this.setHelpUrl(""); + }, + NUMBER: [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"], + ["9", "9"], + ["10", "10"], + ["11", "11"], + ["12", "12"], + ["13", "13"], + ["14", "14"], + ["15", "15"], + ["16", "16"], + ] +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/display.js b/mixly/boards/default_src/arduino_avr/blocks/display.js new file mode 100644 index 00000000..bbc0644e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/display.js @@ -0,0 +1,2814 @@ +import * as Blockly from 'blockly/core'; +import * as layui from 'layui'; +import $ from 'jquery'; +import { + Profile, + LayerExt, + XML, + MFile +} from 'mixly'; + +const { layer } = layui; + +const DISPLAY_HUE = 180; + +const DRAWFIll = [ + [Blockly.Msg.OLED_HOLLOW, "draw"], + [Blockly.Msg.OLED_SOLID, "fill"] +]; + +export const group_lcd_init2 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput('device') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldDropdown([['1602', '16,2'], ['2004', '20,4']]), 'TYPE') + .appendField(new Blockly.FieldTextInput('mylcd'), 'VAR') + .appendField(Blockly.Msg.MIXLY_LCD_ADDRESS); + this.appendDummyInput("") + .appendField('SCL') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SCL") + .appendField('SDA') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SDA"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LCD_INIT2); + this.setFieldValue(Profile.default.SCL[0][1], "SCL"); + this.setFieldValue(Profile.default.SDA[0][1], "SDA"); + } +}; + +export const group_lcd_init3 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldDropdown([['1602', '16,2'], ['2004', '20,4']]), 'TYPE') + .appendField(new Blockly.FieldTextInput('mylcd'), 'VAR') + .setAlign(Blockly.inputs.Align.LEFT); + this.appendDummyInput() + .appendField('RS') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "RS") + .appendField('EN') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "EN") + .appendField('D4') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "D4") + .appendField('D5') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "D5") + .appendField('D6') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "D6") + .appendField('D7') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "D7"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LCD_INIT3); + } +}; + +export const group_lcd_print = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput("TEXT", String) + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldTextInput('mylcd'), 'VAR') + .appendField(Blockly.Msg.MIXLY_LCD_PRINT1); + this.appendValueInput("TEXT2", String) + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_PRINT2); + /* + this.appendValueInput("TEXT3", String) + .setCheck([String,Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_PRINT3); + this.appendValueInput("TEXT4", String) + .setCheck([String,Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_PRINT4); + */ + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LCD_PRINT); + } +}; + +export const group_lcd_print2 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput("row", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldTextInput('mylcd'), 'VAR') + .appendField(Blockly.Msg.MIXLY_LCD_ROW); + this.appendValueInput("column", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_COLUMN); + this.appendValueInput("TEXT", String) + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_LCD_PRINT); + this.setPreviousStatement(true, null); + this.setInputsInline(true); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LCD_PRINT2.replace('%1', Blockly.Arduino.valueToCode(this, 'row', Blockly.Arduino.ORDER_ATOMIC)).replace('%2', Blockly.Arduino.valueToCode(this, 'column', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const group_lcd_power = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldTextInput('mylcd'), 'VAR') + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "display"], + [Blockly.Msg.MIXLY_OFF, "noDisplay"], + [Blockly.Msg.MIXLY_LCD_STAT_CURSOR, "cursor"], + [Blockly.Msg.MIXLY_LCD_STAT_NOCURSOR, "noCursor"], + [Blockly.Msg.MIXLY_LCD_STAT_BLINK, "blink"], + [Blockly.Msg.MIXLY_LCD_STAT_NOBLINK, "noBlink"], + [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"], + [Blockly.Msg.MIXLY_LCD_NOBACKLIGHT, "noBacklight"], + [Blockly.Msg.MIXLY_LCD_BACKLIGHT, "backlight"] + ]), "STAT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LCD_POWER); + } +}; +//RGB has been moved to actuator + +export const display_4digitdisplay_power = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "_TM1650") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "displayOn"], + [Blockly.Msg.MIXLY_OFF, "displayOff"], + [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"] + ]), "STAT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_4digitdisplay_power); + } +}; + +export const display_4digitdisplay_displayString = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "_TM1650") + this.appendValueInput("VALUE") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.OLED_DRAWSTR); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_4digitdisplay_displayString); + } +}; + +export const display_4digitdisplay_showDot = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "_TM1650") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY_NOMBER1) + .appendField(new Blockly.FieldDropdown([["1", "0"], ["2", "1"], ["3", "2"], ["4", "3"]]), "NO") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY_NOMBER2) + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY_DOT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, "true"], + [Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, "false"] + ]), "STAT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_4digitdisplay_showDot); + } +}; + +export const display_TM1637_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField('CLK') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "CLK") + .appendField('DIO') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DIO"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_TIP); + this.setHelpUrl(''); + // this.setFieldValue("2", "CLK"); + // this.setFieldValue("4", "DIO"); + } +}; + +export const display_TM1637_displyPrint = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput("VALUE") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.OLEDDISPLAY); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_DISPLAYSTRING_TIP); + } +}; + +export const display_TM1637_displayTime = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_SHOW_FACE_TIME); + this.appendValueInput("hour") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_HOUR); + this.appendValueInput("minute") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MINUTE); + // .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "displayOn"], [Blockly.Msg.MIXLY_OFF, "displayOff"], [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"]]), "STAT"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_TM1637_Time_Point) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "true"], + [Blockly.Msg.MIXLY_OFF, "false"] + ]), "STAT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_DISPLAYTIME_TOOLTIP); + } +}; + +export const display_TM1637_Brightness = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SET_BRIGHTNESS); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_4DIGITDISPLAY_BRIGHTNESS_TOOLTIP); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_4DIGITDISPLAY_TM1637_BRIGHTNESS); + } +}; + +export const display_TM1637_clearDisplay = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"], + [Blockly.Msg.MIXLY_LCD_STAT_BLINK, "blink"], + [Blockly.Msg.MIXLY_ON, "on"], + [Blockly.Msg.MIXLY_OFF, "off"] + ]), "STAT"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_CLEARDISPLAY); + } +}; + +//HT16K33点阵屏幕初始化 +export const HT16K33_Init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_INIT); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_INIT) + .appendField('SCL') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SCL") + .appendField('SDA') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SDA"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_INIT); + this.setFieldValue(Profile.default.SCL[0][1], "SCL"); + this.setFieldValue(Profile.default.SDA[0][1], "SDA"); + } +}; + +//MAX7219点阵屏幕初始化 +export const MAX7219_init = { + init: function () { + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MAX7219_INIT); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput("PIN1") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("DIN(MOSI)") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN2") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CS") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN3") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CLK(SCK)") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("hDisplays") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MAX7219_HDISPALY); + this.appendValueInput("vDisplays") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MAX7219_VDISPALY); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(DISPLAY_HUE); + this.setInputsInline(false); + this.setTooltip(Blockly.Msg.MAX7219_INIT_TOOLTIP); + this.setHelpUrl(''); + } +}; + +const MATRIX_TYPES = [['MAX7219', 'MAX7219'], ['HT16K33', 'HT16K33']]; + +//点阵屏显示点 +export const display_Matrix_DrawPixel = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput('XVALUE') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_X); + this.appendValueInput("YVALUE") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_Y); + this.appendValueInput("STAT") + .appendField(Blockly.Msg.MIXLY_STAT) + .setCheck([Number, Boolean]); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_WRITE_NOW, "ON"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_DONT_WRITE, "OFF"] + ]), "WRITE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(); + } +}; + + +//点阵屏 旋转变量 +const display_Rotation_NUM = [ + [Blockly.Msg.MIXLY_0DEGREE, "0"], + [Blockly.Msg.MIXLY_90DEGREE, "3"], + [Blockly.Msg.MIXLY_180DEGREE, "2"], + [Blockly.Msg.MIXLY_270DEGREE, "1"] +]; + +//点阵屏旋转 +export const display_Max7219_Rotation = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField('MAX7219'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput("NO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MAX7219_NO); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE) + .appendField(new Blockly.FieldDropdown(display_Rotation_NUM), "Rotation_TYPE"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_ROTATION); + } +}; + +//点阵屏旋转 +export const display_Max7219_setPosition = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField('MAX7219'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput("NO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MAX7219_NO); + this.appendValueInput("X") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("X"); + this.appendValueInput("Y") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("Y"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_ROTATION); + } +}; + +//点阵屏旋转 +export const display_HT16K33_Rotation = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField('HT16K33'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE) + .appendField(new Blockly.FieldDropdown(display_Rotation_NUM), "Rotation_TYPE"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_ROTATION); + } +}; + +//点阵屏滚动显示字符 +export const display_Matrix_TEXT = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE'); + this.appendValueInput("TEXT", String) + .setCheck([Number, String]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.texttodisplay); + this.appendValueInput("Speed") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SPEED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_TEXT); + } +}; + +//点阵屏滚动显示文本 +export const display_Matrix_print = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE'); + this.appendValueInput("TEXT", String) + .setCheck([Number, String]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.texttodisplay); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_WRITE_NOW, "ON"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_DONT_WRITE, "OFF"] + ]), "WRITE"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_TEXT); + } +}; + +//点阵屏显示_显示图案 +export const display_Matrix_DisplayChar = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE') + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_WRITE_NOW, "ON"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_DONT_WRITE, "OFF"] + ]), "WRITE"); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput("NO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MAX7219_NO); + this.appendValueInput("LEDArray") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_PICARRAY); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(false); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_DISPLAYCHAR); + } +}; + +//点阵屏显示_图案数组 +export const display_Matrix_LedArray = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR) + .appendField(new Blockly.FieldTextInput("LedArray1"), "VAR"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a81") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a82") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a83") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a84") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a85") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a86") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a87") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a88"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a71") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a72") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a73") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a74") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a75") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a76") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a77") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a78"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a61") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a62") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a63") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a64") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a65") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a66") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a67") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a68"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a51") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a52") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a53") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a54") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a55") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a56") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a57") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a58"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a41") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a42") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a43") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a44") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a45") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a46") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a47") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a48"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a31") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a32") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a33") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a34") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a35") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a36") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a37") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a38"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a21") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a22") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a23") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a24") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a25") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a26") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a27") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a28"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a11") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a12") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a13") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a14") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a15") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a16") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a17") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a18"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_LEDARRAY); + } +}; + +export const display_matrix_bitmap = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR) + .appendField(new Blockly.FieldTextInput("LedArray1"), "VAR"); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldBitmap([ + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0] + ], null, { + filledColor: '#000', + emptyColor: '#5ba5a5', + bgColor: '#e5e7f1' + }), 'BITMAP'); + this.setOutput(true, Number); + this.setTooltip(""); + } +}; + +//点阵屏亮度 +export const display_Matrix_Brightness = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setTooltip(Blockly.Msg.MIXLY_MAX7219_BRIGHTNESS_TOOLTIP); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +var MAX7219_FILLSCREEN_SELECT = [ + [Blockly.Msg.MAX7219_FILLSCREEN_ON, "fillScreen(1)"], + [Blockly.Msg.MAX7219_FILLSCREEN_OFF, "fillScreen(0)"], + //[Blockly.Msg.MAX7219_SHUTDOWN_ON, "shutdown(1)"], + // [Blockly.Msg.MAX7219_SHUTDOWN_OFF, "shutdown(0)"] +]; + +//点阵屏 全屏亮灭 +export const display_Matrix_fillScreen = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE'); + // this.appendDummyInput("") + // .appendField(Blockly.Msg.MIXLY_MATRIX_NAME) + // .appendField(new Blockly.FieldTextInput('myMatrix'), 'matrixName'); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_STAT); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(MAX7219_FILLSCREEN_SELECT), "FILLSCREEN_TYPE"); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_WRITE_NOW, "ON"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_DONT_WRITE, "OFF"] + ]), "WRITE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_POS); + } +}; + +//点阵屏预设图案 +export const Matrix_img = { + init: function () { + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MAX7219_IMG) + .appendField(new Blockly.FieldDropdown([ + ["↑", "18181818db7e3c18"], + ["↓", "183c7edb18181818"], + ["←", "080c06ffff060c08"], + ["→", "103060ffff603010"], + ["♥", "183c7effffffe742"], + ["▲", "00000000ff7e3c18"], + ["▼", "183c7eff00000000"], + ["◄", "080c0e0f0f0e0c08"], + ["►", "103070f0f0703010"], + ["△", "00000000ff422418"], + ["▽", "182442ff00000000"], + ["☺", "3c4299a581a5423c"], + ["○", "3c4281818181423c"], + ["◑", "3c72f1f1f1f1723c"], + ["◐", "3c4e8f8f8f8f4e3c"], + ["¥", "101010ff10ff2442"], + ["Χ", "8142241818244281"], + ["√", "0000010204885020"], + ["□", "007e424242427e00"], + ["▣", "007e425a5a427e00"], + ["◇", "1824428181422418"], + ["♀", "083e081c2222221c"], + ["♂", "0e1b111b9ea0c0f0"], + ["♪", "061f1e1010d07030"], + ["✈", "203098ffff983020"], + ["卍", "00f21212fe90909e"], + ["卐", "009e9090fe1212f2"], + ["|", "1010101010101010"], + ["—", "000000ff00000000"], + ["╱", "0102040810204080"], + ["\", "8040201008040201"], + ["大", "41221408087f0808"], + ["中", "1010fe9292fe1010"], + ["小", "0e08492a2a080808"], + ["米", "00925438fe385492"], + ["正", "7f0a0a3a08087f00"], + ["囧", "ffa5a5bdc3a5a5ff"] + ]), "img_"); + this.setOutput(true); + this.setTooltip(''); + this.setColour(DISPLAY_HUE); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_MAX7219_PREDEFARR); + this.setHelpUrl(''); + } +}; + +//点阵屏 设置生效 +export const display_Matrix_write = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MATRIX_TYPE) + .appendField(new Blockly.FieldDropdown(MATRIX_TYPES), 'TYPE') + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_WRITE); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +//OLED -based on U8G2 +//显示-OLED-变量 +const LINESELECT = [ + [Blockly.Msg.OLED_HOR, "H"], + [Blockly.Msg.OLED_VER, "V"] +]; + +const FRAMESELECT = [ + [Blockly.Msg.OLED_HOLLOW, "drawFrame"], + [Blockly.Msg.OLED_SOLID, "drawBox"] +]; + +const CIRCLESELECT = [ + [Blockly.Msg.OLED_HOLLOW, "drawCircle"], + [Blockly.Msg.OLED_SOLID, "drawDisc"] +]; + +const RADSELECT = [ + [Blockly.Msg.OLED_HOLLOW, "drawRFrame"], + [Blockly.Msg.OLED_SOLID, "drawRBox"] +]; + +//圆选择 +const CIRCLEOPTELECT = [ + [Blockly.Msg.OLED_WHOLE_CICILE, "U8G2_DRAW_ALL"], + [Blockly.Msg.OLED_UP_R, "U8G2_DRAW_UPPER_RIGHT"], + [Blockly.Msg.OLED_UP_L, "U8G2_DRAW_UPPER_LEFT"], + [Blockly.Msg.OLED_LOW_R, "U8G2_DRAW_LOWER_RIGHT"], + [Blockly.Msg.OLED_LOW_L, "U8G2_DRAW_LOWER_LEFT"] +]; + +//空心、实心椭圆 +const ELLIPSESELECT = [ + [Blockly.Msg.OLED_HOLLOW, "drawEllipse"], + [Blockly.Msg.OLED_SOLID, "drawFilledEllipse"] +]; + +const EN_FONT_NAME = [ + ["Times New Roman", "tim"], + ["Helvetica", "helv"], + ["ncen", "ncen"], + ["courier new", "cour"] +]; + +const OLED_TYPE = [ + ["SSD1306(128×64)", "SSD1306_128X64_NONAME"], + ["SSD1306(128×32)", "SSD1306_128X32_UNIVISION"], + ["SH1106(128×64)", "SH1106_128X64_NONAME"] +]; + +const U8G2_TYPE_SSD1306_NOKIA5110 = [ + ["SSD1306(128×64)", "SSD1306_128X64_NONAME"], + ["LCM12864", "ST7565_NHD_C12864"], + ["NOKIA5110", "PCD8544_84X48"] +]; + +const ROTATION_TYPE = [ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE + " 0°", "U8G2_R0"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE + " 90°", "U8G2_R1"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE + " 180°", "U8G2_R2"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE + " 270°", "U8G2_R3"], + [Blockly.Msg.MIRROR, "U8G2_MIRROR"] +]; + +const EN_FONT_SIZE = [ + ["08", "08"], + ["10", "10"], + ["12", "12"], + ["14", "14"], + ["18", "18"], + ["24", "24"], +]; + +const EN_FONT_STYLE = [ + ["常规", "R"], + ["加粗", "B"] +]; + +const CN_FONT_NAME = [ + [Blockly.Msg.OLED_FONT_chinese1, "_t_chinese1"], + [Blockly.Msg.OLED_FONT_chinese2, "_t_chinese2"], + [Blockly.Msg.OLED_FONT_chinese3, "_t_chinese3"], + [Blockly.Msg.OLED_FONT_gb2312a, "_t_gb2312a"], + [Blockly.Msg.OLED_FONT_gb2312b, "_t_gb2312b"], + [Blockly.Msg.OLED_FONT_gb2312, "_t_gb2312"], +]; + +const CN_FONT_SIZE = [ + ["12", "wqy12"], + ["13", "wqy13"], + ["14", "wqy14"], + ["15", "wqy15"], + ["16", "wqy16"], +]; + +const ICON_IMAGE = [ + [{ 'src': require('../media/oled_icons/64.png'), 'width': 24, 'height': 24, 'alt': '64' }, '64'], + [{ 'src': require('../media/oled_icons/65.png'), 'width': 24, 'height': 24, 'alt': '65' }, '65'], + [{ 'src': require('../media/oled_icons/66.png'), 'width': 24, 'height': 24, 'alt': '66' }, '66'], + [{ 'src': require('../media/oled_icons/67.png'), 'width': 24, 'height': 24, 'alt': '67' }, '67'], + [{ 'src': require('../media/oled_icons/68.png'), 'width': 24, 'height': 24, 'alt': '68' }, '68'], + [{ 'src': require('../media/oled_icons/69.png'), 'width': 24, 'height': 24, 'alt': '69' }, '69'], + [{ 'src': require('../media/oled_icons/70.png'), 'width': 24, 'height': 24, 'alt': '70' }, '70'], + [{ 'src': require('../media/oled_icons/71.png'), 'width': 24, 'height': 24, 'alt': '71' }, '71'], + [{ 'src': require('../media/oled_icons/72.png'), 'width': 24, 'height': 24, 'alt': '72' }, '72'], + [{ 'src': require('../media/oled_icons/73.png'), 'width': 24, 'height': 24, 'alt': '73' }, '73'], + [{ 'src': require('../media/oled_icons/74.png'), 'width': 24, 'height': 24, 'alt': '74' }, '74'], + [{ 'src': require('../media/oled_icons/75.png'), 'width': 24, 'height': 24, 'alt': '75' }, '75'], + [{ 'src': require('../media/oled_icons/76.png'), 'width': 24, 'height': 24, 'alt': '76' }, '76'], + [{ 'src': require('../media/oled_icons/77.png'), 'width': 24, 'height': 24, 'alt': '77' }, '77'], + [{ 'src': require('../media/oled_icons/78.png'), 'width': 24, 'height': 24, 'alt': '78' }, '78'], + [{ 'src': require('../media/oled_icons/79.png'), 'width': 24, 'height': 24, 'alt': '79' }, '79'], + [{ 'src': require('../media/oled_icons/80.png'), 'width': 24, 'height': 24, 'alt': '80' }, '80'], + [{ 'src': require('../media/oled_icons/81.png'), 'width': 24, 'height': 24, 'alt': '81' }, '81'], + [{ 'src': require('../media/oled_icons/82.png'), 'width': 24, 'height': 24, 'alt': '82' }, '82'], + [{ 'src': require('../media/oled_icons/83.png'), 'width': 24, 'height': 24, 'alt': '83' }, '83'], + [{ 'src': require('../media/oled_icons/84.png'), 'width': 24, 'height': 24, 'alt': '84' }, '84'], + [{ 'src': require('../media/oled_icons/85.png'), 'width': 24, 'height': 24, 'alt': '85' }, '85'], + [{ 'src': require('../media/oled_icons/86.png'), 'width': 24, 'height': 24, 'alt': '86' }, '86'], + [{ 'src': require('../media/oled_icons/87.png'), 'width': 24, 'height': 24, 'alt': '87' }, '87'], + [{ 'src': require('../media/oled_icons/88.png'), 'width': 24, 'height': 24, 'alt': '88' }, '88'], + [{ 'src': require('../media/oled_icons/89.png'), 'width': 24, 'height': 24, 'alt': '89' }, '89'], + [{ 'src': require('../media/oled_icons/90.png'), 'width': 24, 'height': 24, 'alt': '90' }, '90'], + [{ 'src': require('../media/oled_icons/91.png'), 'width': 24, 'height': 24, 'alt': '91' }, '91'], + [{ 'src': require('../media/oled_icons/92.png'), 'width': 24, 'height': 24, 'alt': '92' }, '92'], + [{ 'src': require('../media/oled_icons/93.png'), 'width': 24, 'height': 24, 'alt': '93' }, '93'], + [{ 'src': require('../media/oled_icons/94.png'), 'width': 24, 'height': 24, 'alt': '94' }, '94'], + [{ 'src': require('../media/oled_icons/95.png'), 'width': 24, 'height': 24, 'alt': '95' }, '95'], + [{ 'src': require('../media/oled_icons/96.png'), 'width': 24, 'height': 24, 'alt': '96' }, '96'], + [{ 'src': require('../media/oled_icons/97.png'), 'width': 24, 'height': 24, 'alt': '97' }, '97'], + [{ 'src': require('../media/oled_icons/98.png'), 'width': 24, 'height': 24, 'alt': '98' }, '98'], + [{ 'src': require('../media/oled_icons/99.png'), 'width': 24, 'height': 24, 'alt': '99' }, '99'], + [{ 'src': require('../media/oled_icons/100.png'), 'width': 24, 'height': 24, 'alt': '100' }, '100'], + [{ 'src': require('../media/oled_icons/101.png'), 'width': 24, 'height': 24, 'alt': '101' }, '101'], + [{ 'src': require('../media/oled_icons/102.png'), 'width': 24, 'height': 24, 'alt': '102' }, '102'], + [{ 'src': require('../media/oled_icons/103.png'), 'width': 24, 'height': 24, 'alt': '103' }, '103'], + [{ 'src': require('../media/oled_icons/104.png'), 'width': 24, 'height': 24, 'alt': '104' }, '104'], + [{ 'src': require('../media/oled_icons/105.png'), 'width': 24, 'height': 24, 'alt': '105' }, '105'], + [{ 'src': require('../media/oled_icons/106.png'), 'width': 24, 'height': 24, 'alt': '106' }, '106'], + [{ 'src': require('../media/oled_icons/107.png'), 'width': 24, 'height': 24, 'alt': '107' }, '107'], + [{ 'src': require('../media/oled_icons/108.png'), 'width': 24, 'height': 24, 'alt': '108' }, '108'], + [{ 'src': require('../media/oled_icons/109.png'), 'width': 24, 'height': 24, 'alt': '109' }, '109'], + [{ 'src': require('../media/oled_icons/110.png'), 'width': 24, 'height': 24, 'alt': '110' }, '110'], + [{ 'src': require('../media/oled_icons/111.png'), 'width': 24, 'height': 24, 'alt': '111' }, '111'], + [{ 'src': require('../media/oled_icons/112.png'), 'width': 24, 'height': 24, 'alt': '112' }, '112'], + [{ 'src': require('../media/oled_icons/113.png'), 'width': 24, 'height': 24, 'alt': '113' }, '113'], + [{ 'src': require('../media/oled_icons/114.png'), 'width': 24, 'height': 24, 'alt': '114' }, '114'], + [{ 'src': require('../media/oled_icons/115.png'), 'width': 24, 'height': 24, 'alt': '115' }, '115'], + [{ 'src': require('../media/oled_icons/116.png'), 'width': 24, 'height': 24, 'alt': '116' }, '116'], + [{ 'src': require('../media/oled_icons/117.png'), 'width': 24, 'height': 24, 'alt': '117' }, '117'], + [{ 'src': require('../media/oled_icons/118.png'), 'width': 24, 'height': 24, 'alt': '118' }, '118'], + [{ 'src': require('../media/oled_icons/119.png'), 'width': 24, 'height': 24, 'alt': '119' }, '119'], + [{ 'src': require('../media/oled_icons/120.png'), 'width': 24, 'height': 24, 'alt': '120' }, '120'], + [{ 'src': require('../media/oled_icons/121.png'), 'width': 24, 'height': 24, 'alt': '121' }, '121'], + [{ 'src': require('../media/oled_icons/122.png'), 'width': 24, 'height': 24, 'alt': '122' }, '122'], + [{ 'src': require('../media/oled_icons/123.png'), 'width': 24, 'height': 24, 'alt': '123' }, '123'], + [{ 'src': require('../media/oled_icons/124.png'), 'width': 24, 'height': 24, 'alt': '124' }, '124'], + [{ 'src': require('../media/oled_icons/125.png'), 'width': 24, 'height': 24, 'alt': '125' }, '125'], + [{ 'src': require('../media/oled_icons/126.png'), 'width': 24, 'height': 24, 'alt': '126' }, '126'], + [{ 'src': require('../media/oled_icons/127.png'), 'width': 24, 'height': 24, 'alt': '127' }, '127'], + [{ 'src': require('../media/oled_icons/128.png'), 'width': 24, 'height': 24, 'alt': '128' }, '128'], + [{ 'src': require('../media/oled_icons/129.png'), 'width': 24, 'height': 24, 'alt': '129' }, '129'], + [{ 'src': require('../media/oled_icons/130.png'), 'width': 24, 'height': 24, 'alt': '130' }, '130'], + [{ 'src': require('../media/oled_icons/131.png'), 'width': 24, 'height': 24, 'alt': '131' }, '131'], + [{ 'src': require('../media/oled_icons/132.png'), 'width': 24, 'height': 24, 'alt': '132' }, '132'], + [{ 'src': require('../media/oled_icons/133.png'), 'width': 24, 'height': 24, 'alt': '133' }, '133'], + [{ 'src': require('../media/oled_icons/134.png'), 'width': 24, 'height': 24, 'alt': '134' }, '134'], + [{ 'src': require('../media/oled_icons/135.png'), 'width': 24, 'height': 24, 'alt': '135' }, '135'], + [{ 'src': require('../media/oled_icons/136.png'), 'width': 24, 'height': 24, 'alt': '136' }, '136'], + [{ 'src': require('../media/oled_icons/137.png'), 'width': 24, 'height': 24, 'alt': '137' }, '137'], + [{ 'src': require('../media/oled_icons/138.png'), 'width': 24, 'height': 24, 'alt': '138' }, '138'], + [{ 'src': require('../media/oled_icons/139.png'), 'width': 24, 'height': 24, 'alt': '139' }, '139'], + [{ 'src': require('../media/oled_icons/140.png'), 'width': 24, 'height': 24, 'alt': '140' }, '140'], + [{ 'src': require('../media/oled_icons/141.png'), 'width': 24, 'height': 24, 'alt': '141' }, '141'], + [{ 'src': require('../media/oled_icons/142.png'), 'width': 24, 'height': 24, 'alt': '142' }, '142'], + [{ 'src': require('../media/oled_icons/143.png'), 'width': 24, 'height': 24, 'alt': '143' }, '143'], + [{ 'src': require('../media/oled_icons/144.png'), 'width': 24, 'height': 24, 'alt': '144' }, '144'], + [{ 'src': require('../media/oled_icons/145.png'), 'width': 24, 'height': 24, 'alt': '145' }, '145'], + [{ 'src': require('../media/oled_icons/146.png'), 'width': 24, 'height': 24, 'alt': '146' }, '146'], + [{ 'src': require('../media/oled_icons/147.png'), 'width': 24, 'height': 24, 'alt': '147' }, '147'], + [{ 'src': require('../media/oled_icons/148.png'), 'width': 24, 'height': 24, 'alt': '148' }, '148'], + [{ 'src': require('../media/oled_icons/149.png'), 'width': 24, 'height': 24, 'alt': '149' }, '149'], + [{ 'src': require('../media/oled_icons/150.png'), 'width': 24, 'height': 24, 'alt': '150' }, '150'], + [{ 'src': require('../media/oled_icons/151.png'), 'width': 24, 'height': 24, 'alt': '151' }, '151'], + [{ 'src': require('../media/oled_icons/152.png'), 'width': 24, 'height': 24, 'alt': '152' }, '152'], + [{ 'src': require('../media/oled_icons/153.png'), 'width': 24, 'height': 24, 'alt': '153' }, '153'], + [{ 'src': require('../media/oled_icons/154.png'), 'width': 24, 'height': 24, 'alt': '154' }, '154'], + [{ 'src': require('../media/oled_icons/155.png'), 'width': 24, 'height': 24, 'alt': '155' }, '155'], + [{ 'src': require('../media/oled_icons/156.png'), 'width': 24, 'height': 24, 'alt': '156' }, '156'], + [{ 'src': require('../media/oled_icons/157.png'), 'width': 24, 'height': 24, 'alt': '157' }, '157'], + [{ 'src': require('../media/oled_icons/158.png'), 'width': 24, 'height': 24, 'alt': '158' }, '158'], + [{ 'src': require('../media/oled_icons/159.png'), 'width': 24, 'height': 24, 'alt': '159' }, '159'], + [{ 'src': require('../media/oled_icons/160.png'), 'width': 24, 'height': 24, 'alt': '160' }, '160'], + [{ 'src': require('../media/oled_icons/161.png'), 'width': 24, 'height': 24, 'alt': '161' }, '161'], + [{ 'src': require('../media/oled_icons/162.png'), 'width': 24, 'height': 24, 'alt': '162' }, '162'], + [{ 'src': require('../media/oled_icons/163.png'), 'width': 24, 'height': 24, 'alt': '163' }, '163'], + [{ 'src': require('../media/oled_icons/164.png'), 'width': 24, 'height': 24, 'alt': '164' }, '164'], + [{ 'src': require('../media/oled_icons/165.png'), 'width': 24, 'height': 24, 'alt': '165' }, '165'], + [{ 'src': require('../media/oled_icons/166.png'), 'width': 24, 'height': 24, 'alt': '166' }, '166'], + [{ 'src': require('../media/oled_icons/167.png'), 'width': 24, 'height': 24, 'alt': '167' }, '167'], + [{ 'src': require('../media/oled_icons/168.png'), 'width': 24, 'height': 24, 'alt': '168' }, '168'], + [{ 'src': require('../media/oled_icons/169.png'), 'width': 24, 'height': 24, 'alt': '169' }, '169'], + [{ 'src': require('../media/oled_icons/170.png'), 'width': 24, 'height': 24, 'alt': '170' }, '170'], + [{ 'src': require('../media/oled_icons/171.png'), 'width': 24, 'height': 24, 'alt': '171' }, '171'], + [{ 'src': require('../media/oled_icons/172.png'), 'width': 24, 'height': 24, 'alt': '172' }, '172'], + [{ 'src': require('../media/oled_icons/173.png'), 'width': 24, 'height': 24, 'alt': '173' }, '173'], + [{ 'src': require('../media/oled_icons/174.png'), 'width': 24, 'height': 24, 'alt': '174' }, '174'], + [{ 'src': require('../media/oled_icons/175.png'), 'width': 24, 'height': 24, 'alt': '175' }, '175'], + [{ 'src': require('../media/oled_icons/176.png'), 'width': 24, 'height': 24, 'alt': '176' }, '176'], + [{ 'src': require('../media/oled_icons/177.png'), 'width': 24, 'height': 24, 'alt': '177' }, '177'], + [{ 'src': require('../media/oled_icons/178.png'), 'width': 24, 'height': 24, 'alt': '178' }, '178'], + [{ 'src': require('../media/oled_icons/179.png'), 'width': 24, 'height': 24, 'alt': '179' }, '179'], + [{ 'src': require('../media/oled_icons/180.png'), 'width': 24, 'height': 24, 'alt': '180' }, '180'], + [{ 'src': require('../media/oled_icons/181.png'), 'width': 24, 'height': 24, 'alt': '181' }, '181'], + [{ 'src': require('../media/oled_icons/182.png'), 'width': 24, 'height': 24, 'alt': '182' }, '182'], + [{ 'src': require('../media/oled_icons/183.png'), 'width': 24, 'height': 24, 'alt': '183' }, '183'], + [{ 'src': require('../media/oled_icons/184.png'), 'width': 24, 'height': 24, 'alt': '184' }, '184'], + [{ 'src': require('../media/oled_icons/185.png'), 'width': 24, 'height': 24, 'alt': '185' }, '185'], + [{ 'src': require('../media/oled_icons/186.png'), 'width': 24, 'height': 24, 'alt': '186' }, '186'], + [{ 'src': require('../media/oled_icons/187.png'), 'width': 24, 'height': 24, 'alt': '187' }, '187'], + [{ 'src': require('../media/oled_icons/188.png'), 'width': 24, 'height': 24, 'alt': '188' }, '188'], + [{ 'src': require('../media/oled_icons/189.png'), 'width': 24, 'height': 24, 'alt': '189' }, '189'], + [{ 'src': require('../media/oled_icons/190.png'), 'width': 24, 'height': 24, 'alt': '190' }, '190'], + [{ 'src': require('../media/oled_icons/191.png'), 'width': 24, 'height': 24, 'alt': '191' }, '191'], + [{ 'src': require('../media/oled_icons/192.png'), 'width': 24, 'height': 24, 'alt': '192' }, '192'], + [{ 'src': require('../media/oled_icons/193.png'), 'width': 24, 'height': 24, 'alt': '193' }, '193'], + [{ 'src': require('../media/oled_icons/194.png'), 'width': 24, 'height': 24, 'alt': '194' }, '194'], + [{ 'src': require('../media/oled_icons/195.png'), 'width': 24, 'height': 24, 'alt': '195' }, '195'], + [{ 'src': require('../media/oled_icons/196.png'), 'width': 24, 'height': 24, 'alt': '196' }, '196'], + [{ 'src': require('../media/oled_icons/197.png'), 'width': 24, 'height': 24, 'alt': '197' }, '197'], + [{ 'src': require('../media/oled_icons/198.png'), 'width': 24, 'height': 24, 'alt': '198' }, '198'], + [{ 'src': require('../media/oled_icons/199.png'), 'width': 24, 'height': 24, 'alt': '199' }, '199'], + [{ 'src': require('../media/oled_icons/200.png'), 'width': 24, 'height': 24, 'alt': '200' }, '200'], + [{ 'src': require('../media/oled_icons/201.png'), 'width': 24, 'height': 24, 'alt': '201' }, '201'], + [{ 'src': require('../media/oled_icons/202.png'), 'width': 24, 'height': 24, 'alt': '202' }, '202'], + [{ 'src': require('../media/oled_icons/203.png'), 'width': 24, 'height': 24, 'alt': '203' }, '203'], + [{ 'src': require('../media/oled_icons/204.png'), 'width': 24, 'height': 24, 'alt': '204' }, '204'], + [{ 'src': require('../media/oled_icons/205.png'), 'width': 24, 'height': 24, 'alt': '205' }, '205'], + [{ 'src': require('../media/oled_icons/206.png'), 'width': 24, 'height': 24, 'alt': '206' }, '206'], + [{ 'src': require('../media/oled_icons/207.png'), 'width': 24, 'height': 24, 'alt': '207' }, '207'], + [{ 'src': require('../media/oled_icons/208.png'), 'width': 24, 'height': 24, 'alt': '208' }, '208'], + [{ 'src': require('../media/oled_icons/209.png'), 'width': 24, 'height': 24, 'alt': '209' }, '209'], + [{ 'src': require('../media/oled_icons/210.png'), 'width': 24, 'height': 24, 'alt': '210' }, '210'], + [{ 'src': require('../media/oled_icons/211.png'), 'width': 24, 'height': 24, 'alt': '211' }, '211'], + [{ 'src': require('../media/oled_icons/212.png'), 'width': 24, 'height': 24, 'alt': '212' }, '212'], + [{ 'src': require('../media/oled_icons/213.png'), 'width': 24, 'height': 24, 'alt': '213' }, '213'], + [{ 'src': require('../media/oled_icons/214.png'), 'width': 24, 'height': 24, 'alt': '214' }, '214'], + [{ 'src': require('../media/oled_icons/215.png'), 'width': 24, 'height': 24, 'alt': '215' }, '215'], + [{ 'src': require('../media/oled_icons/216.png'), 'width': 24, 'height': 24, 'alt': '216' }, '216'], + [{ 'src': require('../media/oled_icons/217.png'), 'width': 24, 'height': 24, 'alt': '217' }, '217'], + [{ 'src': require('../media/oled_icons/218.png'), 'width': 24, 'height': 24, 'alt': '218' }, '218'], + [{ 'src': require('../media/oled_icons/219.png'), 'width': 24, 'height': 24, 'alt': '219' }, '219'], + [{ 'src': require('../media/oled_icons/220.png'), 'width': 24, 'height': 24, 'alt': '220' }, '220'], + [{ 'src': require('../media/oled_icons/221.png'), 'width': 24, 'height': 24, 'alt': '221' }, '221'], + [{ 'src': require('../media/oled_icons/222.png'), 'width': 24, 'height': 24, 'alt': '222' }, '222'], + [{ 'src': require('../media/oled_icons/223.png'), 'width': 24, 'height': 24, 'alt': '223' }, '223'], + [{ 'src': require('../media/oled_icons/224.png'), 'width': 24, 'height': 24, 'alt': '224' }, '224'], + [{ 'src': require('../media/oled_icons/225.png'), 'width': 24, 'height': 24, 'alt': '225' }, '225'], + [{ 'src': require('../media/oled_icons/226.png'), 'width': 24, 'height': 24, 'alt': '226' }, '226'], + [{ 'src': require('../media/oled_icons/227.png'), 'width': 24, 'height': 24, 'alt': '227' }, '227'], + [{ 'src': require('../media/oled_icons/228.png'), 'width': 24, 'height': 24, 'alt': '228' }, '228'], + [{ 'src': require('../media/oled_icons/229.png'), 'width': 24, 'height': 24, 'alt': '229' }, '229'], + [{ 'src': require('../media/oled_icons/230.png'), 'width': 24, 'height': 24, 'alt': '230' }, '230'], + [{ 'src': require('../media/oled_icons/231.png'), 'width': 24, 'height': 24, 'alt': '231' }, '231'], + [{ 'src': require('../media/oled_icons/232.png'), 'width': 24, 'height': 24, 'alt': '232' }, '232'], + [{ 'src': require('../media/oled_icons/233.png'), 'width': 24, 'height': 24, 'alt': '233' }, '233'], + [{ 'src': require('../media/oled_icons/234.png'), 'width': 24, 'height': 24, 'alt': '234' }, '234'], + [{ 'src': require('../media/oled_icons/235.png'), 'width': 24, 'height': 24, 'alt': '235' }, '235'], + [{ 'src': require('../media/oled_icons/236.png'), 'width': 24, 'height': 24, 'alt': '236' }, '236'], + [{ 'src': require('../media/oled_icons/237.png'), 'width': 24, 'height': 24, 'alt': '237' }, '237'], + [{ 'src': require('../media/oled_icons/238.png'), 'width': 24, 'height': 24, 'alt': '238' }, '238'], + [{ 'src': require('../media/oled_icons/239.png'), 'width': 24, 'height': 24, 'alt': '239' }, '239'], + [{ 'src': require('../media/oled_icons/240.png'), 'width': 24, 'height': 24, 'alt': '240' }, '240'], + [{ 'src': require('../media/oled_icons/241.png'), 'width': 24, 'height': 24, 'alt': '241' }, '241'], + [{ 'src': require('../media/oled_icons/242.png'), 'width': 24, 'height': 24, 'alt': '242' }, '242'], + [{ 'src': require('../media/oled_icons/243.png'), 'width': 24, 'height': 24, 'alt': '243' }, '243'], + [{ 'src': require('../media/oled_icons/244.png'), 'width': 24, 'height': 24, 'alt': '244' }, '244'], + [{ 'src': require('../media/oled_icons/245.png'), 'width': 24, 'height': 24, 'alt': '245' }, '245'], + [{ 'src': require('../media/oled_icons/246.png'), 'width': 24, 'height': 24, 'alt': '246' }, '246'], + [{ 'src': require('../media/oled_icons/247.png'), 'width': 24, 'height': 24, 'alt': '247' }, '247'], + [{ 'src': require('../media/oled_icons/248.png'), 'width': 24, 'height': 24, 'alt': '248' }, '248'], + [{ 'src': require('../media/oled_icons/249.png'), 'width': 24, 'height': 24, 'alt': '249' }, '249'], + [{ 'src': require('../media/oled_icons/250.png'), 'width': 24, 'height': 24, 'alt': '250' }, '250'], + [{ 'src': require('../media/oled_icons/251.png'), 'width': 24, 'height': 24, 'alt': '251' }, '251'], + [{ 'src': require('../media/oled_icons/252.png'), 'width': 24, 'height': 24, 'alt': '252' }, '252'], + [{ 'src': require('../media/oled_icons/253.png'), 'width': 24, 'height': 24, 'alt': '253' }, '253'], + [{ 'src': require('../media/oled_icons/254.png'), 'width': 24, 'height': 24, 'alt': '254' }, '254'], + [{ 'src': require('../media/oled_icons/255.png'), 'width': 24, 'height': 24, 'alt': '255' }, '255'], + [{ 'src': require('../media/oled_icons/256.png'), 'width': 24, 'height': 24, 'alt': '256' }, '256'], + [{ 'src': require('../media/oled_icons/257.png'), 'width': 24, 'height': 24, 'alt': '257' }, '257'], + [{ 'src': require('../media/oled_icons/258.png'), 'width': 24, 'height': 24, 'alt': '258' }, '258'], + [{ 'src': require('../media/oled_icons/259.png'), 'width': 24, 'height': 24, 'alt': '259' }, '259'], + [{ 'src': require('../media/oled_icons/260.png'), 'width': 24, 'height': 24, 'alt': '260' }, '260'], + [{ 'src': require('../media/oled_icons/261.png'), 'width': 24, 'height': 24, 'alt': '261' }, '261'], + [{ 'src': require('../media/oled_icons/262.png'), 'width': 24, 'height': 24, 'alt': '262' }, '262'], + [{ 'src': require('../media/oled_icons/263.png'), 'width': 24, 'height': 24, 'alt': '263' }, '263'], + [{ 'src': require('../media/oled_icons/264.png'), 'width': 24, 'height': 24, 'alt': '264' }, '264'], + [{ 'src': require('../media/oled_icons/265.png'), 'width': 24, 'height': 24, 'alt': '265' }, '265'], + [{ 'src': require('../media/oled_icons/266.png'), 'width': 24, 'height': 24, 'alt': '266' }, '266'], + [{ 'src': require('../media/oled_icons/267.png'), 'width': 24, 'height': 24, 'alt': '267' }, '267'], + [{ 'src': require('../media/oled_icons/268.png'), 'width': 24, 'height': 24, 'alt': '268' }, '268'], + [{ 'src': require('../media/oled_icons/269.png'), 'width': 24, 'height': 24, 'alt': '269' }, '269'], + [{ 'src': require('../media/oled_icons/270.png'), 'width': 24, 'height': 24, 'alt': '270' }, '270'], + [{ 'src': require('../media/oled_icons/271.png'), 'width': 24, 'height': 24, 'alt': '271' }, '271'], + [{ 'src': require('../media/oled_icons/272.png'), 'width': 24, 'height': 24, 'alt': '272' }, '272'], + [{ 'src': require('../media/oled_icons/273.png'), 'width': 24, 'height': 24, 'alt': '273' }, '273'], + [{ 'src': require('../media/oled_icons/274.png'), 'width': 24, 'height': 24, 'alt': '274' }, '274'], + [{ 'src': require('../media/oled_icons/275.png'), 'width': 24, 'height': 24, 'alt': '275' }, '275'], + [{ 'src': require('../media/oled_icons/276.png'), 'width': 24, 'height': 24, 'alt': '276' }, '276'], + [{ 'src': require('../media/oled_icons/277.png'), 'width': 24, 'height': 24, 'alt': '277' }, '277'], + [{ 'src': require('../media/oled_icons/278.png'), 'width': 24, 'height': 24, 'alt': '278' }, '278'], + [{ 'src': require('../media/oled_icons/279.png'), 'width': 24, 'height': 24, 'alt': '279' }, '279'], + [{ 'src': require('../media/oled_icons/280.png'), 'width': 24, 'height': 24, 'alt': '280' }, '280'], + [{ 'src': require('../media/oled_icons/281.png'), 'width': 24, 'height': 24, 'alt': '281' }, '281'], + [{ 'src': require('../media/oled_icons/282.png'), 'width': 24, 'height': 24, 'alt': '282' }, '282'], + [{ 'src': require('../media/oled_icons/283.png'), 'width': 24, 'height': 24, 'alt': '283' }, '283'], + [{ 'src': require('../media/oled_icons/284.png'), 'width': 24, 'height': 24, 'alt': '284' }, '284'], + [{ 'src': require('../media/oled_icons/285.png'), 'width': 24, 'height': 24, 'alt': '285' }, '285'], + [{ 'src': require('../media/oled_icons/286.png'), 'width': 24, 'height': 24, 'alt': '286' }, '286'] +]; + +const FACE_IMAGE = [ + [{ 'src': require('../media/oled_icons/face/Eyes/Angry.png'), 'width': 35, 'height': 25, 'alt': 'Angry' }, 'Angry,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x78,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0x01,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0x07,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0xB8,0x1F,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x3E,0x00,0x38,0x7F,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x80,0x3F,0x00,0x38,0xFC,0x01,0x00,0xE0,0x00,0x0C,0x00,0x00,0xE0,0x3F,0x00,0x38,0xF0,0x07,0x00,0xE0,0x00,0x0C,0x00,0x00,0xF8,0x31,0x00,0x38,0xC0,0x1F,0x00,0xE0,0x00,0x0C,0x00,0x00,0x7E,0x30,0x00,0x38,0x00,0x7F,0x00,0xE0,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0xE0,0x07,0x30,0x00,0x38,0x00,0xF0,0x07,0xE0,0x00,0x0C,0x00,0xF8,0x01,0x30,0x00,0x38,0x00,0xE0,0x1F,0xE0,0x00,0x0C,0x00,0xFE,0x00,0x30,0x00,0x38,0x00,0xF0,0x7F,0xE0,0x00,0x0C,0x80,0x3F,0x00,0x30,0x00,0x38,0x00,0xF8,0xFF,0xE1,0x00,0x0C,0xE0,0x6F,0x01,0x30,0x00,0x38,0x00,0xFC,0xF9,0xE7,0x00,0x0C,0xF8,0x4F,0x00,0x30,0x00,0x38,0x00,0xFD,0xDD,0xFF,0x00,0x0C,0xFE,0xF7,0x00,0x30,0x00,0x38,0x00,0xFE,0x3F,0xFF,0x00,0x8C,0xFF,0xFF,0x02,0x30,0x00,0x38,0x00,0xFE,0x3F,0xFC,0x00,0xFC,0xFF,0xFF,0x00,0x30,0x00,0x38,0x00,0xFE,0x3F,0xF0,0x00,0xFC,0xF5,0xFF,0x02,0x30,0x00,0x38,0x00,0xFC,0x1F,0xE0,0x00,0x7C,0xF0,0xFF,0x00,0x30,0x00,0x38,0x00,0xFD,0x5F,0xE0,0x00,0x1C,0xE0,0x7F,0x00,0x38,0x00,0x70,0x00,0xF8,0x0F,0x70,0x00,0x1C,0xE8,0x7F,0x01,0x38,0x00,0x70,0x00,0xF0,0x07,0x70,0x00,0x3C,0xC0,0x3F,0x00,0x3C,0x00,0xF0,0x00,0xC0,0x01,0x78,0x00,0x38,0x20,0x4F,0x00,0x1C,0x00,0xE0,0x01,0x20,0x04,0x3C,0x00,0x78,0x80,0x10,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Awake.png'), 'width': 35, 'height': 25, 'alt': 'Awake' }, 'Awake,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x3E,0x00,0xF8,0x1F,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0xE0,0x3F,0x00,0xF8,0xFF,0x03,0x00,0xE0,0x00,0x0C,0x00,0x80,0xFF,0x3F,0x00,0x38,0xF8,0xFF,0x00,0xE0,0x00,0x0C,0x00,0xFC,0x7F,0x30,0x00,0x38,0x00,0xFF,0x0F,0xE0,0x00,0x0C,0xE0,0xFF,0x03,0x30,0x00,0x38,0x00,0xFC,0xFF,0xE1,0x00,0x0C,0xFE,0x7F,0x00,0x30,0x00,0x38,0x80,0xFE,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0x00,0x30,0x00,0x38,0x00,0x7E,0x96,0xFF,0x00,0xFC,0x87,0xBF,0x05,0x30,0x00,0x38,0x40,0x7F,0x16,0xF0,0x00,0x3C,0xC0,0x9F,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x00,0xFF,0x03,0xE0,0x00,0x0C,0xA0,0xFF,0x05,0x30,0x00,0x38,0x80,0xFE,0x0B,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0xF8,0x00,0xE0,0x00,0x0C,0x00,0x7E,0x00,0x30,0x00,0x38,0x00,0x02,0x02,0xE0,0x00,0x0C,0x00,0x81,0x00,0x30,0x00,0x38,0x00,0x50,0x00,0xE0,0x00,0x0C,0x00,0x14,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Black eye.png'), 'width': 35, 'height': 25, 'alt': 'Black_eye' }, 'Black_eye,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xF8,0xFF,0x7F,0x00,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x5F,0x55,0xD5,0x1F,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x4B,0xAA,0xA4,0x3E,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xE0,0xB5,0x55,0x5B,0x3D,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xF0,0x4A,0xAA,0xA4,0x7A,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xF0,0xB6,0x55,0x5B,0x75,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x78,0x49,0xAA,0x24,0xF5,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xB8,0xB6,0x55,0xDB,0xEA,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x78,0x49,0xAA,0x24,0xF5,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xB8,0xB6,0x55,0xDB,0xEA,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x49,0xAA,0x24,0xF5,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0xB6,0x55,0xDB,0xEA,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x49,0xAA,0x24,0xE9,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0x00,0x42,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0x80,0x1C,0x01,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0x00,0xFE,0x00,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0xA0,0xBF,0x05,0x30,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x0C,0x80,0x3F,0x01,0x30,0x00,0x38,0x40,0x7F,0x17,0xE0,0x00,0x0C,0xC0,0xDF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0xA0,0xFF,0x05,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0x0C,0x80,0x3C,0x01,0x30,0x00,0xB8,0xAA,0xAA,0xAA,0xEA,0x00,0x0C,0x00,0x42,0x00,0x30,0x00,0xB8,0x2A,0x49,0xAA,0xEA,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x78,0xD5,0xB6,0x55,0xF5,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xB8,0x2A,0x49,0xAA,0xEA,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0xD2,0xB6,0x55,0xF5,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x70,0x2D,0x49,0xAA,0x75,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF0,0xD2,0xB6,0x55,0x7A,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xE0,0x2D,0x49,0xAA,0x3D,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xE0,0xD3,0xB6,0x55,0x3E,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xC0,0x2F,0x49,0xD2,0x1F,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Bottom left.png'), 'width': 35, 'height': 25, 'alt': 'Bottom_left' }, 'Bottom_left,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x40,0x01,0x00,0xE0,0x00,0x0C,0xA0,0x00,0x00,0x30,0x00,0x38,0x08,0x08,0x00,0xE0,0x00,0x0C,0x04,0x02,0x00,0x30,0x00,0x38,0xE0,0x13,0x00,0xE0,0x00,0x0C,0xF8,0x01,0x00,0x30,0x00,0x38,0xFA,0x0F,0x00,0xE0,0x00,0x0C,0xFC,0x03,0x00,0x30,0x00,0x38,0xF8,0x19,0x00,0xE0,0x00,0x8C,0xFE,0x16,0x00,0x30,0x00,0x38,0xFD,0x59,0x00,0xE0,0x00,0x0C,0x7F,0x0E,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFD,0x5F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFC,0x0F,0x00,0xE0,0x00,0x8C,0xFE,0x17,0x00,0x30,0x00,0x38,0xFA,0x2F,0x00,0xE0,0x00,0x0C,0xFC,0x03,0x00,0x30,0x00,0x38,0xE0,0x03,0x00,0xE0,0x00,0x0C,0xF8,0x01,0x00,0x30,0x00,0x38,0x08,0x08,0x00,0xE0,0x00,0x1C,0x04,0x02,0x00,0x38,0x00,0x70,0x40,0x01,0x00,0x70,0x00,0x1C,0x50,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'], + [{ 'src': require('../media/oled_icons/face/Eyes/Bottom right.png'), 'width': 35, 'height': 25, 'alt': 'Bottom_right' }, 'Bottom_right,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x14,0xE0,0x00,0x0C,0x00,0x00,0x0A,0x30,0x00,0x38,0x00,0x80,0x80,0xE0,0x00,0x0C,0x00,0x40,0x20,0x30,0x00,0x38,0x00,0x00,0x3E,0xE1,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0xA0,0xFF,0xE0,0x00,0x0C,0x00,0xC0,0x3F,0x30,0x00,0x38,0x00,0x80,0x9F,0xE1,0x00,0x0C,0x00,0xE8,0x6F,0x31,0x00,0x38,0x00,0xD0,0x9F,0xE5,0x00,0x0C,0x00,0xF0,0xE7,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xD0,0xFF,0xE5,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xC0,0xFF,0xE0,0x00,0x0C,0x00,0xE8,0x7F,0x31,0x00,0x38,0x00,0xA0,0xFF,0xE2,0x00,0x0C,0x00,0xC0,0x3F,0x30,0x00,0x38,0x00,0x00,0x3E,0xE0,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0x80,0x80,0xE0,0x00,0x1C,0x00,0x40,0x20,0x38,0x00,0x70,0x00,0x00,0x14,0x70,0x00,0x1C,0x00,0x00,0x05,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Crazy 1.png'), 'width': 35, 'height': 25, 'alt': 'Crazy_1' }, 'Crazy_1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x14,0xE0,0x00,0x0C,0x00,0x00,0x0A,0x30,0x00,0x38,0x00,0x80,0x80,0xE0,0x00,0x0C,0x00,0x40,0x20,0x30,0x00,0x38,0x00,0x00,0x3E,0xE1,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0xA0,0xFF,0xE0,0x00,0x0C,0x00,0xC0,0x3F,0x30,0x00,0x38,0x00,0x80,0x9F,0xE1,0x00,0x0C,0x00,0xE8,0x6F,0x31,0x00,0x38,0x00,0xD0,0x9F,0xE5,0x00,0x0C,0x00,0xF0,0xE7,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xD0,0xFF,0xE5,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xC0,0xFF,0xE0,0x00,0x0C,0x00,0xE8,0x7F,0x31,0x00,0x38,0x00,0xA0,0xFF,0xE2,0x00,0x0C,0x00,0xC0,0x3F,0x30,0x00,0x38,0x00,0x00,0x3E,0xE0,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0x80,0x80,0xE0,0x00,0x1C,0x00,0x40,0x20,0x38,0x00,0x70,0x00,0x00,0x14,0x70,0x00,0x1C,0x00,0x00,0x05,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Crazy 2.png'), 'width': 35, 'height': 25, 'alt': 'Crazy_2' }, 'Crazy_2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x20,0x04,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xC8,0x11,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xE0,0x0F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFA,0x5B,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xF8,0x13,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFC,0x3D,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFD,0xBF,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFC,0x3F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFD,0xBF,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFC,0x3F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xF8,0x1F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xFA,0x5F,0x30,0x00,0x38,0x00,0x05,0x00,0xE0,0x00,0x0C,0x00,0xF0,0x0F,0x30,0x00,0x38,0x20,0x20,0x00,0xE0,0x00,0x0C,0x00,0xC8,0x13,0x30,0x00,0x38,0x80,0x4F,0x00,0xE0,0x00,0x0C,0x00,0x20,0x04,0x30,0x00,0x38,0xE8,0x3F,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xE0,0x67,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF4,0x67,0x01,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF8,0xFF,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF8,0xFF,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF8,0xFF,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF8,0xFF,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF4,0x7F,0x01,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xF0,0x3F,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xE8,0xBF,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x80,0x0F,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x20,0x20,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x05,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Disappointed.png'), 'width': 35, 'height': 25, 'alt': 'Disappointed' }, 'Disappointed,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0xF8,0x1F,0x00,0xE0,0x3F,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x7C,0x3C,0x00,0xF0,0x78,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x3E,0x38,0x00,0x78,0xF0,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x1F,0x70,0x00,0x38,0xE0,0x01,0x00,0x1C,0x00,0x70,0x00,0x80,0x0F,0x70,0x00,0x1C,0xC0,0x03,0x00,0x38,0x00,0x38,0x00,0xC0,0x07,0xE0,0x00,0x1C,0x80,0x07,0x00,0x38,0x00,0x38,0x00,0xE0,0x03,0xE0,0x00,0x1C,0x00,0x0F,0x00,0x38,0x00,0x38,0x00,0xF0,0x01,0xE0,0x00,0x0C,0x00,0x1E,0x00,0x30,0x00,0x38,0x00,0xF8,0x00,0xE0,0x00,0x0C,0x00,0x3C,0x00,0x30,0x00,0x38,0x00,0x7C,0x00,0xE0,0x00,0x0C,0x00,0x78,0x00,0x30,0x00,0x38,0x00,0x3E,0x02,0xE0,0x00,0x0C,0x00,0xF9,0x00,0x30,0x00,0x38,0x00,0xFF,0x04,0xE0,0x00,0x0C,0x00,0xFE,0x01,0x30,0x00,0x38,0x80,0xFF,0x03,0xE0,0x00,0x0C,0x00,0xFF,0x03,0x30,0x00,0x38,0xC0,0x7F,0x06,0xE0,0x00,0x0C,0xA0,0xBF,0x07,0x30,0x00,0x38,0xE0,0x7F,0x16,0xE0,0x00,0x0C,0xC0,0x9F,0x0F,0x30,0x00,0x38,0xF0,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x1F,0x30,0x00,0x38,0xF8,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x3F,0x30,0x00,0x38,0xFC,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x7B,0x30,0x00,0x38,0xBE,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0xFB,0x30,0x00,0x38,0x5F,0xFF,0x17,0xE0,0x00,0x0C,0xC0,0xFF,0xE3,0x31,0x00,0xB8,0x0F,0xFF,0x03,0xE0,0x00,0x0C,0xA0,0xFF,0xC5,0x33,0x00,0xF8,0x87,0xFE,0x0B,0xE0,0x00,0x0C,0x00,0xFF,0x80,0x3F,0x00,0xF8,0x03,0xF8,0x00,0xE0,0x00,0x0C,0x00,0x7E,0x00,0x3F,0x00,0xF8,0x01,0x02,0x02,0xE0,0x00,0x0C,0x00,0x81,0x00,0x3E,0x00,0xF8,0x00,0x50,0x00,0xE0,0x00,0x0C,0x00,0x14,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Dizzy.png'), 'width': 35, 'height': 25, 'alt': 'Dizzy' }, 'Dizzy,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x0C,0x00,0xE0,0x00,0x0C,0x00,0x03,0x00,0x30,0x00,0x38,0x00,0x0F,0x00,0xE0,0x00,0x0C,0xC0,0x03,0x00,0x30,0x00,0x38,0x80,0x03,0x00,0xE0,0x00,0x0C,0xE0,0x00,0x00,0x30,0x00,0x38,0xC0,0xF9,0x07,0xE0,0x00,0x0C,0x70,0xFE,0x01,0x30,0x00,0x38,0xE0,0x3C,0x1F,0xE0,0x00,0x0C,0x38,0xCF,0x07,0x30,0x00,0x38,0x60,0x06,0x38,0xE0,0x00,0x0C,0x98,0x01,0x0E,0x30,0x00,0x38,0x30,0xE3,0x33,0xE0,0x00,0x0C,0xCC,0xF8,0x0C,0x30,0x00,0x38,0x30,0xF3,0x67,0xE0,0x00,0x0C,0xCC,0xFC,0x19,0x30,0x00,0x38,0xB0,0x19,0x6E,0xE0,0x00,0x0C,0x6C,0x86,0x1B,0x30,0x00,0x38,0xB0,0xD9,0xCC,0xE0,0x00,0x0C,0x6C,0x36,0x33,0x30,0x00,0x38,0xB0,0xD9,0xCD,0xE0,0x00,0x0C,0x6C,0x76,0x33,0x30,0x00,0x38,0xB0,0xF9,0xCD,0xE0,0x00,0x0C,0x6C,0x7E,0x33,0x30,0x00,0x38,0x30,0xF3,0x6C,0xE0,0x00,0x0C,0xCC,0x3C,0x1B,0x30,0x00,0x38,0x70,0x07,0x66,0xE0,0x00,0x0C,0xDC,0x81,0x19,0x30,0x00,0x38,0x60,0x9E,0x77,0xE0,0x00,0x0C,0x98,0xE7,0x1D,0x30,0x00,0x38,0xC0,0xF8,0x31,0xE0,0x00,0x0C,0x30,0x7E,0x0C,0x30,0x00,0x38,0xC0,0x01,0x18,0xE0,0x00,0x0C,0x70,0x00,0x06,0x30,0x00,0x38,0x00,0x0F,0x0E,0xE0,0x00,0x0C,0xC0,0x83,0x03,0x30,0x00,0x38,0x00,0xFE,0x07,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xF0,0x00,0xE0,0x00,0x0C,0x00,0x3C,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Down.png'), 'width': 35, 'height': 25, 'alt': 'Down' }, 'Down,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x50,0x00,0xE0,0x00,0x0C,0x00,0x14,0x00,0x30,0x00,0x38,0x00,0x02,0x02,0xE0,0x00,0x0C,0x00,0x81,0x00,0x30,0x00,0x38,0x00,0xF9,0x00,0xE0,0x00,0x0C,0x00,0x7E,0x00,0x30,0x00,0x38,0x00,0xFE,0x0B,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x0C,0xA0,0xBF,0x05,0x30,0x00,0x38,0x40,0x7F,0x16,0xE0,0x00,0x0C,0xC0,0x9F,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x00,0xFE,0x07,0xE0,0x00,0x1C,0xA0,0xFF,0x05,0x38,0x00,0x70,0x80,0xFE,0x0B,0x70,0x00,0x1C,0x00,0xFF,0x00,0x38,0x00,0x70,0x00,0xF8,0x00,0x70,0x00,0x3C,0x00,0x7E,0x00,0x3C,0x00,0xF0,0x00,0x02,0x02,0x78,0x00,0x38,0x00,0x81,0x00,0x1C,0x00,0xE0,0x01,0xA8,0x00,0x3C,0x00,0x78,0x00,0x28,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Evil.png'), 'width': 35, 'height': 25, 'alt': 'Evil' }, 'Evil,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x0F,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0xC0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0xE0,0x1F,0x00,0x70,0x3C,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x70,0x1C,0x00,0x70,0x78,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x3C,0x38,0x00,0x38,0xF0,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x1E,0x38,0x00,0x38,0xE0,0x01,0x00,0xE0,0x00,0x1C,0x00,0x00,0x0F,0x38,0x00,0x38,0x80,0x07,0x00,0xE0,0x00,0x0C,0x00,0x80,0x07,0x30,0x00,0x38,0x00,0x0F,0x00,0xE0,0x00,0x0C,0x00,0xC0,0x03,0x30,0x00,0x38,0x00,0x1E,0x00,0xE0,0x00,0x0C,0x00,0xE0,0x01,0x30,0x00,0x38,0x00,0x3C,0x00,0xE0,0x00,0x0C,0x00,0x70,0x00,0x30,0x00,0x38,0x00,0x78,0x00,0xE0,0x00,0x0C,0x00,0x7C,0x00,0x30,0x00,0x38,0x00,0xF2,0x00,0xE0,0x00,0x0C,0x00,0x3E,0x01,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0xFE,0x07,0xE0,0x00,0x0C,0x80,0xBF,0x05,0x30,0x00,0x38,0x00,0x7F,0x0F,0xE0,0x00,0x0C,0xC0,0x3F,0x01,0x30,0x00,0x38,0x40,0x7F,0x1F,0xE0,0x00,0x0C,0xE0,0xDF,0x03,0x30,0x00,0x38,0x80,0xFF,0x3F,0xE0,0x00,0x0C,0xF8,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x7F,0xE0,0x00,0x0C,0xFC,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0xFF,0xE0,0x00,0x0C,0xFE,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0xC7,0xE3,0x00,0x0C,0xCF,0xFF,0x03,0x30,0x00,0x38,0x40,0xFF,0x97,0xE7,0x00,0x8C,0x87,0xFF,0x01,0x30,0x00,0x38,0x00,0xFE,0x03,0xEF,0x00,0xCC,0xA3,0xFF,0x05,0x30,0x00,0x38,0x00,0xFC,0x01,0xFE,0x00,0xFC,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xFC,0x00,0x7C,0x80,0x3C,0x01,0x30,0x00,0x38,0x00,0x08,0x01,0xF8,0x00,0x3C,0x00,0x42,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Hurt.png'), 'width': 35, 'height': 25, 'alt': 'Hurt' }, 'Hurt,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xF0,0x00,0x1C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xFC,0x00,0x7C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xFF,0x00,0xFC,0x01,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0xC0,0xFF,0x00,0xFC,0x07,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0xF0,0xE7,0x00,0x8C,0x1F,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0xFC,0xE1,0x00,0x0C,0x7E,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x7F,0xE0,0x00,0x0C,0xF8,0x01,0x00,0x30,0x00,0x38,0x00,0xC0,0x1F,0xE0,0x00,0x0C,0xE0,0x07,0x00,0x30,0x00,0x38,0x00,0xF0,0x0F,0xE0,0x00,0x0C,0xC0,0x1F,0x00,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x20,0x7F,0x00,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x01,0x30,0x00,0x38,0xC0,0xFF,0x0F,0xE0,0x00,0x0C,0xE8,0xFF,0x07,0x30,0x00,0x38,0xF0,0xFF,0x19,0xE0,0x00,0x0C,0xE0,0xCF,0x1F,0x30,0x00,0x38,0xFC,0xFD,0x5D,0xE0,0x00,0x0C,0xF0,0xF7,0x7E,0x30,0x00,0x38,0xFF,0xFE,0x3F,0xE0,0x00,0x0C,0xF4,0xFF,0xFA,0x31,0x00,0xB8,0x1F,0xFE,0x3F,0xE0,0x00,0x0C,0xF0,0xFF,0xE0,0x37,0x00,0xF8,0x07,0xFE,0x3F,0xE0,0x00,0x0C,0xF4,0xFF,0x82,0x3F,0x00,0xF8,0x01,0xFC,0x1F,0xE0,0x00,0x0C,0xF0,0xFF,0x00,0x3E,0x00,0x78,0x00,0xFD,0x5F,0xE0,0x00,0x1C,0xE0,0x7F,0x00,0x38,0x00,0x70,0x00,0xF8,0x0F,0x70,0x00,0x1C,0xE8,0x7F,0x01,0x38,0x00,0x70,0x00,0xF0,0x07,0x70,0x00,0x3C,0xC0,0x3F,0x00,0x3C,0x00,0xF0,0x00,0xC0,0x01,0x78,0x00,0x38,0x20,0x4F,0x00,0x1C,0x00,0xE0,0x01,0x20,0x04,0x3C,0x00,0x78,0x80,0x10,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Knocked out.png'), 'width': 35, 'height': 25, 'alt': 'Knocked_out' }, 'Knocked_out,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0xF0,0xFF,0x7F,0xE0,0x00,0x0C,0xF8,0xFF,0x1F,0x30,0x00,0x38,0xF0,0xFF,0x7F,0xE0,0x00,0x0C,0xFC,0xFF,0x3F,0x30,0x00,0x38,0xF0,0xFF,0x7F,0xE0,0x00,0x0C,0xFC,0xFF,0x1F,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Love.png'), 'width': 35, 'height': 25, 'alt': 'Love' }, 'Love,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0xE0,0x07,0x3F,0xE0,0x00,0x0C,0xF0,0x81,0x0F,0x30,0x00,0x38,0xF0,0x8B,0x5F,0xE0,0x00,0x0C,0xF8,0xC2,0x1F,0x30,0x00,0x38,0xF8,0xD7,0xBF,0xE0,0x00,0x0C,0xFC,0xE5,0x2F,0x30,0x00,0x38,0xF8,0xFF,0xBF,0xE0,0x00,0x0C,0xFE,0xFF,0x5F,0x30,0x00,0x38,0xFC,0xFF,0x7F,0xE0,0x00,0x0C,0xFE,0xFF,0x5F,0x30,0x00,0x38,0xFC,0xFF,0xFF,0xE1,0x00,0x0C,0xFE,0xFF,0x7F,0x30,0x00,0x38,0xFC,0xFF,0xFF,0xE1,0x00,0x0C,0xFE,0xFF,0x7F,0x30,0x00,0x38,0xFC,0xFF,0xFF,0xE1,0x00,0x0C,0xFE,0xFF,0x7F,0x30,0x00,0x38,0xF8,0xFF,0xFF,0xE0,0x00,0x0C,0xFE,0xFF,0x7F,0x30,0x00,0x38,0xF8,0xFF,0xFF,0xE0,0x00,0x0C,0xFE,0xFF,0x7F,0x30,0x00,0x38,0xF8,0xFF,0xFF,0xE0,0x00,0x0C,0xFC,0xFF,0x3F,0x30,0x00,0x38,0xF0,0xFF,0x7F,0xE0,0x00,0x0C,0xF8,0xFF,0x1F,0x30,0x00,0x38,0xC0,0xFF,0x1F,0xE0,0x00,0x0C,0xF0,0xFF,0x0F,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xE0,0xFF,0x07,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0x7E,0x00,0x30,0x00,0x38,0x00,0xF8,0x00,0xE0,0x00,0x0C,0x00,0x3C,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x18,0x00,0x30,0x00,0x38,0x00,0x20,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Middle left.png'), 'width': 35, 'height': 25, 'alt': 'Middle_left' }, 'Middle_left,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x10,0x02,0x00,0xE0,0x00,0x0C,0x04,0x01,0x00,0x30,0x00,0x38,0xC0,0x01,0x00,0xE0,0x00,0x0C,0xE0,0x04,0x00,0x30,0x00,0x38,0xF0,0x07,0x00,0xE0,0x00,0x0C,0xFC,0x01,0x00,0x30,0x00,0x38,0xF8,0x0F,0x00,0xE0,0x00,0x8C,0xFE,0x17,0x00,0x30,0x00,0x38,0xFC,0x19,0x00,0xE0,0x00,0x0C,0xFE,0x04,0x00,0x30,0x00,0x38,0xFD,0x5D,0x00,0xE0,0x00,0x4C,0x7F,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFC,0x1F,0x00,0xE0,0x00,0x4C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFD,0x5F,0x00,0xE0,0x00,0x0C,0xFE,0x07,0x00,0x30,0x00,0x38,0xF8,0x0F,0x00,0xE0,0x00,0x8C,0xFE,0x17,0x00,0x30,0x00,0x38,0xF0,0x07,0x00,0xE0,0x00,0x0C,0xFC,0x03,0x00,0x30,0x00,0x38,0xC0,0x01,0x00,0xE0,0x00,0x0C,0xF2,0x04,0x00,0x30,0x00,0x38,0x10,0x02,0x00,0xE0,0x00,0x0C,0x08,0x01,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Middle right.png'), 'width': 35, 'height': 25, 'alt': 'Middle_right' }, 'Middle_right,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x21,0xE0,0x00,0x0C,0x00,0x40,0x10,0x30,0x00,0x38,0x00,0x00,0x1C,0xE0,0x00,0x0C,0x00,0x00,0x4E,0x30,0x00,0x38,0x00,0x00,0x7F,0xE0,0x00,0x0C,0x00,0xC0,0x1F,0x30,0x00,0x38,0x00,0x80,0xFF,0xE0,0x00,0x0C,0x00,0xE8,0x7F,0x31,0x00,0x38,0x00,0xC0,0x9F,0xE1,0x00,0x0C,0x00,0xE0,0x4F,0x30,0x00,0x38,0x00,0xD0,0xDF,0xE5,0x00,0x0C,0x00,0xF0,0xF7,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x30,0x00,0x38,0x00,0xC0,0xFF,0xE1,0x00,0x0C,0x00,0xF0,0xFF,0x32,0x00,0x38,0x00,0xD0,0xFF,0xE5,0x00,0x0C,0x00,0xE0,0x7F,0x30,0x00,0x38,0x00,0x80,0xFF,0xE0,0x00,0x0C,0x00,0xE8,0x7F,0x31,0x00,0x38,0x00,0x00,0x7F,0xE0,0x00,0x0C,0x00,0xC0,0x3F,0x30,0x00,0x38,0x00,0x00,0x1C,0xE0,0x00,0x0C,0x00,0x20,0x4F,0x30,0x00,0x38,0x00,0x00,0x21,0xE0,0x00,0x0C,0x00,0x80,0x10,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Neutral.png'), 'width': 35, 'height': 25, 'alt': 'Neutral' }, 'Neutral,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x84,0x00,0xE0,0x00,0x0C,0x00,0x41,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x38,0x01,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0x7F,0x00,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0xA0,0xFF,0x05,0x30,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x0C,0x80,0x3F,0x01,0x30,0x00,0x38,0x40,0x7F,0x17,0xE0,0x00,0x0C,0xC0,0xDF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0xA0,0xFF,0x05,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x80,0x3C,0x01,0x30,0x00,0x38,0x00,0x84,0x00,0xE0,0x00,0x0C,0x00,0x42,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Nuclear.png'), 'width': 35, 'height': 25, 'alt': 'Nuclear' }, 'Nuclear,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x78,0x00,0xE0,0x00,0x0C,0x00,0x3C,0x00,0x30,0x00,0x38,0x00,0xCF,0x03,0xE0,0x00,0x0C,0x80,0xE7,0x01,0x30,0x00,0x38,0xC0,0x01,0x0C,0xE0,0x00,0x0C,0xE0,0x00,0x06,0x30,0x00,0x38,0x60,0x00,0x10,0xE0,0x00,0x0C,0x30,0x00,0x08,0x30,0x00,0x38,0xB0,0x01,0x24,0xE0,0x00,0x0C,0xD8,0x00,0x12,0x30,0x00,0x38,0xD8,0x01,0x4E,0xE0,0x00,0x0C,0xEC,0x00,0x27,0x30,0x00,0x38,0xC8,0x03,0xDF,0xE0,0x00,0x0C,0xE4,0x81,0x6F,0x30,0x00,0x38,0xEC,0x07,0xBF,0xE0,0x00,0x0C,0xF6,0x83,0x5F,0x30,0x00,0x38,0xF4,0x87,0xBF,0xE1,0x00,0x0C,0xFA,0xC3,0xDF,0x30,0x00,0x38,0xF4,0x87,0x3F,0xE1,0x00,0x0C,0xFA,0xC3,0x9F,0x30,0x00,0x38,0xF6,0x27,0x7F,0xE1,0x00,0x0C,0xFB,0x93,0xBF,0x30,0x00,0x38,0xF2,0x73,0x7F,0xE1,0x00,0x0C,0xF9,0xB9,0xBF,0x30,0x00,0x38,0x02,0x78,0x00,0xE1,0x00,0x0C,0x01,0x3C,0x80,0x30,0x00,0x38,0x02,0x30,0x00,0xE1,0x00,0x0C,0x01,0x18,0x80,0x30,0x00,0x38,0x04,0x00,0x00,0xE1,0x00,0x0C,0x02,0x00,0x80,0x30,0x00,0x38,0x04,0x70,0x00,0xE1,0x00,0x0C,0x02,0x38,0x80,0x30,0x00,0x38,0x04,0xF8,0x80,0xE1,0x00,0x0C,0x02,0x7C,0xC0,0x30,0x00,0x38,0x08,0xFC,0x80,0xE0,0x00,0x0C,0x04,0x7E,0x40,0x30,0x00,0x38,0x18,0xFC,0x41,0xE0,0x00,0x0C,0x0C,0xFE,0x20,0x30,0x00,0x38,0x10,0xFE,0x61,0xE0,0x00,0x0C,0x08,0xFF,0x30,0x30,0x00,0x38,0x20,0xFE,0x33,0xE0,0x00,0x0C,0x10,0xFF,0x19,0x30,0x00,0x38,0xC0,0x78,0x18,0xE0,0x00,0x0C,0x60,0x3C,0x0C,0x30,0x00,0x38,0x80,0x03,0x06,0xE0,0x00,0x0C,0xC0,0x01,0x03,0x30,0x00,0x38,0x00,0xFE,0x01,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Pinch left.png'), 'width': 35, 'height': 25, 'alt': 'Pinch_left' }, 'Pinch_left,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xB8,0xFE,0xBD,0x00,0xE0,0x00,0x5C,0x7F,0x3F,0x00,0x38,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFC,0x1F,0x00,0xE0,0x00,0x4C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFD,0x5F,0x00,0xE0,0x00,0x0C,0xFE,0x07,0x00,0x30,0x00,0x38,0xF8,0x0F,0x00,0xE0,0x00,0x0C,0xFE,0x17,0x00,0x30,0x00,0x38,0xF0,0x07,0x00,0xE0,0x00,0x0C,0xFD,0x0B,0x00,0x30,0x00,0x38,0xC0,0x01,0x00,0xE0,0x00,0x0C,0xF0,0x00,0x00,0x30,0x00,0x38,0x18,0x06,0x00,0xE0,0x00,0x0C,0x0C,0x03,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Pinch middle.png'), 'width': 35, 'height': 25, 'alt': 'Pinch_middle' }, 'Pinch_middle,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0xA0,0x7F,0x2F,0xE0,0x00,0x1C,0xD0,0xDF,0x0F,0x38,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x80,0xFF,0x05,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x40,0xFF,0x02,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x3C,0x00,0x30,0x00,0x38,0x00,0x86,0x01,0xE0,0x00,0x0C,0x00,0xC3,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Pinch right.png'), 'width': 35, 'height': 25, 'alt': 'Pinch_right' }, 'Pinch_right,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0xE8,0xDF,0xEB,0x00,0x1C,0x00,0xF4,0xF7,0x3A,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x30,0x00,0x38,0x00,0xC0,0xFF,0xE1,0x00,0x0C,0x00,0xF0,0xFF,0x32,0x00,0x38,0x00,0xD0,0xFF,0xE5,0x00,0x0C,0x00,0xE0,0x7F,0x30,0x00,0x38,0x00,0x80,0xFF,0xE0,0x00,0x0C,0x00,0xE0,0x7F,0x31,0x00,0x38,0x00,0x00,0x7F,0xE0,0x00,0x0C,0x00,0xD0,0xBF,0x30,0x00,0x38,0x00,0x00,0x1C,0xE0,0x00,0x0C,0x00,0x00,0x0F,0x30,0x00,0x38,0x00,0x80,0xC2,0xE0,0x00,0x0C,0x00,0xC0,0x30,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Tear.png'), 'width': 35, 'height': 25, 'alt': 'Tear' }, 'Tear,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0xF0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0xFD,0x05,0xE0,0x00,0x1C,0x40,0x7F,0x02,0x38,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x0C,0xA0,0xBF,0x05,0x30,0x00,0x38,0x40,0x7F,0x16,0xE0,0x00,0x0C,0xC0,0x9F,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x04,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x04,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x04,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x0C,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x0E,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x0E,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x1F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x80,0x3F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x80,0x6F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xC0,0x5F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xC0,0x7F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0xC0,0x7F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x80,0x7F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x3F,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x0E,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Tired left.png'), 'width': 35, 'height': 25, 'alt': 'Tired_left' }, 'Tired_left,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0xFD,0x5D,0x00,0xE0,0x00,0x5C,0x7F,0x2E,0x00,0x38,0x00,0x38,0xFE,0x1F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xFE,0x3F,0x00,0xE0,0x00,0x4C,0xFF,0x2F,0x00,0x30,0x00,0x38,0xFD,0x5F,0x00,0xE0,0x00,0x0C,0xFF,0x0F,0x00,0x30,0x00,0x38,0xF8,0x1F,0x00,0xE0,0x00,0x9C,0xFE,0x17,0x00,0x38,0x00,0x70,0xFA,0x2F,0x00,0x70,0x00,0x1C,0xFC,0x03,0x00,0x38,0x00,0x70,0xE0,0x03,0x00,0x70,0x00,0x3C,0xF8,0x01,0x00,0x3C,0x00,0xF0,0x08,0x08,0x00,0x78,0x00,0x38,0x04,0x02,0x00,0x1C,0x00,0xE0,0xA1,0x02,0x00,0x3C,0x00,0x78,0xA0,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Tired middle.png'), 'width': 35, 'height': 25, 'alt': 'Tired_middle' }, 'Tired_middle,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x1C,0xD0,0xDF,0x0B,0x38,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x1C,0xA0,0xFF,0x05,0x38,0x00,0x70,0x00,0xFC,0x01,0x70,0x00,0x1C,0x00,0xFF,0x00,0x38,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x3C,0x80,0x3C,0x01,0x3C,0x00,0xF0,0x00,0x84,0x00,0x78,0x00,0x38,0x00,0x42,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Tired right.png'), 'width': 35, 'height': 25, 'alt': 'Tired_right' }, 'Tired_right,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0xD0,0xDF,0xE5,0x00,0x1C,0x00,0xF4,0xE7,0x3A,0x00,0x38,0x00,0xE0,0xFF,0xE1,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0xE0,0xFF,0xE3,0x00,0x0C,0x00,0xF4,0xFF,0x32,0x00,0x38,0x00,0xD0,0xFF,0xE5,0x00,0x0C,0x00,0xF0,0xFF,0x30,0x00,0x38,0x00,0x80,0xFF,0xE1,0x00,0x1C,0x00,0xE8,0x7F,0x39,0x00,0x70,0x00,0xA0,0xFF,0x72,0x00,0x1C,0x00,0xC0,0x3F,0x38,0x00,0x70,0x00,0x00,0x3E,0x70,0x00,0x3C,0x00,0x80,0x1F,0x3C,0x00,0xF0,0x00,0x80,0x80,0x78,0x00,0x38,0x00,0x40,0x20,0x1C,0x00,0xE0,0x01,0x00,0x14,0x3C,0x00,0x78,0x00,0x00,0x0A,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Toxic.png'), 'width': 35, 'height': 25, 'alt': 'Toxic' }, 'Toxic,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x1C,0x00,0x30,0x00,0x38,0x00,0xFE,0x02,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x80,0xFF,0x00,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x01,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0x23,0x0E,0xE0,0x00,0x0C,0xC0,0x18,0x03,0x30,0x00,0x38,0x80,0x23,0x0E,0xE0,0x00,0x0C,0xC0,0x10,0x03,0x30,0x00,0x38,0x00,0x73,0x06,0xE0,0x00,0x0C,0xC0,0x99,0x03,0x30,0x00,0x38,0x00,0x9F,0x07,0xE0,0x00,0x0C,0x80,0xE7,0x01,0x30,0x00,0x38,0x00,0x9E,0x03,0xE0,0x00,0x0C,0x00,0xE7,0x00,0x30,0x00,0x38,0x20,0xF8,0x40,0xE0,0x00,0x0C,0x18,0x7C,0x30,0x30,0x00,0x38,0xF0,0x51,0x78,0xE0,0x00,0x0C,0xFC,0x08,0x3C,0x30,0x00,0x38,0x30,0x0F,0xCF,0xE0,0x00,0x0C,0xCC,0x87,0x37,0x30,0x00,0x38,0x00,0x7C,0x02,0xE0,0x00,0x0C,0x00,0x3E,0x00,0x30,0x00,0x38,0xB0,0xC7,0x67,0xE0,0x00,0x0C,0xD8,0xF3,0x13,0x30,0x00,0x38,0xF0,0x03,0x7F,0xE0,0x00,0x0C,0xF8,0x81,0x3F,0x30,0x00,0x38,0x60,0x00,0x70,0xE0,0x00,0x0C,0x30,0x00,0x1C,0x30,0x00,0x38,0x60,0x00,0x30,0xE0,0x00,0x0C,0x10,0x00,0x18,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Up.png'), 'width': 35, 'height': 25, 'alt': 'Up' }, 'Up,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x84,0x00,0x38,0x00,0x78,0x00,0x41,0x00,0x1E,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x38,0x00,0x38,0x01,0x1C,0x00,0x70,0x00,0xFC,0x01,0x70,0x00,0x1C,0x00,0x7F,0x00,0x38,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x1C,0xA0,0xFF,0x05,0x38,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x1C,0x80,0x3F,0x01,0x38,0x00,0x38,0x40,0x7F,0x17,0xE0,0x00,0x0C,0xC0,0xDF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0x0C,0xD0,0xFF,0x0B,0x30,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0xC0,0xFF,0x03,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0x80,0xFF,0x01,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0xA0,0xFF,0x05,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0xFF,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x80,0x3C,0x01,0x30,0x00,0x38,0x00,0x84,0x00,0xE0,0x00,0x0C,0x00,0x42,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Eyes/Winking.png'), 'width': 35, 'height': 25, 'alt': 'Winking' }, 'Winking,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x84,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x7F,0x06,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x40,0x7F,0x17,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x80,0xFF,0x0F,0xE0,0x00,0xFC,0xFF,0xFF,0xFF,0x3F,0x00,0x38,0x00,0xFF,0x07,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x40,0xFF,0x17,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0xFE,0x03,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x70,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x84,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x3C,0x00,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Big smile.png'), 'width': 35, 'height': 25, 'alt': 'Big_smile' }, 'Big_smile,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x3F,0x00,0xF8,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x00,0x10,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Heart large.png'), 'width': 35, 'height': 25, 'alt': 'Heart_large' }, 'Heart_large,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x03,0x00,0x00,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xF8,0xBF,0x07,0x00,0xC0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0xFC,0x3F,0x1C,0x00,0xF0,0xFF,0xE1,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x71,0x00,0xF8,0xFF,0xC3,0x01,0x00,0x00,0x00,0x00,0xFF,0xFF,0xE7,0x00,0xFC,0xFF,0x8F,0x03,0x00,0x00,0x00,0x80,0xFF,0xFF,0xCF,0x01,0xFE,0xFF,0x3F,0x07,0x00,0x00,0x00,0xC0,0xFF,0xFF,0x9F,0x03,0xFF,0xFF,0x7F,0x06,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x3F,0x83,0xFF,0xFF,0xFF,0x0C,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x7F,0x87,0xFF,0xFF,0xFF,0x1D,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xC6,0xFF,0xFF,0xFF,0x19,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xEF,0xFF,0xFF,0xFF,0x33,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x37,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x37,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x6F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Heart small.png'), 'width': 35, 'height': 25, 'alt': 'Heart_small' }, 'Heart_small,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0x00,0xF0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x67,0x00,0xFC,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xC7,0x00,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x9F,0x01,0xFF,0x8F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x3F,0x83,0xFF,0x1F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x7F,0xC6,0xFF,0x3F,0x03,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xCE,0xFF,0xFF,0x02,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xEF,0xFF,0xFF,0x06,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x05,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0D,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Mouth 1 open.png'), 'width': 35, 'height': 25, 'alt': 'Mouth_1_open' }, 'Mouth_1_open,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0xFC,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x04,0x60,0x00,0xF8,0xFF,0xFF,0xFF,0x3F,0x00,0x18,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x38,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x04,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x04,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x0C,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x38,0x40,0x00,0x0C,0x78,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x38,0x60,0x00,0x18,0x7C,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0x78,0x70,0x00,0xF8,0xEF,0x00,0x1E,0x00,0x38,0x00,0xF0,0x00,0xCC,0x3F,0x00,0xE4,0xD7,0xC3,0x37,0x00,0x38,0x00,0xD8,0x07,0x87,0x1F,0x00,0x08,0xA8,0xFF,0x71,0x00,0x38,0x00,0x1C,0xFF,0x23,0x40,0x00,0xA8,0x2A,0x00,0xE4,0x03,0xEF,0x81,0x2F,0x00,0xA8,0x2A,0x00,0x54,0x55,0x55,0x95,0xFF,0xC7,0xFF,0x53,0x55,0x55,0x55,0x00,0x28,0x55,0x55,0x15,0x00,0x28,0x00,0xA8,0xAA,0xAA,0x2A,0x00,0xD4,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x2A,0x55,0x55,0x00,0x28,0x55,0xAD,0xAA,0xAA,0x56,0x55,0x55,0xD5,0xAA,0x2A,0x00,0xD4,0xAA,0x52,0x55,0x55,0xA9,0xAA,0xAA,0x2A,0x55,0x55,0x00,0x28,0x55,0xAD,0xAA,0xAA,0x56,0x55,0x55,0xD5,0xAA,0x2A,0x00,0xD4,0xAA,0x52,0x55,0x55,0xA9,0xAA,0xAA,0x2A,0x55,0x55,0x00,0x28,0x55,0xAD,0xAA,0xAA,0x56,0x55,0x55,0xD5,0xAA,0x2A,0x00,0xD4,0xAA,0x52,0x55,0x55,0xA9,0xAA,0xAA,0x2A,0x55,0x55,0x00,0x28,0x55,0xAD,0xAA,0xAA,0x56,0x55,0x55,0xD5,0xAA,0x2A,0x00,0xD4,0xAA,0x52,0x55,0x55,0xA9,0xAA,0xAA,0x2A,0x55,0x55,0x00,0x28,0x55,0xAD,0xAA,0xAA,0x56,0x55,0x55,0xD5,0xAA,0x52,0x00,0xE8,0x55,0x51,0x55,0x55,0xA9,0xAA,0xAA,0x2A,0xAA,0x2E,0x00,0x0C,0x54,0xAF,0xAA,0xAA,0x56,0x55,0xAB,0xEA,0xAB,0x50,0x00,0xF0,0x57,0xA0,0xAA,0x54,0xA9,0xAA,0x54,0x15,0xA8,0x5F,0x00,0x04,0xD8,0x5F,0x55,0xAB,0x56,0x55,0x53,0xF5,0x2F,0x40,0x00,0xF0,0x27,0x40,0xAD,0x54,0xA9,0xAA,0xAC,0x0A,0xA0,0x3F,0x00,0x18,0xEE,0x7F,0x51,0xAB,0x56,0x55,0x53,0xFA,0xDF,0x71,0x00,0x0C,0x0C,0x00,0xDF,0x54,0x51,0xA5,0xDC,0x03,0xC0,0x60,0x00,0x0C,0xD8,0x7F,0x00,0x6B,0xDF,0x5D,0x03,0xF8,0x6F,0x40,0x00,0x0C,0xF8,0xE0,0xFC,0x08,0x20,0xC0,0xF8,0x1C,0x7C,0x40,0x00,0x0C,0x30,0x80,0xFF,0xF3,0x87,0x1F,0xFF,0x07,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0xFF,0xFF,0xFF,0x03,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x0E,0x78,0xC0,0x01,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0xE1,0xFF,0xFF,0xFF,0x1F,0x06,0x30,0x40,0x00,0x0C,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x40,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xFC,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Mouth 1 shut.png'), 'width': 35, 'height': 25, 'alt': 'Mouth_1_shut' }, 'Mouth_1_shut,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0xFC,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x00,0x00,0x04,0x60,0x00,0xF8,0xFF,0xFF,0xFF,0x3F,0x00,0x18,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x38,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x00,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x00,0x00,0x04,0x20,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x04,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x04,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x18,0x40,0x00,0x0C,0x30,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x38,0x40,0x00,0x0C,0x38,0x00,0x18,0x00,0x10,0x00,0x30,0x00,0x38,0x60,0x00,0x18,0x7C,0x00,0x1C,0x00,0x38,0x00,0x70,0x00,0x78,0x70,0x00,0xF8,0xEF,0x00,0x1E,0x00,0x38,0x00,0xF0,0x00,0xCC,0x3F,0x00,0xE0,0xC7,0xC3,0x37,0x00,0x38,0x00,0xD8,0x07,0x87,0x5F,0x00,0x04,0x90,0xFF,0x71,0x00,0x38,0x00,0x9C,0xFF,0x33,0x00,0x00,0xF0,0x17,0x00,0xE4,0x03,0xEF,0x81,0x4F,0x00,0x94,0x3F,0x00,0x18,0xEE,0x5F,0x95,0xFF,0xD7,0xFF,0xA3,0xFA,0xD7,0x71,0x00,0x0C,0x1C,0x00,0x6D,0x00,0x20,0x00,0xDC,0x02,0xC0,0x60,0x00,0x0C,0xD8,0x7F,0x01,0x55,0xAF,0x5D,0x01,0xFA,0x6F,0x40,0x00,0x0C,0xF8,0xE0,0xFC,0x08,0x50,0x40,0xF8,0x1D,0x7C,0x40,0x00,0x0C,0x30,0x80,0xFF,0xF3,0x87,0x1F,0xFF,0x07,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0xFF,0xEF,0xFF,0x03,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x0E,0x78,0xC0,0x01,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0x01,0x04,0x30,0x80,0x00,0x06,0x30,0x40,0x00,0x0C,0x30,0x80,0xE1,0xFF,0xFF,0xFF,0x1F,0x06,0x30,0x40,0x00,0x0C,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x40,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xFC,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x7F,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Mouth 2 open.png'), 'width': 35, 'height': 25, 'alt': 'Mouth_2_open' }, 'Mouth_2_open,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x01,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x1A,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x60,0x00,0x19,0x00,0xC3,0xF0,0xFF,0xFF,0xFF,0x1F,0xE3,0x03,0x30,0x01,0x1A,0x00,0xC7,0x80,0x01,0x3C,0xC0,0x00,0x63,0x03,0x30,0x01,0x1A,0x80,0xCD,0x41,0x01,0x26,0xC0,0x81,0x33,0x03,0xB8,0x00,0x35,0x80,0xDD,0x41,0x02,0x2A,0x20,0x81,0x1B,0x03,0x98,0x00,0x32,0x80,0xFA,0xA3,0x02,0x6B,0x30,0xC1,0x4E,0x02,0x5C,0x01,0x35,0xC0,0x34,0xB3,0x04,0x55,0x50,0x42,0xA0,0x02,0x4C,0x01,0x25,0xC0,0x4A,0x53,0x8D,0xD5,0x48,0x63,0x55,0x02,0xAE,0x00,0x6A,0x40,0xAA,0x9E,0x8A,0x94,0xA8,0xB2,0xAA,0x02,0xA6,0x00,0x6A,0x40,0x55,0xAD,0xD2,0xAA,0x54,0x92,0xAA,0x02,0x57,0x01,0x55,0x60,0x55,0x41,0x65,0xAA,0xA3,0xAE,0xAA,0x02,0x53,0x01,0xD5,0x60,0x55,0x51,0x85,0x2A,0xA9,0x52,0x55,0x82,0xA9,0x00,0xAA,0x60,0x55,0x55,0x55,0x55,0x54,0xA9,0xAA,0x82,0xA9,0x00,0x95,0x20,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xC2,0x54,0x01,0xAA,0xB1,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xE2,0xAA,0x00,0x2A,0xB1,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x62,0x55,0x01,0x55,0x33,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x33,0x55,0x01,0x55,0xB2,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x2A,0xBB,0xAA,0x00,0xAA,0xB6,0xAA,0xAA,0xAA,0x6A,0x55,0x55,0x55,0x9F,0xAA,0x00,0xAA,0x5C,0x55,0x55,0x55,0x95,0xAA,0xAA,0x2A,0x4F,0x55,0x01,0x55,0x9D,0xAA,0xAA,0xAA,0x6A,0x55,0x55,0x55,0xA7,0xAA,0x00,0x55,0x59,0x55,0x55,0x55,0x95,0xAA,0xAA,0xAA,0x57,0x55,0x01,0xAA,0xBA,0xAA,0xAA,0xAA,0x6A,0x55,0x55,0x55,0xA9,0xAA,0x00,0xAA,0x52,0x55,0x55,0x55,0x95,0xAA,0xAA,0x4A,0x54,0x55,0x01,0x55,0x8D,0xAA,0xAA,0xAA,0x6A,0x55,0x55,0xB5,0xAA,0xAA,0x00,0xAA,0x52,0x55,0x55,0x55,0x95,0xAA,0xAA,0x4A,0x55,0x55,0x01,0x55,0xAD,0xAA,0xAA,0xAA,0x6A,0x55,0x55,0xB5,0xAA,0xAA,0x00,0xAA,0x52,0x55,0x55,0x55,0x95,0x2A,0x55,0x45,0x55,0x55,0x01,0x55,0xAD,0xAA,0xAA,0xAA,0x6A,0xD5,0xAA,0x7A,0xA5,0xAA,0x00,0xAA,0x52,0x55,0x55,0x55,0x95,0x2A,0x55,0x85,0x5A,0x55,0x01,0x55,0xAD,0xA9,0xAA,0xAA,0x6A,0xD5,0xAA,0x2A,0xA5,0xAA,0x00,0xAA,0x52,0x56,0x55,0x55,0x95,0x2A,0x55,0xF5,0x5A,0x55,0x01,0x55,0x2D,0xA9,0xAA,0xAA,0x6A,0xD5,0xAA,0xEA,0xA5,0xAA,0x00,0xAA,0x92,0x55,0x55,0x55,0x95,0x2A,0x55,0x65,0x59,0x55,0x01,0x55,0xCD,0x55,0x55,0x55,0x69,0xD5,0xAA,0x6A,0xA2,0xAA,0x00,0xAA,0xE2,0xAD,0xAA,0xAA,0x96,0x2A,0x55,0x65,0x56,0x55,0x01,0x55,0xB5,0x51,0x55,0x55,0x69,0xD5,0xAA,0x6A,0xAC,0xAA,0x00,0xAA,0x1A,0xAD,0xAA,0xAA,0x96,0x2A,0x55,0x65,0x4C,0x55,0x01,0x55,0x0D,0x53,0x55,0x55,0xE9,0xEA,0xAA,0x6A,0x58,0x55,0x01,0xAA,0x0C,0xAB,0x52,0x55,0x16,0x15,0xAA,0x6A,0x90,0xAA,0x00,0xD5,0x06,0x53,0x4D,0xAD,0xC9,0xAA,0xA9,0x6A,0xB0,0xAA,0x00,0x2A,0x06,0xAA,0xB2,0xD2,0xA5,0xAD,0x53,0x65,0x60,0x55,0x01,0x55,0x03,0xEA,0x32,0x4D,0x2B,0xB1,0xAC,0x6A,0x60,0xAA,0x00,0x2A,0x03,0x16,0x59,0x23,0x32,0xCA,0x48,0x6B,0xC0,0x56,0x01,0xB5,0x01,0x16,0x4C,0x14,0x16,0xB4,0x58,0x68,0xC0,0xA8,0x00,0x8A,0x01,0xC4,0x8E,0x1A,0x14,0xC4,0x30,0x6B,0x80,0x55,0x01,0xB5,0x01,0xE4,0x87,0x0A,0x1C,0x48,0xE0,0x67,0x80,0x55,0x01,0x8A,0x01,0x74,0x07,0x09,0x08,0x50,0xE0,0x6E,0x00,0xAB,0x00,0xD5,0x00,0x3C,0x07,0x04,0x08,0x70,0xC0,0x3C,0x00,0xAB,0x01,0xCA,0x00,0x1C,0x03,0x07,0x0C,0x30,0xC0,0x38,0x00,0x56,0x00,0xCD,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xB6,0x01,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x01,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x01,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Mouth 2 shut.png'), 'width': 35, 'height': 25, 'alt': 'Mouth_2_shut' }, 'Mouth_2_shut,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x01,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x1A,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x60,0x00,0x19,0x00,0xC3,0xF0,0xFF,0xFF,0xFF,0x1F,0xE3,0x03,0x30,0x01,0x1A,0x00,0xC7,0x80,0x01,0x3C,0xC0,0x00,0x63,0x03,0x30,0x01,0x1A,0x80,0xCD,0x41,0x01,0x26,0xC0,0x81,0x33,0x03,0xB8,0x00,0x35,0x80,0xDD,0x41,0x02,0x2A,0x20,0x81,0x1B,0x03,0x98,0x00,0x32,0x80,0xFA,0xA3,0x02,0x6B,0x30,0xC1,0x8E,0x02,0x5C,0x01,0x35,0xC0,0x34,0xB3,0x04,0x55,0x50,0x42,0x20,0x02,0x4C,0x01,0x25,0xC0,0x46,0x53,0x8D,0xD5,0x48,0x63,0xF5,0x02,0xAE,0x00,0x6A,0x40,0xA8,0x9E,0x8A,0x94,0xA8,0xB2,0xEA,0x02,0xA6,0x00,0x6A,0xC0,0x55,0xAD,0xD2,0xAA,0x54,0x92,0x6A,0x03,0x57,0x01,0x55,0x60,0x55,0x41,0x65,0xAA,0xA3,0xAE,0x6A,0x02,0x53,0x01,0xD5,0xE0,0xAD,0x52,0x85,0x2A,0xA9,0x52,0x65,0x82,0xA9,0x00,0xAA,0xE0,0x51,0x55,0x55,0x55,0x54,0xA9,0x6A,0x82,0xA9,0x00,0x95,0x20,0xAD,0xAA,0xAA,0xAA,0x2A,0x55,0x65,0xC2,0x54,0x01,0xAA,0x31,0x53,0x55,0x55,0xD5,0xEA,0xAA,0x6A,0xE2,0xAA,0x00,0x2A,0x31,0xAB,0x52,0x55,0x16,0x15,0xAA,0x6A,0x62,0x55,0x01,0x55,0x33,0x53,0x4D,0xAD,0xC9,0xAA,0xA9,0x6A,0x32,0xAA,0x00,0xAA,0x32,0xAA,0xB2,0xD2,0xA5,0xAD,0x53,0x65,0x3B,0x55,0x01,0x55,0x36,0xEA,0x32,0x4D,0x2B,0xB1,0xAC,0x6A,0x5F,0xAA,0x00,0x55,0x15,0x16,0x59,0x23,0x32,0xCA,0x48,0x6B,0xCF,0x56,0x01,0xAA,0x1D,0x16,0x4C,0x14,0x16,0xB4,0x58,0x68,0xC7,0xA8,0x00,0xAA,0x19,0xC4,0x8E,0x1A,0x14,0xC4,0x30,0x6B,0x87,0x55,0x01,0xB5,0x19,0xE4,0x87,0x0A,0x1C,0x48,0xE0,0x67,0x81,0x55,0x01,0x8A,0x11,0x74,0x07,0x09,0x08,0x50,0xE0,0x6E,0x00,0xAB,0x00,0xD5,0x00,0x3C,0x07,0x04,0x08,0x70,0xC0,0x3C,0x00,0xAB,0x01,0xCA,0x00,0x1C,0x03,0x07,0x0C,0x30,0xC0,0x38,0x00,0x56,0x00,0xCD,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0xB6,0x01,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x01,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x01,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Sad.png'), 'width': 35, 'height': 25, 'alt': 'Sad' }, 'Sad,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x83,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0xE0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Sick.png'), 'width': 35, 'height': 25, 'alt': 'Sick' }, 'Sick,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x0F,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x3F,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFC,0xE0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0xF0,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Smile.png'), 'width': 35, 'height': 25, 'alt': 'Smile' }, 'Smile,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x1F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0xE0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0xF8,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x83,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Swearing.png'), 'width': 35, 'height': 25, 'alt': 'Swearing' }, 'Swearing,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0xC0,0x00,0x00,0x1A,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x00,0xE0,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x60,0x28,0x00,0x00,0xC0,0x00,0x00,0x64,0x00,0x00,0x00,0x00,0x1F,0x64,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x28,0x00,0x00,0x00,0xC0,0x0B,0x00,0x00,0x00,0x00,0x08,0x00,0x04,0x00,0x00,0x00,0xF0,0x3F,0x00,0x00,0x00,0x00,0xC4,0x3F,0x04,0x00,0x00,0x00,0xF8,0x7F,0x00,0x40,0x03,0x00,0x76,0x60,0x00,0x18,0x00,0x00,0xFC,0x7F,0x00,0xC0,0x01,0x00,0x1A,0x40,0x00,0x18,0x00,0x00,0xFC,0xF7,0x00,0xE0,0x01,0x00,0xC9,0x41,0x40,0x08,0x00,0x00,0xFC,0xE3,0x00,0xC0,0x03,0x00,0x09,0x42,0x40,0x00,0x00,0x00,0xFC,0xC3,0x10,0x80,0x00,0x00,0x19,0x63,0xC0,0x00,0x00,0x00,0x3C,0x63,0x70,0x00,0x00,0x03,0xF1,0x31,0xF0,0x07,0x00,0x00,0x1C,0x7E,0x78,0x00,0xC0,0x03,0x01,0x18,0xFC,0x03,0x00,0x00,0x1C,0x72,0x2C,0x00,0xE0,0x03,0x03,0x0C,0xF0,0x03,0x00,0x00,0x38,0x33,0x06,0x00,0xF0,0x03,0x0E,0x07,0xB0,0x03,0x00,0x00,0xF0,0x7F,0xC3,0x01,0xF0,0x03,0xF8,0x01,0x10,0x07,0x00,0x00,0xE0,0x2F,0xE1,0x00,0xF0,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x80,0x02,0xFF,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xF0,0x01,0xF8,0xFE,0x01,0x00,0x00,0x00,0xFC,0x07,0x00,0x00,0xF0,0x01,0xFC,0xFF,0x03,0x00,0x00,0x00,0x38,0x0C,0x00,0x00,0xF0,0x01,0xFE,0xFF,0x07,0x00,0x00,0x00,0x18,0x06,0x00,0x00,0xF0,0x00,0xBE,0xFE,0xFF,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0xF8,0xC0,0xDF,0xFF,0xFF,0x03,0x00,0x00,0xE0,0x03,0x00,0x00,0xF8,0xE0,0xFF,0xFF,0xFF,0x07,0x00,0x00,0xE0,0x01,0x00,0x00,0x78,0xE0,0xFF,0xFF,0x3F,0x0F,0x00,0x00,0xC0,0x01,0x00,0x00,0x70,0xE0,0xFF,0xFF,0x7F,0x0F,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0xC0,0x00,0x08,0x80,0xFF,0xDF,0xFF,0x0F,0x00,0xF0,0x01,0x00,0xF0,0x03,0x1E,0x00,0xFF,0xFF,0xFF,0x1F,0x00,0x3C,0x07,0x00,0xF0,0x03,0x3C,0x00,0xC0,0xBF,0xFF,0x3F,0x00,0x04,0x0C,0x00,0xE0,0x01,0x1C,0x00,0x00,0xFF,0xFF,0x7F,0x00,0xE4,0x19,0x00,0xF0,0x01,0x18,0x3E,0x00,0xFE,0xFF,0x7F,0x00,0xB2,0x11,0x00,0x10,0x03,0x00,0xE3,0x00,0xFC,0xFF,0xEF,0x00,0x56,0x19,0x00,0x00,0x02,0x80,0x81,0x03,0xF4,0xFF,0xFF,0x00,0x34,0x09,0x00,0x04,0x00,0x80,0x00,0x02,0xE6,0xFF,0xEF,0x00,0x8C,0x09,0x30,0x02,0x00,0xC0,0x30,0x02,0x23,0xFE,0xFB,0x00,0xB8,0x08,0x00,0x20,0x30,0x40,0x10,0x03,0x11,0xFC,0xFF,0x00,0xE0,0x00,0x0C,0x04,0x30,0xC0,0x98,0x81,0x18,0xE4,0x7F,0x00,0x00,0x00,0x00,0x00,0x20,0x80,0x98,0x40,0x0C,0x27,0x7F,0x00,0x00,0x00,0x00,0x00,0x20,0x80,0x71,0x60,0x06,0x21,0x38,0x00,0x00,0x00,0x08,0x00,0x20,0x10,0x03,0x40,0x0C,0x31,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x02,0x80,0x8C,0x09,0x00,0x00,0x00,0x1C,0x40,0x18,0x40,0x10,0x06,0xC0,0xC4,0x04,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x10,0x00,0x40,0xC2,0x04,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0xD0,0x00,0x20,0xC1,0x0C,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x70,0x00,0x94,0xC1,0x0F,0x00,0x00,0x80,0x19,0x80,0xFF,0x00,0x70,0x00,0xDC,0x00,0x00,0x00,0x00,0x00,0x02,0xC0,0xFF,0x01,0x58,0x01,0x44,0x00,0x00,0x00,0x00,0x90,0x00,0xC0,0xFF,0x01,0xC0,0x00,0x44,0x00,0x00,0x00,0x00,0x30,0x18,0xC0,0xFF,0x03,0xC0,0x00,0x64,0x00,0x00,0x20,0x00,0x40,0x10,0xC0,0xFF,0x03,0xA0,0x00,0x1C,0x00,0x00,0x38,0x00,0x40,0x20,0xC0,0xFF,0x03,0xA0,0x00,0x00,0x00,0x00,0x70,0x00,0x80,0x54,0xC0,0xFF,0x01,0x80,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x04,0x80,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Talking.png'), 'width': 35, 'height': 25, 'alt': 'Talking' }, 'Talking,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x03,0x00,0x00,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0xF0,0x3F,0x00,0x00,0x00,0xE0,0x3F,0x00,0x00,0x00,0x00,0x00,0xFC,0x03,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0xF0,0x03,0x00,0x00,0x00,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0xC0,0x0F,0x00,0x00,0x00,0xE0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x01,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x80,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x07,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,0x00,0xC0,0x0F,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0xF0,0x07,0x00,0x00,0x00,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0x00,0x00,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x01,0x00,0x00,0xFC,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x0F,0x00,0xFC,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xC0,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0xE0,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8E,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/Wink.png'), 'width': 35, 'height': 25, 'alt': 'Wink' }, 'Wink,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x07,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x3F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x3F,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x00,0xF0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0xC0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x7E,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0x3F,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], + [{ 'src': require('../media/oled_icons/face/Expressions/ZZZ.png'), 'width': 35, 'height': 25, 'alt': 'ZZZ' }, 'ZZZ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x07,0x00,0x00,0x00,0x00,0x80,0x1F,0x00,0x00,0x00,0xC0,0xFF,0x03,0x00,0x00,0x00,0x00,0xFE,0x3A,0x00,0x00,0x00,0xE0,0xFF,0x01,0x00,0x00,0x00,0xE0,0xFF,0x3F,0x00,0x00,0x00,0xF0,0xFF,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,0xF0,0xFF,0x3F,0x00,0x00,0x00,0xFC,0x3F,0x00,0x00,0x00,0x00,0xE0,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0x0F,0x00,0x00,0x00,0xE0,0xFF,0x1F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x01,0x00,0x00,0xE0,0xEF,0x1F,0x00,0x00,0x00,0xFE,0xFF,0xBF,0x01,0x00,0x00,0x20,0xE0,0x0F,0x00,0x00,0x00,0xFE,0xFF,0x7F,0x81,0xFF,0x3F,0x00,0xF0,0x07,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x81,0xFF,0x6F,0x00,0xF8,0x07,0x00,0x00,0x00,0xFE,0xFF,0x7F,0x81,0xFF,0x5F,0x00,0xF8,0x03,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x81,0xFF,0x7F,0x00,0xFC,0x03,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x81,0xFF,0x3F,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0xC0,0xFF,0x01,0xDF,0x3F,0x00,0xFE,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xC0,0x1F,0x00,0xFE,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x0F,0x00,0xFF,0xBE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x07,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x03,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0x80,0xFF,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x80,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x7F,0x80,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x80,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x87,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x8D,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xE0,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x1F,0x00,0x00,0x00,0xF0,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x03,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0x02,0x00,0x00,0xC0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x03,0x00,0x00,0xC0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x03,0x00,0x00,0xC0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00'], +]; + +//图标尺寸 +const ICON_SIZE = [ + ["8", "1"], + ["16", "2"], + ["32", "4"], + ["48", "6"], + ["64", "8"], +]; + +//显示-OLED-初始化(iic) +export const oled_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(new Blockly.FieldDropdown(OLED_TYPE), "OLED_TYPE") + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor) + .appendField(new Blockly.FieldDropdown(ROTATION_TYPE), "ROTATION") + .appendField(' SCL') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SCL") + .appendField('SDA') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SDA"); + this.appendValueInput("ADDRESS") + .appendField(Blockly.Msg.MIXLY_LCD_ADDRESS); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_INIT2_TOOLTIP); + this.setFieldValue(Profile.default.SCL[0][1], "SCL"); + this.setFieldValue(Profile.default.SDA[0][1], "SDA"); + } +}; + +export const u8g2_spi_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(new Blockly.FieldDropdown(U8G2_TYPE_SSD1306_NOKIA5110), "U8G2_TYPE_SPI") + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor) + .appendField(new Blockly.FieldDropdown(ROTATION_TYPE), "ROTATION"); + this.appendDummyInput() + .appendField('CLK') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "CLK") + .appendField('MOSI') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "MOSI"); + this.appendDummyInput() + .appendField('CS') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "CS") + .appendField('DC') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DC") + .appendField('RST') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "RST"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip( + "CLK - SCL(SSD1306) - CLK(NOKIA5110)\n" + + "MOSI - SDA(SSD1306) - DIN(NOKIA5110)" + ); + this.setHelpUrl(""); + this.setFieldValue(Profile.default.SCK[0][1], "CLK"); + this.setFieldValue(Profile.default.MOSI[0][1], "MOSI"); + } +}; + +export const u8g2_LCD12864_spi_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + "LCD12864") + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor) + .appendField(new Blockly.FieldDropdown(ROTATION_TYPE), "ROTATION"); + this.appendValueInput("CLK") + .setCheck(Number) + .appendField("CLK"); + this.appendValueInput("MOSI") + .setCheck(Number) + .appendField("MOSI"); + this.appendDummyInput() + .appendField('RS') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DC"); + //.appendField(' RST'+Blockly.Msg.MIXLY_PIN) + //.appendField(new Blockly.FieldDropdown(Profile.default.digital), "RST"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip("PSB = 0"); + this.setHelpUrl(""); + } +}; + +export const u8g2_LCD12864_8080_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + "LCD12864") + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(" " + Blockly.Msg.MIXLY_MICROBIT_monitor) + .appendField(new Blockly.FieldDropdown(ROTATION_TYPE), "ROTATION"); + this.appendDummyInput() + .appendField('D0') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB0") + .appendField('D1') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB1") + .appendField('D2') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB2") + .appendField('D3') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB3") + .appendField('D4') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB4") + .appendField('D5') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB5") + .appendField('D6') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB6") + .appendField('D7') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DB7") + .appendField('E') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "ENABLE") + .appendField('RS') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DC"); + //.appendField(' RST'+Blockly.Msg.MIXLY_PIN) + //.appendField(new Blockly.FieldDropdown(Profile.default.digital), "RST"); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip("R/W = 0,PSB = 1"); + this.setHelpUrl(""); + } +}; + +//显示-OLED-清屏幕 +export const oled_clear = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_CLEAR); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(); + } +}; + +//显示-OLED-定义图像名称和数据 +export const oled_define_bitmap_data = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .appendField(new Blockly.FieldTextInput('bitmap1'), 'VAR') + .appendField(Blockly.Msg.OLED_BITMAP_DATA) + .appendField(new Blockly.FieldTextInput(''), 'TEXT'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DEF_BMP_DATA_TOOLTIP); + } +}; + +//显示-OLED-设置图标 +export const oled_icons = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_BITMAP); + this.appendValueInput("POS_X") + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y") + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER) + .appendField(new Blockly.FieldDropdown(ICON_SIZE), "ICON_SIZE") + .appendField("px"); + this.appendDummyInput() + .appendField(Blockly.Msg.OLED_ICON) + .appendField(new Blockly.FieldDropdown(ICON_IMAGE), 'ICON_IMAGE'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-设置图标(表情) +export const oled_face = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_BITMAP); + this.appendValueInput("POS_X") + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y") + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendDummyInput() + .appendField(Blockly.Msg.OLED_ICON) + .appendField(new Blockly.FieldDropdown(FACE_IMAGE), 'FACE_IMAGE'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-显示图像 +export const oled_showBitmap = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_BITMAP); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.appendValueInput("bitmap_name", String) + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .setCheck(String); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_SHOW_BMP_TOOLTIP); + } +}; + +//显示-OLED-画点 +export const oled_drawPixel = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAWPIXEL); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_POSX) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_POSY) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DRAW_PIXE_TOOLTIP); + } +}; + +//显示-OLED-画线 +export const oled_drawLine = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAWLINE); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("END_X", Number) + .appendField(Blockly.Msg.OLED_END_X) + .setCheck(Number); + this.appendValueInput("END_Y", Number) + .appendField(Blockly.Msg.OLED_END_Y) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DRAW_LINE_TOOLTIP); + } +}; + +//显示-OLED-画直线 +export const oled_draw_Str_Line = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAWSTRLINE); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("LENGTH", Number) + .appendField(Blockly.Msg.OLED_LENGTH) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(LINESELECT), "TYPE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-新建页面 +export const oled_page = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_PAGE); + this.appendStatementInput('DO') + .appendField(''); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_page_tooltip); + } +}; + +//显示-OLED-画三角 +export const oled_drawTriangle = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAW_TRIANGLE); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_D0_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_D0_Y) + .setCheck(Number); + this.appendValueInput("D1_X", Number) + .appendField(Blockly.Msg.OLED_D1_X) + .setCheck(Number); + this.appendValueInput("D1_Y", Number) + .appendField(Blockly.Msg.OLED_D1_Y) + .setCheck(Number); + this.appendValueInput("D2_X", Number) + .appendField(Blockly.Msg.OLED_D2_X) + .setCheck(Number); + this.appendValueInput("D2_Y", Number) + .appendField(Blockly.Msg.OLED_D2_Y) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(""); + } +}; + +//显示-OLED-画长方形 +export const oled_drawFrame = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAW_RECTANGLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(FRAMESELECT), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_L_U_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_L_U_Y) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-画圆角矩形 +export const oled_drawRFrame = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAW_RAD_RECTANGLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(RADSELECT), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_L_U_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_L_U_Y) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.appendValueInput("RADIUS", Number) + .appendField(Blockly.Msg.OLED_RADIUS) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-画圆(空心,实心) +export const oled_drawCircle = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAW_CIRCLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(CIRCLESELECT), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_Y) + .setCheck(Number); + this.appendValueInput("RADIUS", Number) + .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(CIRCLEOPTELECT), "OPT"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-画椭圆(空心,实心) +export const oled_drawEllipse = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAW_ELLIPSE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(ELLIPSESELECT), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_Y) + .setCheck(Number); + this.appendValueInput("RADIUS_X", Number) + .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_X) + .setCheck(Number); + this.appendValueInput("RADIUS_Y", Number) + .appendField(Blockly.Msg.OLED_ELLIPSE_RADIUS_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(CIRCLEOPTELECT), "OPT"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DRAW_ELLIPSE_TOOLTIP); + } +}; + +//显示-OLED-显示字符串 +export const oled_drawStr = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_DRAWSTR); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("TEXT", String) + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([Number, String]); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-设置字体 +export const oled_set_EN_Font = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.set_EN_Font) + .appendField(new Blockly.FieldDropdown(EN_FONT_NAME), "FONT_NAME"); + this.appendDummyInput("") + .appendField(Blockly.Msg.FontSize) + .appendField(new Blockly.FieldDropdown(EN_FONT_SIZE), "FONT_SIZE"); + this.appendDummyInput("") + .appendField(Blockly.Msg.Font_Style) + .appendField(new Blockly.FieldDropdown(EN_FONT_STYLE), "FONT_STYLE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-设置字体 +export const oled_set_CN_Font = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.set_CN_Font) + .appendField(new Blockly.FieldDropdown(CN_FONT_NAME), "FONT_NAME"); + this.appendDummyInput("") + .appendField(Blockly.Msg.FontSize) + .appendField(new Blockly.FieldDropdown(CN_FONT_SIZE), "FONT_SIZE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-设置字体 +export const oled_set_ZH_TW_Font = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.set_ZH_TW_Font); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-显示字符串 +export const oled_print = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.OLED_PRINT_VAR); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("TEXT", String) + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([Number, String]); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_print_tooltip); + } +}; + +//OLED背光亮度 +export const u8g2_setContrast = { + init: function () { + this.appendValueInput("Contrast") + .setCheck(null) + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(Blockly.Msg.TFT_Brightness + Blockly.Msg.MIXLY_BRIGHTNESS); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(DISPLAY_HUE); + this.setTooltip(Blockly.Msg.MIXLY_U8G2_SETCONTRAST_HELP); + this.setHelpUrl(""); + } +}; + +//返回UTF8字符串宽度 +export const get_utf8_width = { + init: function () { + this.appendValueInput("str") + .setCheck(null) + .appendField(Blockly.Msg.DISPLAY) + .appendField(new Blockly.FieldTextInput("u8g2"), "NAME") + .appendField(' ' + Blockly.Msg.OLED_DRAWSTR + Blockly.Msg.MIXLY_WIDTH); + this.setOutput(true, null); + this.setColour(DISPLAY_HUE); + this.setTooltip(""); + this.setHelpUrl("https://www.cnblogs.com/danpianjicainiao/p/11048729.html#_label3_1_39"); + } +}; + +//LCD自定义图案显示 +export const lcd_display_pattern = { + init: function () { + this.appendValueInput("row") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_DF_LCD) + .appendField(new Blockly.FieldTextInput("mylcd"), "name") + .appendField(Blockly.Msg.MIXLY_LCD_ROW); + this.appendValueInput("column") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_LCD_COLUMN); + this.appendValueInput("pattern") + .setCheck(null) + .appendField(Blockly.Msg.COLUMN_DISPLAY_IMAGE); + this.appendDummyInput() + .appendField(Blockly.Msg.LCD_NUMBERING) + .appendField(new Blockly.FieldDropdown(lcd_display_pattern.NUMBER), "number"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(DISPLAY_HUE); + this.setTooltip(""); + this.setHelpUrl("https://www.arduino.cc/en/Reference/LiquidCrystalCreateChar"); + }, + NUMBER: [ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"] + ] +}; + +//点阵屏显示_图案数组 +export const lcd_pattern = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR) + .appendField(new Blockly.FieldTextInput("lcd"), "VAR"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a81") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a82") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a83") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a84") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a85"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a71") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a72") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a73") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a74") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a75"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a61") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a62") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a63") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a64") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a65"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a51") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a52") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a53") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a54") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a55"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a41") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a42") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a43") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a44") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a45"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a31") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a32") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a33") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a34") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a35"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a21") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a22") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a23") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a24") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a25"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a11") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a12") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a13") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a14") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a15"); + this.setOutput(true, Number); + this.setTooltip(""); + } +}; + +export const display_lcd_bitmap = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR) + .appendField(new Blockly.FieldTextInput("lcd"), "VAR"); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldBitmap([ + [0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [1, 0, 0, 0, 1], + [1, 0, 1, 0, 1], + [1, 0, 1, 0, 1], + [1, 0, 0, 0, 1], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0] + ], null, { + filledColor: '#000', + emptyColor: '#5ba5a5', + bgColor: '#e5e7f1' + }), 'BITMAP'); + this.setOutput(true, Number); + this.setTooltip(""); + } +}; + +export const TFT_init_with_pin = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SETUP + " TFT " + Blockly.Msg.DISPLAY); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_STM32_TFT_GREENTAB + "(ST7735)", "ST7735_INITR_GREENTAB"], + [Blockly.Msg.MIXLY_STM32_TFT_REDTAB + "(ST7735)", "ST7735_INITR_REDTAB"], + [Blockly.Msg.MIXLY_STM32_TFT_BLACKTAB + "(ST7735)", "ST7735_INITR_BLACKTAB"], + ["160×80(ST7735)", "ST7735_160×80"], + ["160×128(ST7789)", "ST7789_160×128"], + ["240×135(ST7789)", "ST7789_240×135"], + ["240×240(ST7789)", "ST7789_240×240"], + ["320×240(ST7789)", "ST7789_320×240"], + ["480×320(ST7796)", "ST7796_480×320"] + ]), "TYPE"); + //.appendField(" "+Blockly.Msg.MIXLY_MICROBIT_monitor) + //.appendField(new Blockly.FieldDropdown(ROTATION_TYPE), "ROTATION"); + this.appendValueInput("CLK") + .setCheck(Number) + .appendField("CLK"); + this.appendValueInput("MOSI") + .setCheck(Number) + .appendField("MOSI"); + this.appendDummyInput() + .appendField('CS') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "CS") + .appendField('DC') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DC") + .appendField('RST') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "RST"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +//显示汉字(使用位图显示) +export const TFT_st7735_show_hz = { + init: function () { + this.appendDummyInput() + .appendField("TFT") + .appendField(Blockly.Msg.TFT_DISPLAY_CHINESE_CHARACTERS); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NAME) + .appendField(new Blockly.FieldDropdown([ + ["华文黑体", "STHeiti"], + ["华文楷体", "STKaiti"], + ["华文细黑", "STXihei"], + ["华文宋体", "STSong"], + ["华文中宋", "STZhongsong"], + ["华文仿宋", "STFangsong"], + ["华文彩云", "STCaiyun"], + ["华文琥珀", "STHupo"], + ["华文隶书", "STLiti"], + ["华文行楷", "STXingkai"], + ["华文新魏", "STXinwei"], + ["黑体", "simHei"], + ["宋体", "simSun"], + ["新宋体", "NSimSun"], + ["仿宋", "FangSong"], + ["楷体", "KaiTi"], + ["仿宋_GB2312", "FangSong_GB2312"], + ["楷体_GB2312", "KaiTi_GB2312"], + ["隶书", "LiSu"], + ["幼圆", "YouYuan"], + ["新细明体", "PMingLiU"], + ["细明体", "MingLiU"], + ["标楷体", "DFKai-SB"], + ["微软正黑体", "Microsoft JhengHei"], + ["微软雅黑体", "Microsoft YaHei"], + ["AcadEref", "AcadEref"], + ["Adobe Ming Std L", "Adobe Ming Std L"], + ["Adobe Myungjo Std M", "Adobe Myungjo Std M"], + ["Adobe Pi Std", "Adobe Pi Std"], + ["AIGDT", "AIGDT"], + ["AIgerian", "AIgerian"], + ["AmdtSymbols", "AmdtSymbols"], + ["Arial", "Arial"], + ["Arial Rounded MT Bold", "Arial Rounded MT Bold"], + ["Arial Unicode MS", "Arial Unicode MS"], + ["BankGothic Lt BT", "BankGothic Lt BT"], + ["BankGothic Md BT", "BankGothic Md BT"], + ["Baskerville Old Face", "Baskerville Old Face"], + ["Bauhaus 93", "Bauhaus 93"], + ["Beranad MT Condensed", "Beranad MT Condensed"] + ]), "st7735_hz_sharp") + .appendField(" " + Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NUM) + .appendField(new Blockly.FieldTextInput("16"), "st7735_hz_line_height") + .appendField("px") + .appendField(Blockly.Msg.SAVETO + " flash") + .appendField(new Blockly.FieldCheckbox("true"), "st7735_show_hz_save"); + this.appendValueInput("st7735_hz_data") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_DATA + "#"); + this.appendValueInput("st7735_hz_x") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.OLED_L_U_X + "#"); + this.appendValueInput("st7735_hz_y") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.OLED_L_U_Y + "#"); + this.appendValueInput("st7735_hz_height") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_HEIGHT + "#"); + this.appendValueInput("st7735_hz_width") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_WIDTH + "#"); + this.appendValueInput("st7735_hz_color") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.blynk_iot_WidgetLED_COLOR); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(DISPLAY_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const TFT_Brightness = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput('BRIGHTNESS') + .setCheck(Number) + .appendField("TFT" + Blockly.Msg.TFT_Brightness + Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_INOUT_PWM_ANALOG_WRITE_SET_FREQ_TOOLTIP); + } +}; + +export const TFT_color_seclet = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldColour("33ccff"), "COLOR"); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.OLED_DRAW_PIXE_TOOLTIP); + } +}; + +export const TFT_color_rgb = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput("R") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_R); + this.appendValueInput("G") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_G); + this.appendValueInput("B") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_B); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(''); + } +}; + +export const TFT_init = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SETUP + " TFT " + Blockly.Msg.DISPLAY); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const TFT_fillScreen = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.MIXLY_BACKGROUND_COLOR); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const TFT_Rotation = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField('TFT'); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ROTATE) + .appendField(new Blockly.FieldDropdown(TFT_Rotation.ROTATION_TYPE), "Rotation_TYPE"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_Matrix_HK16T33_ROTATION); + }, + ROTATION_TYPE: [ + [Blockly.Msg.MIXLY_0DEGREE, "0"], + [Blockly.Msg.MIXLY_90DEGREE, "1"], + [Blockly.Msg.MIXLY_180DEGREE, "2"], + [Blockly.Msg.MIXLY_270DEGREE, "3"] + ] +}; + +//显示-TFT-定义字模名称和数据 +export const tft_define_bitmap_data = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .appendField(new Blockly.FieldTextInput('bitmap1'), 'VAR') + .appendField(Blockly.Msg.OLED_BITMAP_DATA) + .appendField(new Blockly.FieldTextInput(''), 'TEXT'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DEF_BMP_DATA_TOOLTIP); + } +}; + +export const tft_generate_bitmap_data = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/btn/setting.png'), 20, 20, "*", () => { + this.showSettingDialog(); + })) + .appendField("TFT") + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .appendField(new Blockly.FieldTextInput('bitmap1'), 'VAR') + .appendField(Blockly.Msg.OLED_BITMAP_DATA) + .appendField(new Blockly.FieldTextInput(''), 'TEXT'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DEF_BMP_DATA_TOOLTIP); + }, + showSettingDialog: function () { + this.userImgSize = { + width: 100, + height: 100 + }; + const renderStr = XML.render(XML.TEMPLATE_STR.READ_BITMAP_DIV, { + btn1Name: '加载', + btn2Name: '保存' + }); + this.canvas = $(''); + this.ctx = this.canvas[0].getContext('2d'); + this.ctx.textAlign = 'left'; + this.ctx.textBaseline = 'top'; + LayerExt.open({ + title: '图片取模工具', + id: 'read-bitmap-layer', + area: ['50%', '250px'], + max: ['500px', '250px'], + min: ['350px', '100px'], + content: renderStr, + borderRadius: '5px', + shade: LayerExt.SHADE_ALL, + success: (layero) => { + $('#read-bitmap-layer').css('overflow', 'hidden'); + this.addEvents(layero); + } + }) + }, + addEvents: function (layero) { + layero.find('button').click((event) => { + const mId = $(event.currentTarget).attr('m-id'); + switch (mId) { + case '0': + this.loadImg(layero); + break; + case '1': + this.writeJson(); + break; + } + }); + }, + loadImg: function (layero) { + MFile.openFile('.png,.jpg', 'url', (fileObj) => { + const { data } = fileObj; + const inputImg = new Image(); + inputImg.src = data; + inputImg.onload = () => { + $('#read-bitmap-div-input-img').empty(); + $('#read-bitmap-div-input-img').append(inputImg); + const imgSize = { + width: inputImg.naturalWidth, + height: inputImg.naturalHeight + }; + const userImgSize = this.getUserImgSize(layero); + const px = userImgSize.width / imgSize.width, + py = userImgSize.height / imgSize.height; + if (!isNaN(imgSize.width) && !isNaN(imgSize.height)) + if (py > px) + userImgSize.height = parseInt(px * imgSize.height); + else + userImgSize.width = parseInt(py * imgSize.width); + this.userImgSize = userImgSize; + this.imgSize = imgSize; + const outputImg = new Image(); + outputImg.height = userImgSize.height; + outputImg.width = userImgSize.width; + outputImg.src = data; + outputImg.onload = () => { + const canvas = $(''); + const ctx = canvas[0].getContext('2d'); + ctx.textAlign = 'left'; + ctx.textBaseline = 'top'; + const ratio = window.devicePixelRatio || 1; + this.canvas[0].width = outputImg.width; + this.canvas[0].height = outputImg.height; + this.ctx.width = outputImg.width; + this.ctx.height = outputImg.height; + canvas[0].width = outputImg.width * ratio; + canvas[0].height = outputImg.height * ratio; + ctx.width = outputImg.width * ratio; + ctx.height = outputImg.height * ratio; + this.ctx.drawImage(outputImg, 0, 0, outputImg.width, outputImg.height); + ctx.drawImage(outputImg, 0, 0, outputImg.width * ratio, outputImg.height * ratio); + $('#read-bitmap-div-output-img').empty(); + $('#read-bitmap-div-output-img').append(canvas); + } + const messageDom = $('#read-bitmap-div-message'); + const message = '输入尺寸:' + imgSize.width + '×' + imgSize.height + '  ' + + '输出尺寸:' + userImgSize.width + '×' + userImgSize.height; + messageDom.empty(); + messageDom.append(``); + } + }); + }, + writeJson: function () { + const { userImgSize = {} } = this; + const { width = 100, height = 100 } = userImgSize; + const { data } = this.ctx.getImageData(0, 0, width, height); + let pixelData = 0, bitmapStr = ''; + for (let i = 0; i < data.length; i++) { + const mark = (i + 1) % 4; + let hexData, addition = ''; + switch (mark) { + case 1: + pixelData = (data[i] >> 3) & 0x001F; + break; + case 2: + pixelData = (pixelData & 0x001F) << 6; + pixelData = pixelData | ((data[i] >> 2) & 0x003F); + break; + case 3: + pixelData = (pixelData & 0x07FF) << 5; + pixelData = pixelData | ((data[i] >> 3) & 0x001F); + break; + default: + hexData = pixelData.toString(16); + for (let j = 4; j > hexData.length; j--) { + addition += '0'; + } + hexData = addition + hexData; + bitmapStr += '0x' + hexData + (i === data.length - 1 ? '' : ','); + pixelData = 0; + } + if ((i + 1) % 400 === 0 && i !== data.length - 1) + bitmapStr += '\n '; + } + this.setFieldValue(bitmapStr, 'TEXT'); + this.setTooltip('图片尺寸(宽×高):' + width + '×' + height); + layer.msg('保存成功', { time: 1000 }); + }, + getUserImgSize: function (layero) { + const inputsDom = layero.find('input'); + const imgSize = { + width: 100, + height: 100 + }; + for (let i = 0; inputsDom[i]; i++) { + const inputDom = $(inputsDom[i]); + const mId = inputDom.attr('m-id'); + switch (mId) { + case '0': + imgSize.width = parseInt(inputDom.val()) ?? 100; + break; + case '1': + imgSize.height = parseInt(inputDom.val()) ?? 100; + break; + } + } + if (imgSize.width > 300) + imgSize.width = 300; + if (imgSize.height > 300) + imgSize.height = 300; + return imgSize; + } +}; + +//显示-TFT-显示位图(汉字) +export const tft_showBitmap = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_BITMAP); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_POSX) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_POSY) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.appendValueInput("bitmap_name", String) + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .setCheck(String); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_SHOW_BMP_TOOLTIP); + } +}; + +export const tft_drawPixel = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAWPIXEL); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_POSX) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_POSY) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DRAW_PIXE_TOOLTIP); + } +}; + +//显示-TFT-画线 +export const tft_drawLine = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAWLINE); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("END_X", Number) + .appendField(Blockly.Msg.OLED_END_X) + .setCheck(Number); + this.appendValueInput("END_Y", Number) + .appendField(Blockly.Msg.OLED_END_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.OLED_DRAW_LINE_TOOLTIP); + } +}; + +//显示-TFT-画直线 +export const tft_drawFastLine = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAWSTRLINE); + this.appendValueInput("START_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("START_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendValueInput("LENGTH", Number) + .appendField(Blockly.Msg.OLED_LENGTH) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(LINESELECT), "TYPE"); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +//显示-TFT-新建页面 +/* +export const oled_page = { + init: function() { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_PAGE); + this.appendStatementInput('DO') + .appendField(''); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_page_tooltip); +} +}; +*/ + +//显示-TFT-画三角 +export const tft_Triangle = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAW_TRIANGLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DRAWFIll), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_D0_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_D0_Y) + .setCheck(Number); + this.appendValueInput("D1_X", Number) + .appendField(Blockly.Msg.OLED_D1_X) + .setCheck(Number); + this.appendValueInput("D1_Y", Number) + .appendField(Blockly.Msg.OLED_D1_Y) + .setCheck(Number); + this.appendValueInput("D2_X", Number) + .appendField(Blockly.Msg.OLED_D2_X) + .setCheck(Number); + this.appendValueInput("D2_Y", Number) + .appendField(Blockly.Msg.OLED_D2_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(""); + } +}; + +//显示-TFT-画长方形 +export const tft_Rect = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAW_RECTANGLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DRAWFIll), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_L_U_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_L_U_Y) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-TFT-画圆角矩形 +export const tft_RoundRect = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAW_RAD_RECTANGLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DRAWFIll), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_L_U_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_L_U_Y) + .setCheck(Number); + this.appendValueInput("WIDTH", Number) + .appendField(Blockly.Msg.MIXLY_WIDTH) + .setCheck(Number); + this.appendValueInput("HEIGHT", Number) + .appendField(Blockly.Msg.MIXLY_HEIGHT) + .setCheck(Number); + this.appendValueInput("RADIUS", Number) + .appendField(Blockly.Msg.OLED_RADIUS) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +//显示-TFT-画圆(空心,实心) +export const tft_Circle = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_DRAW_CIRCLE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DRAWFIll), "TYPE"); + this.appendValueInput("D0_X", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_X) + .setCheck(Number); + this.appendValueInput("D0_Y", Number) + .appendField(Blockly.Msg.OLED_CENTER_CIRCLE_Y) + .setCheck(Number); + this.appendValueInput("RADIUS", Number) + .appendField(Blockly.Msg.OLED_CIRCLE_RADIUS) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(CIRCLEOPTELECT), "OPT"); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip("x(0~127),y(0~63)"); + } +}; + +//显示-OLED-设置字体 +export const tft_set_EN_Font = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT"); + this.appendDummyInput("") + .appendField(Blockly.Msg.set_EN_Font) + .appendField(new Blockly.FieldDropdown(EN_FONT_NAME), "FONT_NAME"); + this.appendDummyInput("") + .appendField(Blockly.Msg.FontSize) + .appendField(new Blockly.FieldDropdown(EN_FONT_SIZE), "FONT_SIZE"); + this.appendDummyInput("") + .appendField(Blockly.Msg.Font_Style) + .appendField(new Blockly.FieldDropdown(EN_FONT_STYLE), "FONT_STYLE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-OLED-设置字体 +export const tft_set_CN_Font = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT"); + this.appendDummyInput("") + .appendField(Blockly.Msg.set_CN_Font) + .appendField(new Blockly.FieldDropdown(CN_FONT_NAME), "FONT_NAME"); + this.appendDummyInput("") + .appendField(Blockly.Msg.FontSize) + .appendField(new Blockly.FieldDropdown(CN_FONT_SIZE), "FONT_SIZE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-TFT-设置图标 +export const tft_icons = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_BITMAP); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_NUMBER) + .appendField(new Blockly.FieldDropdown(ICON_SIZE), "ICON_SIZE") + .appendField("px"); + this.appendDummyInput() + .appendField(Blockly.Msg.OLED_ICON) + .appendField(new Blockly.FieldDropdown(ICON_IMAGE), 'ICON_IMAGE'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_setFont_tooltip); + } +}; + +//显示-TFT-显示字符串 +export const tft_print = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_PRINT_VAR); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.appendValueInput("TEXT", String) + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([Number, String]); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_print_tooltip); + } +}; + +//显示-TFT-显示字符串 +export const tft_print_refresh = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField("TFT") + .appendField(Blockly.Msg.OLED_PRINT_VAR); + this.appendValueInput("POS_X", Number) + .appendField(Blockly.Msg.OLED_START_X) + .setCheck(Number); + this.appendValueInput("POS_Y", Number) + .appendField(Blockly.Msg.OLED_START_Y) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.appendValueInput("TEXT", String) + .appendField(Blockly.Msg.OLED_STRING) + .setCheck([Number, String]); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.oled_print_tooltip); + } +}; + +export const group_lcd_init = group_lcd_init2; + +export const display_TM1637_init_32 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField('CLK') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "CLK") + .appendField('DIO') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DIO"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_TIP); + this.setHelpUrl(''); + // this.setFieldValue("2", "CLK"); + // this.setFieldValue("4", "DIO"); + } +}; + +export const display_TM1637_displyPrint_32 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendValueInput("VALUE") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.OLEDDISPLAY); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_DISPLAYSTRING_TIP1); + } +}; + +export const display_TM1637_displayTime_32 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_SHOW_FACE_TIME); + this.appendValueInput("hour") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_HOUR); + this.appendValueInput("minute") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MINUTE); + // .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_ON, "displayOn"], [Blockly.Msg.MIXLY_OFF, "displayOff"], [Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"]]), "STAT"); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_TM1637_Time_Point) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "(0x80 >> 1)"], + [Blockly.Msg.MIXLY_OFF, "(0x80 >> 2)"] + ]), "STAT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_DISPLAYTIME_TOOLTIP); + } +}; + +export const display_TM1637_Brightness_32 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SET_BRIGHTNESS); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_4DIGITDISPLAY_BRIGHTNESS_TOOLTIP); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOPTIP_4DIGITDISPLAY_TM1637_BRIGHTNESS); + } +}; + +export const display_TM1637_clearDisplay_32 = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_4DIGITDISPLAY + "TM1637") + .appendField(new Blockly.FieldTextInput("display"), "NAME") + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.MIXLY_LCD_STAT_CLEAR, "clear"]]), "STAT"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_4DIGITDISPLAY_TM1637_CLEARDISPLAY); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/ethernet.js b/mixly/boards/default_src/arduino_avr/blocks/ethernet.js new file mode 100644 index 00000000..2c2de02b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/ethernet.js @@ -0,0 +1,886 @@ +import * as Blockly from 'blockly/core'; + +const ETHERNET_HUE = 0; + +export const ethernet_init_begin = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_BEGIN) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ETHERNET, 'Ethernet'], + [Blockly.Msg.MIXLY_ETHERNET2, 'Ethernet2'] + ]), "Ethernet"); + this.appendValueInput('MAC') + .setCheck(Array) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_ETHERNET_MAC_ADDRESS); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_INIT); + } +}; + +export const ethernet_mac_address = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput('DE'), 'VAR1') + .appendField('-') + .appendField(new Blockly.FieldTextInput('AD'), 'VAR2') + .appendField('-') + .appendField(new Blockly.FieldTextInput('BE'), 'VAR3') + .appendField('-') + .appendField(new Blockly.FieldTextInput('EF'), 'VAR4') + .appendField('-') + .appendField(new Blockly.FieldTextInput('FE'), 'VAR5') + .appendField('-') + .appendField(new Blockly.FieldTextInput('ED'), 'VAR6'); + this.setOutput(true, Array); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_MACADDRESS); + } +}; + +export const ethernet_init_local_ip = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_LOCALIP); + this.setOutput(true, 'IPAddress'); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_LOCALIP); + } +}; + +export const ethernet_client_connect_server = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_CONNECT_SERVER) + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput('mixly.org'), 'SERVER') + .appendField(this.newQuote_(false)); + this.appendValueInput('PORT') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PORT); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CONNECT); + }, + newQuote_: function (open) { + if (open == this.RTL) { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg=='; + } else { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC'; + } + return new Blockly.FieldImage(file, 12, 12, '"'); + } +} + +export const ethernet_client_stop = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_STOP); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_STOP); + } +}; + +export const ethernet_client_connected = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_CONNECTED); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CONNECTED); + } +}; + +export const ethernet_client_available = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_AVAILABLE); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CLIENT_AVAILABLE); + } +}; + +export const ethernet_client_print = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendValueInput('TEXT') + .setCheck(String) + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PRINT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CLIENT_PRINT); + } +}; + +export const ethernet_client_println = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendValueInput('TEXT') + .setCheck(String) + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PRINTLN); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CLIENT_PRINTLN); + } +}; + +export const ethernet_client_read = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_READ); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_CLIENT_READ); + } +}; + +export const ethernet_client_get_request = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_GET_REQUEST); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_URL) + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput(''), 'URL') + .appendField(this.newQuote_(false)); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_SERVER) + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput(''), 'SERVER') + .appendField(this.newQuote_(false)); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_ETHERNET_GET_REQUEST); + }, + newQuote_: function (open) { + if (open == this.RTL) { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg=='; + } else { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC'; + } + return new Blockly.FieldImage(file, 12, 12, '"'); + } +}; + +export const NTP_server = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.NTP_SERVER); + this.appendValueInput("server_add") + .appendField(Blockly.Msg.blynk_SERVER_ADD) + .setCheck(String); + this.appendValueInput("timeZone") + .appendField(Blockly.Msg.MIXLY_TimeZone) + .setCheck(Number); + this.appendValueInput("Interval") + .appendField(Blockly.Msg.blynk_WidgetRTC_setSyncInterval) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//传感器-实时时钟块_获取时间 +export const NTP_server_get_time = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.NTP_server_get_time); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(NTP_server_get_time.NTP_TIME_TYPE), "TIME_TYPE"); + this.setInputsInline(true); + this.setOutput(true, Number); + }, + NTP_TIME_TYPE: [ + [Blockly.Msg.MIXLY_YEAR, "NTP.getDateYear()"], + [Blockly.Msg.MIXLY_MONTH, "NTP.getDateMonth()"], + [Blockly.Msg.MIXLY_DAY, "NTP.getDateDay()"], + [Blockly.Msg.MIXLY_HOUR, "NTP.getTimeHour24()"], + [Blockly.Msg.MIXLY_MINUTE, "NTP.getTimeMinute()"], + [Blockly.Msg.MIXLY_SECOND, "NTP.getTimeSecond()"], + [Blockly.Msg.MIXLY_WEEK, "NTP.getDateWeekday()"] + ] +}; + +export const MQTT_server = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.MQTT_SERVER); + this.appendValueInput("server_add") + .appendField(Blockly.Msg.MQTT_SERVER_ADD) + .setCheck(String); + this.appendValueInput("server_port") + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PORT) + .setCheck(Number); + this.appendValueInput("IOT_ID") + .appendField(Blockly.Msg.MIXLY_EMQX_USERNAME) + .setCheck(String); + this.appendValueInput("IOT_PWD", String) + .appendField(Blockly.Msg.HTML_PASSWORD) + .setCheck([String, Number]); + this.appendValueInput("Client_ID") + .appendField(Blockly.Msg.MQTT_Client_ID) + .setCheck(String); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +//WIFI信息 +export const WIFI_info = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.MIXLY_NETWORK_INIT); + this.appendValueInput("SSID") + .appendField(Blockly.Msg.HTML_NAME); + this.appendValueInput("PWD") + .appendField(Blockly.Msg.HTML_PASSWORD); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +export const network_connect = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ESP32_NETWORK_CONNECT); + this.appendValueInput('id') + .setCheck(String) + .appendField(Blockly.Msg.HTML_NAME); + this.appendValueInput('password') + .setCheck(String) + .appendField(Blockly.Msg.HTML_PASSWORD); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_NETWORK_CONNECT_TOOLTIP); + } +}; + +export const network_wifi_connect = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_NETWORK_WIFI_CONNECT); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_NETWORK_WIFI_CONNECT_TOOLTIP); + } +}; + +export const network_get_connect = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_DEVICE) + .appendField(new Blockly.FieldDropdown([["MAC", "MAC"], ["IP", "IP"]]), "mode") + .appendField(Blockly.Msg.MQTT_SERVER_ADD); + this.setOutput(true); + this.setInputsInline(true); + } +}; + +export const MQTT_connect = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MQTT_connect); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(); + } +}; + +const Topic_validator = function (newValue) { + return newValue.replace(/\//g, ''); +}; + +//MQTT-发送消息到topic +export const MQTT_publish = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldImage(require('../media/blynk/iot.png'), 20, 20)) + .appendField(Blockly.Msg.MQTT_publish); + this.appendValueInput("data"); + this.appendDummyInput("") + .appendField(Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT_TO); + this.appendDummyInput() + .appendField(Blockly.Msg.MQTT_Topic) + .appendField(new Blockly.FieldTextInput('Topic', Topic_validator), "Topic"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(" "); + this.setHelpUrl(); + } +}; + +export const MQTT_subscribe_value = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MQTT_Topic) + .appendField(new Blockly.FieldTextInput('Topic_0', Topic_validator), "Topic_0"); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_VALUE) + this.setInputsInline(true); + this.setOutput(true, String); + } +}; + +export const MQTT_add_subscribe_topic = { + /** + * Mutator bolck for else-if condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MQTT_Topic); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP); + this.contextMenu = false; + } +}; + +export const MQTT_subscribe = { + /** + * Block for if/elseif/else condition. + * @this Blockly.Block + */ + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT) + .appendField(Blockly.Msg.MQTT_Topic + Blockly.Msg.MQTT_subscribe2) + .appendField(new Blockly.FieldTextInput('Topic_0', Topic_validator), "Topic_0"); + this.appendStatementInput('DO0') + .appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN); + this.setPreviousStatement(false); + this.setNextStatement(false); + this.setMutator(new Blockly.icons.MutatorIcon(['MQTT_add_subscribe_topic'], this)); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + if (!thisBlock.elseifCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_1; + } else if (thisBlock.elseifCount_) { + return Blockly.Msg.CONTROLS_IF_TOOLTIP_3; + } + }); + this.elseifCount_ = 0; + }, + /** + * Create XML to represent the number of else-if and else inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + if (!this.elseifCount_ && !this.elseCount_) { + return null; + } + var container = document.createElement('mutation'); + if (this.elseifCount_) { + container.setAttribute('elseif', this.elseifCount_); + } + return container; + }, + /** + * Parse XML to restore the else-if and else inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + var containerBlock = this; + var statementConnections = []; + for (var i = this.elseifCount_; i > 0; i--) { + this.removeInput('DummyInput' + i); + if (containerBlock.getInputTargetBlock('DO' + i) && containerBlock.getInputTargetBlock('DO' + i).previousConnection) + statementConnections[i] = (containerBlock.getInputTargetBlock('DO' + i).previousConnection); + else + statementConnections[i] = null; + this.removeInput('DO' + i); + } + this.elseifCount_ = parseInt(xmlElement.getAttribute('elseif'), 10); + //this.compose(containerBlock); + for (var i = 1; i <= this.elseifCount_; i++) { + this.appendDummyInput('DummyInput' + i) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT) + .appendField(Blockly.Msg.MQTT_Topic + Blockly.Msg.MQTT_subscribe2) + .appendField(new Blockly.FieldTextInput('Topic_' + i, Topic_validator), "Topic_" + i); + this.appendStatementInput('DO' + i) + .appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN); + } + for (var i = statementConnections.length - 2; i > 0; i--) { + if (statementConnections[i]) + statementConnections[i] && statementConnections[i].reconnect(this, 'DO' + i); + } + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = workspace.newBlock('mqtt_topics_set'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 1; i <= this.elseifCount_; i++) { + var elseifBlock = workspace.newBlock('MQTT_add_subscribe_topic'); + elseifBlock.initSvg(); + connection.connect(elseifBlock.previousConnection); + connection = elseifBlock.nextConnection; + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + // Disconnect all the elseif input blocks and remove the inputs. + for (var i = this.elseifCount_; i > 0; i--) { + this.removeInput('DummyInput' + i); + this.removeInput('DO' + i); + } + this.elseifCount_ = 0; + // Rebuild the block's optional inputs. + var clauseBlock = containerBlock.getInputTargetBlock('STACK'); + var statementConnections = [null]; + while (clauseBlock) { + switch (clauseBlock.type) { + case 'MQTT_add_subscribe_topic': + this.elseifCount_++; + statementConnections.push(clauseBlock.statementConnection_); + break; + default: + throw Error('Unknown block type: ' + clauseBlock.type); + } + clauseBlock = clauseBlock.nextConnection && + clauseBlock.nextConnection.targetBlock(); + } + this.updateShape_(); + // Reconnect any child blocks. + this.reconnectChildBlocks_(statementConnections); + + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var clauseBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 1; + while (clauseBlock) { + switch (clauseBlock.type) { + case 'MQTT_add_subscribe_topic': + var inputDo = this.getInput('DO' + i); + clauseBlock.statementConnection_ = + inputDo && inputDo.connection.targetConnection; + i++; + break; + default: + throw 'Unknown block type.'; + } + clauseBlock = clauseBlock.nextConnection && + clauseBlock.nextConnection.targetBlock(); + } + }, + /** + * Reconstructs the block with all child blocks attached. + */ + rebuildShape_: function () { + var statementConnections = [null]; + + var i = 1; + while (this.getInput('DummyInput' + i)) { + var inputDo = this.getInput('DO' + i); + statementConnections.push(inputDo.connection.targetConnection); + i++; + } + this.updateShape_(); + this.reconnectChildBlocks_(statementConnections); + }, + /** + * Modify this block to have the correct number of inputs. + * @this Blockly.Block + * @private + */ + updateShape_: function () { + var i = 1; + while (this.getInput('DummyInput' + i)) { + this.removeInput('DummyInput' + i); + this.removeInput('DO' + i); + i++; + } + // Rebuild block. + for (var i = 1; i <= this.elseifCount_; i++) { + this.appendDummyInput("DummyInput" + i) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT) + .appendField(Blockly.Msg.MQTT_Topic + Blockly.Msg.MQTT_subscribe2) + .appendField(new Blockly.FieldTextInput('Topic_' + i, Topic_validator), "Topic_" + i); + this.appendStatementInput('DO' + i) + .appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN); + } + }, + /** + * Reconnects child blocks. + * @param {!Array} valueConnections List of value + * connectsions for if input. + * @param {!Array} statementConnections List of + * statement connections for do input. + * @param {?Blockly.RenderedConnection} elseStatementConnection Statement + * connection for else input. + */ + reconnectChildBlocks_: function (statementConnections) { + for (var i = 1; i <= this.elseifCount_; i++) { + //valueConnections[i] && valueConnections[i].reconnect(this, 'IF' + i); + statementConnections[i] && statementConnections[i].reconnect(this, 'DO' + i); + } + } +}; + +export const mqtt_topics_set = { + /** + * Mutator block for if container. + * @this Blockly.Block + */ + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_EMQX_SUBSCRIBE + Blockly.Msg.MQTT_Topic); + this.appendStatementInput('STACK'); + this.contextMenu = false; + } +}; + +//GET请求 +export const http_get = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_GET_REQUEST); + this.appendValueInput("api") + .setCheck(null) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendStatementInput("success") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SUCCESS); + this.appendStatementInput("failure") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_FAILED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + } +}; + +//自动配网 +export const WIFI_smartConfig = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.blynk_smartconfig) + .appendField(new Blockly.FieldDropdown([ + ["SmartConfig", 'SmartConfig'], + ["AP", 'AP'] + ]), "MODE"); + this.setInputsInline(true); + this.setPreviousStatement(true, null);//可上下连接 + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MQTT_TEST_TOOLTIP); + } +}; + +export const WIFI_ap_or_sta = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/blynk/wifi_udp.png'), 25, 25, "*")) + .appendField(Blockly.Msg.MIXLY_SETUP + " UDP WIFI"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE + ":") + .appendField(new Blockly.FieldDropdown([["STA", "STA"], ["AP", "AP"]]), "mode"); + this.appendValueInput("SSID") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_NAME); + this.appendValueInput("PSK") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_PASSWORD); + this.appendValueInput("IP1") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_LINK_DEVICE + " IP1"); + this.appendValueInput("IP2") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_LINK_DEVICE + " IP2"); + this.appendValueInput("IP") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ESP32_BLUETOOTH_FLAG + " IP"); + this.appendValueInput("duankou") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PORT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setHelpUrl(""); + } +}; + +export const WIFI_ap_and_sta = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/blynk/wifi_udp.png'), 25, 25, "*")) + .appendField(Blockly.Msg.MIXLY_SETUP + " UDP WIFI"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE + ": AP+STA"); + this.appendValueInput("SSID1") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_NAME + "(STA)"); + this.appendValueInput("SSID2") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_NAME + "(AP)"); + this.appendValueInput("PSK1") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_PASSWORD + "(STA)"); + this.appendValueInput("PSK2") + .setCheck(null) + .appendField("WIFI " + Blockly.Msg.HTML_PASSWORD + "(AP)"); + this.appendValueInput("IP1") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_LINK_DEVICE + " IP1"); + this.appendValueInput("IP2") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_LINK_DEVICE + " IP2"); + this.appendValueInput("IP") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ESP32_BLUETOOTH_FLAG + " IP"); + this.appendValueInput("duankou") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ETHERNET_CLINET_PORT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setHelpUrl(""); + } +}; + +export const WIFI_incomingPacket = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/blynk/wifi_udp.png'), 25, 25, "*")) + .appendField( + Blockly.Msg.CONTROLS_IF_MSG_IF + " WIFI UDP " + + Blockly.Msg.MIXLY_STM32_SPI_DATA_RECEIVED + "?" + ) + this.appendValueInput("input_data") + .setCheck(null) + .appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS); + this.appendDummyInput() + .appendField("(" + Blockly.Msg.LANG_MATH_STRING + ")"); + this.appendStatementInput("do") + .setCheck(null); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const WIFI_send_data = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/blynk/wifi_udp.png'), 25, 25, "*")) + .appendField("WIFI UDP " + Blockly.Msg.MIXLY_SEND_DATA); + this.appendValueInput("data") + .setCheck(null); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//天气GET +export const WeatherGet = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.WeatherGet) + .appendField(new Blockly.FieldTextInput('北京'), 'data') + .appendField("1", "check"); + this.setOutput(true, Boolean); + this.setTooltip("输入正确的城市名(不用带“市”字)如:深圳 北京 广州,如果错误会显示'error'刷新成功则返回true\n天气接口优化注意:\n1. 接口每 8 小时更新一次,机制是 CDN 缓存 8 小时更新一次。注意:自己做缓存。\n2. 接口采用城市 ID 来精准查询请求,省份不能直接查询天气。\n3.每分钟阈值为 300 次,如果超过会禁用一天。请谨慎使用。"); + } +}; + +//获取当天天气 +export const WeatherGetToday = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.WeatherGetToday) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_Humidity, "0"], + ['PM2.5', "1"], + ['PM1.0', "2"], + [Blockly.Msg.TodayQuality, "3"], + [Blockly.Msg.MIXLY_TEMPERATURE, "4"] + ]), "type"); + this.setOutput(true, Number); + this.setTooltip("返回对应数据 字符串型。"); + } +}; + +//获取当天天气 +export const WeatherGetForecast = { + init: function () { + this.setColour(ETHERNET_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.WeatherGetForecast) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_DATE, "ForecastDate"], + [Blockly.Msg.ForecastHigh, "ForecastHigh"], + [Blockly.Msg.ForecastLow, "ForecastLow"], + [Blockly.Msg.ForecastYmd, "ForecastYmd"], + [Blockly.Msg.MIXLY_WEEK, "ForecastWeek"], + [Blockly.Msg.ForecastAqi, "ForecastAqi"], + [Blockly.Msg.ForecastFx, "ForecastFx"], + [Blockly.Msg.ForecastFl, "ForecastFl"], + [Blockly.Msg.ForecastType, "ForecastType"] + ]), "type"); + this.appendValueInput('date', Number) + .appendField(Blockly.Msg.MIXLY_GPS_DATE + '(0~14)'); + this.setOutput(true, Number); + this.setTooltip("返回预报天气内容0表示当天,最大为14,字符串型。"); + this.setInputsInline(true); + } +}; + +export const mixio_mqtt_subscribe = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_CREATE_MQTT_CLIENT_AND_CONNECT); + this.appendValueInput("server") + .setCheck(null) + .appendField(Blockly.Msg.blynk_SERVER_ADD); + this.appendValueInput("port") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_EMQX_PORT); + this.appendValueInput("mqtt_username") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_USERNAME); + this.appendValueInput("mqtt_password") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_WIFI_PASSWORD); + this.appendValueInput("project") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_EMQX_PROJECT); + //this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(170); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const mixio_mqtt_subscribe_key = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.USE_MIXLY_KEY) + .appendField(new Blockly.FieldTextInput("1RFOH08C"), "key") + .appendField(Blockly.Msg.CONNECT_TO_MIXIO) + .appendField(Blockly.Msg.blynk_SERVER_ADD) + .appendField(new Blockly.FieldTextInput("mixio.mixly.cn"), "server"); + this.setNextStatement(true, null); + this.setColour(170); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const mixio_mqtt_publish = { + init: function () { + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MQTT_SEND_MESSAGE); + this.appendValueInput("topic") + .setCheck(null) + .appendField(Blockly.Msg.TO_TOPIC); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([["MixIO", "1"], ["Mixly Key", "2"]]), "mode"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(170); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const mixio_mqtt_received_the_news = { + init: function () { + this.appendValueInput("topic") + .setCheck(null) + .appendField(Blockly.Msg.WHEN_THE_SUBJECT_IS_RECEIVED); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_MSG) + .appendField(new Blockly.FieldDropdown([["MixIO", "1"], ["Mixly Key", "2"]]), "mode"); + this.appendStatementInput("function") + .setCheck(null); + this.setPreviousStatement(false, null); + this.setNextStatement(false, null); + this.setColour(170); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//OTA +export const asyncelegantota = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/blocks_icons/loop.png'), 15, 15, { alt: "*", flipRtl: "FALSE" })) + .appendField("ElegantOTA"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(120); + this.setTooltip("http://ip/update"); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/factory.js b/mixly/boards/default_src/arduino_avr/blocks/factory.js new file mode 100644 index 00000000..39de28c9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/factory.js @@ -0,0 +1,324 @@ +import * as Blockly from 'blockly/core'; + +const FACTORY_HUE = "#777777"; + +export const factory_include = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField("#include <") + .appendField(new Blockly.FieldTextInput('Test'), 'INCLUDE') + .appendField(".h>"); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_function_noreturn = { + init: function () { + //console.log('init'); + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('function'), 'NAME'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: function () { + //console.log('mutationToDom'); + var container = document.createElement('mutation'); + container.setAttribute('items', this.itemCount_); + //add + for (var i = 0; i < this.arguments_.length; i++) { + var parameter = document.createElement('arg'); + parameter.setAttribute('name', this.arguments_[i]); + container.appendChild(parameter); + } + return container; + }, + domToMutation: function (xmlElement) { + //console.log('domToMutation'); + this.arguments_ = [];//add + //add + for (var i = 0; xmlElement.childNodes[i]; i++) { + let childNode = xmlElement.childNodes[i]; + if (childNode.nodeName.toLowerCase() == 'arg') { + this.arguments_.push(childNode.getAttribute('name')); + } + } + this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10); + this.updateShape_(); + }, + decompose: function (workspace) { + //console.log('decompose'); + var containerBlock = + workspace.newBlock('factory_create_with_container'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 0; i < this.itemCount_; i++) { + var itemBlock = workspace.newBlock('factory_create_with_item'); + itemBlock.initSvg(); + itemBlock.setFieldValue(this.arguments_[i], 'NAME');//add + connection.connect(itemBlock.previousConnection); + connection = itemBlock.nextConnection; + } + return containerBlock; + }, + compose: function (containerBlock) { + //console.log('compose'); + this.arguments_ = [];//add + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + // Count number of inputs. + var connections = []; + var i = 0; + while (itemBlock) { + this.arguments_.push(itemBlock.getFieldValue('NAME'));//add + connections[i] = itemBlock.valueConnection_; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + i++; + } + this.itemCount_ = i; + this.updateShape_(); + // Reconnect any child blocks. + for (var i = 0; i < this.itemCount_; i++) { + if (connections[i]) { + this.getInput('ADD' + i).connection.connect(connections[i]); + } + } + }, + saveConnections: function (containerBlock) { + //console.log('saveConnections'); + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 0; + while (itemBlock) { + var input = this.getInput('ADD' + i); + itemBlock.valueConnection_ = input && input.connection.targetConnection; + i++; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + } + }, + updateShape_: function () { + //console.log('updateShape_'); + // Delete everything. + if (this.getInput('EMPTY')) { + this.removeInput('EMPTY'); + } else { + var i = 0; + while (this.getInput('ADD' + i)) { + this.removeInput('ADD' + i); + i++; + } + } + // Rebuild block. + for (var i = 0; i < this.itemCount_; i++) { + this.appendValueInput('ADD' + i) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(this.arguments_[i]); + } + } +}; + +export const factory_create_with_container = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_PARAMS); + this.appendStatementInput('STACK'); + this.contextMenu = false; + } +}; + +export const factory_create_with_item = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE + ':') + .appendField(new Blockly.FieldTextInput('x'), 'NAME'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.contextMenu = false; + } +}; + +export const factory_function_return = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('function'), 'NAME'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setOutput(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: factory_function_noreturn.mutationToDom, + domToMutation: factory_function_noreturn.domToMutation, + decompose: factory_function_noreturn.decompose, + compose: factory_function_noreturn.compose, + saveConnections: factory_function_noreturn.saveConnections, + updateShape_: factory_function_noreturn.updateShape_ +}; + +export const factory_declare = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('Test'), 'TYPE') + .appendField(" ") + .appendField(new Blockly.FieldTextInput('test'), 'NAME') + .appendField(";"); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_declare2 = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldMultilineInput('//define user code;'), 'VALUE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_define = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('#define'), 'TYPE') + .appendField(" ") + .appendField(new Blockly.FieldTextInput('MYDEFINE 11'), 'NAME') + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_static_method_noreturn = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('Test'), 'TYPE') + .appendField("::") + .appendField(new Blockly.FieldTextInput('staticMethod'), 'NAME'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: factory_function_noreturn.mutationToDom, + domToMutation: factory_function_noreturn.domToMutation, + decompose: factory_function_noreturn.decompose, + compose: factory_function_noreturn.compose, + saveConnections: factory_function_noreturn.saveConnections, + updateShape_: factory_function_noreturn.updateShape_ +}; + +export const factory_static_method_return = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('Test'), 'TYPE') + .appendField("::") + .appendField(new Blockly.FieldTextInput('staticMethod'), 'NAME'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setOutput(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: factory_function_noreturn.mutationToDom, + domToMutation: factory_function_noreturn.domToMutation, + decompose: factory_function_noreturn.decompose, + compose: factory_function_noreturn.compose, + saveConnections: factory_function_noreturn.saveConnections, + updateShape_: factory_function_noreturn.updateShape_ +}; + +export const factory_callMethod_noreturn = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('test'), 'NAME') + .appendField('.') + .appendField(new Blockly.FieldTextInput('callMetod'), 'METHOD'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: factory_function_noreturn.mutationToDom, + domToMutation: factory_function_noreturn.domToMutation, + decompose: factory_function_noreturn.decompose, + compose: factory_function_noreturn.compose, + saveConnections: factory_function_noreturn.saveConnections, + updateShape_: factory_function_noreturn.updateShape_ +}; + +export const factory_callMethod_return = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('test'), 'NAME') + .appendField('.') + .appendField(new Blockly.FieldTextInput('callMetod'), 'METHOD'); + this.itemCount_ = 1; + this.arguments_ = ['x'];//add + this.updateShape_(); + this.setOutput(true); + this.setMutator(new Blockly.icons.MutatorIcon(['factory_create_with_item'], this)); + }, + mutationToDom: factory_function_noreturn.mutationToDom, + domToMutation: factory_function_noreturn.domToMutation, + decompose: factory_function_noreturn.decompose, + compose: factory_function_noreturn.compose, + saveConnections: factory_function_noreturn.saveConnections, + updateShape_: factory_function_noreturn.updateShape_ +}; + +export const factory_block = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('Serial.println("hello");'), 'VALUE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_block_return = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldTextInput('test'), 'VALUE'); + this.setOutput(true); + } +}; + +export const factory_block_with_textarea = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldMultilineInput('Serial.println("Hello");\nSerial.println("Mixly");'), 'VALUE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const factory_block_return_with_textarea = { + init: function () { + this.setColour(FACTORY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldMultilineInput('Hello\nMixly'), 'VALUE'); + this.setOutput(true); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/inout.js b/mixly/boards/default_src/arduino_avr/blocks/inout.js new file mode 100644 index 00000000..e35006f7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/inout.js @@ -0,0 +1,400 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const BASE_HUE = 20;//'#ae3838';//40; + +export const inout_highlow = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_HIGH, "HIGH"], + [Blockly.Msg.MIXLY_LOW, "LOW"] + ]), 'BOOL') + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_HIGHLOW); + } +}; + +export const inout_pinMode = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PINMODE) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PINMODEIN, "INPUT"], + [Blockly.Msg.MIXLY_PINMODEOUT, "OUTPUT"], + [Blockly.Msg.MIXLY_PINMODEPULLUP, "INPUT_PULLUP"] + ]), "MODE") + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_pinMode); + } +}; + +export const inout_digital_write2 = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_DIGITALWRITE_PIN) + .setCheck(Number); + this.appendValueInput("STAT") + .appendField(Blockly.Msg.MIXLY_STAT) + .setCheck([Number, Boolean]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.LANG_INOUT_DIGITAL_WRITE_TOOLTIP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id2"); + } +}; + +export const inout_digital_read = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DIGITALREAD_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.setOutput(true, [Boolean, Number]); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_DIGITAL_READ); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id6"); + } +}; + +export const inout_digital_read2 = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_DIGITALREAD_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, [Boolean, Number]); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_DIGITAL_READ); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id6"); + } +}; + +export const inout_analog_write = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ANALOGWRITE_PIN) + .setCheck(Number); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_VALUE2) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_WRITE); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id16"); + } +}; + +export const inout_analog_read = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ANALOGREAD_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_READ); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id11"); + } +}; + +export const inout_buildin_led = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUILDIN_LED) + .appendField(Blockly.Msg.MIXLY_STAT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "HIGH"], + [Blockly.Msg.MIXLY_OFF, "LOW"] + ]), "STAT"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip('light or off the build-in LED'); + } +}; + +export const OneButton_interrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.ONEBUTTON + " " + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_CLICK, "attachClick"], + [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], + [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], + [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], + [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"] + ]), "mode"); + this.appendValueInput("STAT") + .appendField(Blockly.Msg.MIXLY_ELECLEVEL); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + this.setHelpUrl(); + } +}; + +export const controls_attachInterrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ATTACHINTERRUPT_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_RISING, "RISING"], + [Blockly.Msg.MIXLY_FALLING, "FALLING"], + [Blockly.Msg.MIXLY_CHANGE, "CHANGE"] + ]), "mode"); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id20"); + } +}; + +export const controls_detachInterrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_DETACHINTERRUPT_PIN) + .setCheck(Number); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_DETACHINTERRUPT); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id24"); + } +}; + +export const controls_attachPinInterrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ATTACHPININTERRUPT_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_RISING, "RISING"], + [Blockly.Msg.MIXLY_FALLING, "FALLING"], + [Blockly.Msg.MIXLY_CHANGE, "CHANGE"] + ]), "mode"); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + } +}; + +export const controls_detachPinInterrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_DETACHPININTERRUPT_PIN) + .setCheck(Number); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_DETACHINTERRUPT); + } +}; + +export const inout_pulseIn = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PULSEIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_HIGH, "HIGH"], + [Blockly.Msg.MIXLY_LOW, "LOW"] + ]), "STAT"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_pulseIn); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id27"); + } +}; + +export const inout_pulseIn2 = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PULSEIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_HIGH, "HIGH"], + [Blockly.Msg.MIXLY_LOW, "LOW"] + ]), "STAT"); + this.appendValueInput("TIMEOUT", Number) + .appendField(Blockly.Msg.MIXLY_PULSEIN_TIMEOUT) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_pulseIn2); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#id27"); + } +}; + +export const inout_shiftout = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField("ShiftOut"); + this.appendValueInput("PIN1", Number) + .appendField(Blockly.Msg.MIXLY_DATAPIN) + .setCheck(Number); + this.appendValueInput("PIN2", Number) + .appendField(Blockly.Msg.MIXLY_CLOCKPIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BITORDER) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_MSBFIRST, "MSBFIRST"], + [Blockly.Msg.MIXLY_LSBFIRST, "LSBFIRST"] + ]), "ORDER"); + this.appendValueInput("DATA", Number) + .appendField(Blockly.Msg.MIXLY_DATA) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_shiftout); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/01Input-Output.html#shiftout"); + } +}; + +export const ESP32touchButton = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField("ESP32" + Blockly.Msg.MIXLY_ESP32_TOUCH + Blockly.Msg.ONEBUTTON + " " + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_CLICK, "attachClick"], + [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], + [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], + [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], + [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"] + ]), "mode"); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const inout_soft_analog_write = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_SOFT_ANALOGWRITE_PIN) + .setCheck(Number); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_VALUE2) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ANALOG_WRITE); + this.setHelpUrl(""); + } +}; + +export const inout_cancel_soft_analog_write = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_CANCEL_SOFT_ANALOGWRITE_PIN) + .setCheck(Number); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CANCEL_SOFT_ANALOGWRITE_PIN); + this.setHelpUrl(""); + } +}; + +//ADS1015模拟数字转换模块-增益设置 +export const ADS1015_setGain = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETTING) + .appendField(Blockly.Msg.ADS1015_setGain); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(ADS1015_setGain.GAIN_TYPE), "ADS1015_setGain"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + }, + GAIN_TYPE: [ + ["±6.144V 3mv/bit", "GAIN_TWOTHIRDS"], + ["±4.096V 2mv/bit", "GAIN_ONE"], + ["±2.048V 1mv/bit", "GAIN_TWO"], + ["±1.024V 0.5mv/bit", "GAIN_FOUR"], + ["±0.512V 0.25mv/bit", "GAIN_EIGHT"], + ["±0.256V 0.125mv/bit", "GAIN_SIXTEEN"], + ] +}; + +//ADS1015模拟数字转换模块 数值获取 +export const ADS1015_Get_Value = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField("ADS1015" + Blockly.Msg.ADS1015_Get_Value); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + ["AIN0", "ads.readADC_SingleEnded(0)"], + ["AIN1", "ads.readADC_SingleEnded(1)"], + ["AIN2", "ads.readADC_SingleEnded(2)"], + ["AIN3", "ads.readADC_SingleEnded(3)"] + ]), "ADS1015_AIN"); + this.setInputsInline(true); + this.setOutput(true); + } +}; + +//PCF8591T模拟数字转换模块 数值获取 +export const PCF8591T = { + init: function () { + this.setColour(BASE_HUE); + this.appendDummyInput("") + .appendField("PCF8591T" + Blockly.Msg.ADS1015_Get_Value); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + ["AIN0", "pcf8591.analogRead(AIN0)"], + ["AIN1", "pcf8591.analogRead(AIN1)"], + ["AIN2", "pcf8591.analogRead(AIN2)"], + ["AIN3", "pcf8591.analogRead(AIN3)"] + ]), "PCF8591T_AIN"); + this.setInputsInline(true); + this.setOutput(true); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/lists.js b/mixly/boards/default_src/arduino_avr/blocks/lists.js new file mode 100644 index 00000000..5af7e5ac --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/lists.js @@ -0,0 +1,757 @@ +import * as Blockly from 'blockly/core'; + +const LISTS_HUE = 260; + +const DATATYPES = [ + [Blockly.Msg.LANG_MATH_INT, 'int'], + [Blockly.Msg.LANG_MATH_UNSIGNED_INT, 'unsigned int'], + [Blockly.Msg.LANG_MATH_WORD, 'word'], + [Blockly.Msg.LANG_MATH_LONG, 'long'], + [Blockly.Msg.LANG_MATH_UNSIGNED_LONG, 'unsigned long'], + [Blockly.Msg.LANG_MATH_FLOAT, 'float'], + [Blockly.Msg.LANG_MATH_DOUBLE, 'double'], + [Blockly.Msg.LANG_MATH_BOOLEAN, 'boolean'], + [Blockly.Msg.LANG_MATH_BYTE, 'byte'], + [Blockly.Msg.LANG_MATH_CHAR, 'char'], + [Blockly.Msg.LANG_MATH_UNSIGNED_CHAR, 'unsigned char'], + [Blockly.Msg.LANG_MATH_STRING, 'String'] +]; + +export const lists_create_with = { + /** + * Block for creating a list with any number of elements of any type. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE") + .appendField(' ') + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField('[') + .appendField(new Blockly.FieldTextInput('3', Blockly.FieldTextInput.math_number_validator), 'SIZE') + .appendField(']'); + this.itemCount_ = 3; + this.updateShape_(); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.icons.MutatorIcon(['lists_create_with_item'], this)); + this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP); + }, + /** + * Create XML to represent list inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement('mutation'); + container.setAttribute('items', this.itemCount_); + return container; + }, + /** + * Parse XML to restore the list inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10); + this.updateShape_(); + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = + workspace.newBlock('lists_create_with_container'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 0; i < this.itemCount_; i++) { + var itemBlock = workspace.newBlock('lists_create_with_item'); + itemBlock.initSvg(); + connection.connect(itemBlock.previousConnection); + connection = itemBlock.nextConnection; + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + // Count number of inputs. + var connections = []; + var i = 0; + while (itemBlock) { + connections[i] = itemBlock.valueConnection_; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + i++; + } + this.itemCount_ = i; + this.updateShape_(); + // Reconnect any child blocks. + for (var i = 0; i < this.itemCount_; i++) { + if (connections[i]) { + this.getInput('ADD' + i).connection.connect(connections[i]); + } + } + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 0; + while (itemBlock) { + var input = this.getInput('ADD' + i); + itemBlock.valueConnection_ = input && input.connection.targetConnection; + i++; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + } + }, + /** + * Modify this block to have the correct number of inputs. + * @private + * @this Blockly.Block + */ + updateShape_: function () { + // Delete everything. + if (this.getInput('EMPTY')) { + this.removeInput('EMPTY'); + } else { + var i = 0; + while (this.getInput('ADD' + i)) { + this.removeInput('ADD' + i); + i++; + } + } + // Rebuild block. + if (this.itemCount_ == 0) { + this.appendDummyInput('EMPTY') + .appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE); + } else { + for (var i = 0; i < this.itemCount_; i++) { + var input = this.appendValueInput('ADD' + i); + if (i == 0) { + input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH); + } + } + } + } +}; + +export const lists_create_with_text = { + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE") + .appendField(' ') + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField('[') + .appendField(new Blockly.FieldTextInput('3', Blockly.FieldTextInput.math_number_validator), 'SIZE') + .appendField(']') + .appendField(Blockly.Msg.MIXLY_MAKELISTFROM) + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput('0,0,0'), 'TEXT') + .appendField(this.newQuote_(false)) + .appendField(Blockly.Msg.MIXLY_SPLITBYDOU); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT); + }, + newQuote_: function (open) { + if (open == this.RTL) { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg=='; + } else { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC'; + } + return new Blockly.FieldImage(file, 12, 12, '"'); + } +}; + +export const lists_create_with2 = { + /** + * Block for creating a list with any number of elements of any type. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE") + .appendField(' ') + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField('[') + //.appendField(new Blockly.FieldTextInput('3',Blockly.FieldTextInput.math_number_validator), 'SIZE') + .appendField(']'); + this.itemCount_ = 3; + this.updateShape_(); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setMutator(new Blockly.icons.MutatorIcon(['lists_create_with_item'], this)); + this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP); + }, + /** + * Create XML to represent list inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement('mutation'); + container.setAttribute('items', this.itemCount_); + return container; + }, + /** + * Parse XML to restore the list inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10); + this.updateShape_(); + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = + workspace.newBlock('lists_create_with_container'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 0; i < this.itemCount_; i++) { + var itemBlock = workspace.newBlock('lists_create_with_item'); + itemBlock.initSvg(); + connection.connect(itemBlock.previousConnection); + connection = itemBlock.nextConnection; + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + // Count number of inputs. + var connections = []; + var i = 0; + while (itemBlock) { + connections[i] = itemBlock.valueConnection_; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + i++; + } + this.itemCount_ = i; + this.updateShape_(); + // Reconnect any child blocks. + for (var i = 0; i < this.itemCount_; i++) { + if (connections[i]) { + this.getInput('ADD' + i).connection.connect(connections[i]); + } + } + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 0; + while (itemBlock) { + var input = this.getInput('ADD' + i); + itemBlock.valueConnection_ = input && input.connection.targetConnection; + i++; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + } + }, + /** + * Modify this block to have the correct number of inputs. + * @private + * @this Blockly.Block + */ + updateShape_: function () { + // Delete everything. + if (this.getInput('EMPTY')) { + this.removeInput('EMPTY'); + } else { + var i = 0; + while (this.getInput('ADD' + i)) { + this.removeInput('ADD' + i); + i++; + } + } + // Rebuild block. + if (this.itemCount_ == 0) { + this.appendDummyInput('EMPTY') + .appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE); + } else { + for (var i = 0; i < this.itemCount_; i++) { + var input = this.appendValueInput('ADD' + i); + if (i == 0) { + input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH); + } + } + } + } +}; + +export const lists_create_with_text2 = { + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE") + .appendField(' ') + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField('[') + .appendField(new Blockly.FieldTextInput("3"), "SIZE") + .appendField(']') + .appendField(Blockly.Msg.MIXLY_MAKELISTFROM) + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput('0,0,0'), 'TEXT') + .appendField(this.newQuote_(false)) + .appendField(Blockly.Msg.MIXLY_SPLITBYDOU); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT); + }, + newQuote_: function (open) { + if (open == this.RTL) { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg=='; + } else { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC'; + } + return new Blockly.FieldImage(file, 12, 12, '"'); + } +} + +export const lists_create_with_container = { + /** + * Mutator block for list container. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD); + this.appendStatementInput('STACK'); + this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP); + this.contextMenu = false; + } +}; + +export const lists_create_with_item = { + /** + * Mutator bolck for adding items. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP); + this.contextMenu = false; + } +}; + +export const lists_getIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.setOutput(true, Number); + this.appendValueInput('AT') + .setCheck(Number) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField(Blockly.Msg.LANG_LISTS_GET_INDEX1); + this.appendDummyInput("") + .appendField(Blockly.Msg.LANG_LISTS_GET_INDEX2); + this.appendDummyInput() + .appendField('(' + Blockly.Msg.MIXLY_DEPRECATED + ')'); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.LANG_LISTS_GET_INDEX_TOOLTIP); + this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT); + } +}; + +export const lists_setIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput('AT') + .setCheck(Number) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField(Blockly.Msg.LANG_LISTS_SET_INDEX1); + this.appendValueInput('TO') + .appendField(Blockly.Msg.LANG_LISTS_SET_INDEX2); + this.appendDummyInput() + .appendField('(' + Blockly.Msg.MIXLY_DEPRECATED + ')'); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.LANG_LISTS_SET_INDEX_TOOLTIP); + this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT); + } +}; + +export const listsGetValueByIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.setOutput(true, Number); + this.appendValueInput('AT') + .setCheck(Number) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField(Blockly.Msg.LANG_LISTS_GET_INDEX1); + this.appendDummyInput("") + .appendField(Blockly.Msg.LANG_LISTS_GET_INDEX2); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.LANG_LISTS_GET_VALUE_BY_INDEX_TOOLTIP); + } +}; + +export const listsSetValueByIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput('AT') + .setCheck(Number) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField(Blockly.Msg.LANG_LISTS_SET_INDEX1); + this.appendValueInput('TO') + .appendField(Blockly.Msg.LANG_LISTS_SET_INDEX2); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.LANG_LISTS_SET_VALUE_BY_INDEX_TOOLTIP); + } +}; + +export const lists_length = { + /** + * Block for list length. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_LENGTH) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR'); + this.setTooltip(Blockly.Msg.LISTS_LENGTH_TOOLTIP); + this.setOutput(true, Number); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/06Lists.html#mylist"); + } +}; + +//创建二维数组 +export const create_array2_with_text = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput("name") + .setCheck(null) + .appendField(new Blockly.FieldDropdown(DATATYPES), "TYPE") + .appendField(Blockly.Msg.MIXLY_ARRAY2); + this.appendValueInput("line") + .setCheck(null) + .appendField(Blockly.Msg.array2_rows); + this.appendValueInput("list") + .setCheck(null) + .appendField(Blockly.Msg.array2_cols); + this.appendValueInput("String") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MAKELISTFROM); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_SET); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/06Lists.html#array"); + } +}; + +//二维数组赋值 +export const array2_assignment = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput("name") + .setCheck(null) + .appendField(Blockly.Msg.array2_assignment); + this.appendValueInput("line") + .appendField(Blockly.Msg.DATAFRAME_RAW) + this.appendValueInput("list") + .appendField(Blockly.Msg.DATAFRAME_COLUMN); + this.appendValueInput("assignment") + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.appendDummyInput() + .appendField('(' + Blockly.Msg.MIXLY_DEPRECATED + ')'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setHelpUrl(""); + this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT); + } +}; + +//获取二维数组值 +export const get_array2_value = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput("name") + .setCheck(null) + .appendField(Blockly.Msg.get_array2_value); + this.appendValueInput("line") + .appendField(Blockly.Msg.DATAFRAME_RAW); + this.appendValueInput("list") + .appendField(Blockly.Msg.DATAFRAME_COLUMN); + this.appendDummyInput() + .appendField('(' + Blockly.Msg.MIXLY_DEPRECATED + ')'); + this.setInputsInline(true); + this.setOutput(true, null); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/06Lists.html#arraymn"); + this.setWarningText(Blockly.Msg.MIXLY_DEPRECATED_WARNING_TEXT); + } +}; + +//二维数组赋值 +export const lists2SetValueByIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput("name") + .setCheck(null) + .appendField(Blockly.Msg.array2_assignment); + this.appendValueInput("line") + .appendField(Blockly.Msg.DATAFRAME_RAW) + this.appendValueInput("list") + .appendField(Blockly.Msg.DATAFRAME_COLUMN); + this.appendValueInput("assignment") + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/06Lists.html#mn"); + this.setTooltip(Blockly.Msg.LANG_LISTS_SET_VALUE_BY_INDEX_TOOLTIP); + } +}; + +//二维数组取值 +export const lists2GetValueByIndex = { + init: function () { + this.setColour(LISTS_HUE); + this.appendValueInput("name") + .setCheck(null) + .appendField(Blockly.Msg.get_array2_value); + this.appendValueInput("line") + .appendField(Blockly.Msg.DATAFRAME_RAW); + this.appendValueInput("list") + .appendField(Blockly.Msg.DATAFRAME_COLUMN); + this.setInputsInline(true); + this.setOutput(true, null); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/06Lists.html#arraymn"); + this.setTooltip(Blockly.Msg.LANG_LISTS_GET_VALUE_BY_INDEX_TOOLTIP); + } +}; + +export const lists_array2_setup = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_ARRAY2); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(DATATYPES), "lists_create_type") + .appendField(new Blockly.FieldTextInput("mylist"), "lists_create_name") + .appendField("[ ][ ]"); + this.appendStatementInput("lists_with_2_1_data") + .setCheck(null) + .appendField(Blockly.Msg.VARIABLES_SET_TITLE); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(LISTS_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const lists_array2_setup_get_data = { + /** + * Block for creating a list with any number of elements of any type. + * @this Blockly.Block + */ + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput(""); + this.itemCount_ = 3; + this.updateShape_(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setMutator(new Blockly.icons.MutatorIcon(['lists_create_with_item'], this)); + this.setTooltip(""); + }, + /** + * Create XML to represent list inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = document.createElement('mutation'); + container.setAttribute('items', this.itemCount_); + return container; + }, + /** + * Parse XML to restore the list inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10); + this.updateShape_(); + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = + workspace.newBlock('lists_create_with_container'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 0; i < this.itemCount_; i++) { + var itemBlock = workspace.newBlock('lists_create_with_item'); + itemBlock.initSvg(); + connection.connect(itemBlock.previousConnection); + connection = itemBlock.nextConnection; + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + // Count number of inputs. + var connections = []; + var i = 0; + while (itemBlock) { + connections[i] = itemBlock.valueConnection_; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + i++; + } + this.itemCount_ = i; + this.updateShape_(); + // Reconnect any child blocks. + for (var i = 0; i < this.itemCount_; i++) { + if (connections[i]) { + this.getInput('ADD' + i).connection.connect(connections[i]); + } + } + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 0; + while (itemBlock) { + var input = this.getInput('ADD' + i); + itemBlock.valueConnection_ = input && input.connection.targetConnection; + i++; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + } + }, + /** + * Modify this block to have the correct number of inputs. + * @private + * @this Blockly.Block + */ + updateShape_: function () { + // Delete everything. + if (this.getInput('EMPTY')) { + this.removeInput('EMPTY'); + } else { + var i = 0; + while (this.getInput('ADD' + i)) { + this.removeInput('ADD' + i); + i++; + } + } + // Rebuild block. + if (this.itemCount_ == 0) { + this.appendDummyInput('EMPTY') + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(""); + } else { + for (var i = 0; i <= this.itemCount_; i++) { + + if (i > 0 && i < this.itemCount_) { + var input = this.appendValueInput('ADD' + i); + input.setAlign(Blockly.inputs.Align.RIGHT) + input.appendField(","); + } + if (i == 0) { + var input = this.appendValueInput('ADD' + i); + input.setAlign(Blockly.inputs.Align.RIGHT); + input.appendField("{"); + } + else if (i == this.itemCount_) { + var input = this.appendDummyInput('ADD' + i); + input.setAlign(Blockly.inputs.Align.RIGHT); + input.appendField("}"); + } + } + } + } +}; + +//一维数组循环 +export const loop_array = { + init: function () { + this.appendValueInput("name") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_LIST_NAME); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.LEFT_CYCLE, "0"], + [Blockly.Msg.RIGHT_CYCLE, "1"] + ]), "mode"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(LISTS_HUE); + this.setTooltip(''); + this.setHelpUrl(""); + } +}; + +//获取二维数组的行数与列数 +export const lists_array2_get_length = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ARRAY2) + .appendField(new Blockly.FieldTextInput("mylist"), "list_name") + .appendField(" " + Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.array2_rows, "row"], + [Blockly.Msg.array2_cols, "col"] + ]), "type"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(LISTS_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/logic.js b/mixly/boards/default_src/arduino_avr/blocks/logic.js new file mode 100644 index 00000000..4e508342 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/logic.js @@ -0,0 +1,149 @@ +import * as Blockly from 'blockly/core'; + +const LOGIC_HUE = 210; + +export const logic_compare = { + /** + * Block for comparison operator. + * @this Blockly.Block + */ + init: function () { + var OPERATORS = Blockly.RTL ? [ + ['=', 'EQ'], + ['\u2260', 'NEQ'], + ['>', 'LT'], + ['\u2265', 'LTE'], + ['<', 'GT'], + ['\u2264', 'GTE'] + ] : [ + ['=', 'EQ'], + ['\u2260', 'NEQ'], + ['<', 'LT'], + ['\u2264', 'LTE'], + ['>', 'GT'], + ['\u2265', 'GTE'] + ]; + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/04Logic.html#id2"); + this.setColour(LOGIC_HUE); + this.setOutput(true, Boolean); + this.appendValueInput('A'); + this.appendValueInput('B') + .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP'); + this.setInputsInline(true); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'EQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ, + 'NEQ': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ, + 'LT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT, + 'LTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE, + 'GT': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT, + 'GTE': Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE + }; + return TOOLTIPS[op]; + }); + this.prevBlocks_ = [null, null]; + } +}; + +export const logic_operation = { + /** + * Block for logical operations: 'and', 'or'. + * @this Blockly.Block + */ + init: function () { + var OPERATORS = [ + [Blockly.Msg.LOGIC_OPERATION_AND, 'AND'], + [Blockly.Msg.LOGIC_OPERATION_OR, 'OR'] + ]; + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/04Logic.html#id12"); + this.setColour(LOGIC_HUE); + this.setOutput(true, Boolean); + this.appendValueInput('A') + .setCheck([Boolean, Number]); + this.appendValueInput('B') + .setCheck([Boolean, Number]) + .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP'); + this.setInputsInline(true); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'AND': Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND, + 'OR': Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR + }; + return TOOLTIPS[op]; + }); + } +}; + +export const logic_negate = { + /** + * Block for negation. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.LOGIC_NEGATE_HELPURL); + this.setColour(LOGIC_HUE); + this.setOutput(true, Boolean); + this.appendValueInput('BOOL') + .setCheck([Number, Boolean]) + .appendField(Blockly.Msg.LOGIC_NEGATE_TITLE); + //this.interpolateMsg(Blockly.Msg.LOGIC_NEGATE_TITLE, + // ['BOOL', Boolean, Blockly.inputs.Align.RIGHT], + // Blockly.inputs.Align.RIGHT); + this.setTooltip(Blockly.Msg.LOGIC_NEGATE_TOOLTIP); + } +}; + +export const logic_boolean = { + /** + * Block for boolean data type: true and false. + * @this Blockly.Block + */ + init: function () { + var BOOLEANS = [ + [Blockly.Msg.LOGIC_BOOLEAN_TRUE, 'TRUE'], + [Blockly.Msg.LOGIC_BOOLEAN_FALSE, 'FALSE'] + ]; + //this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL); + this.setColour(LOGIC_HUE); + this.setOutput(true, Boolean); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(BOOLEANS), 'BOOL'); + this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP); + } +}; + +export const logic_null = { + /** + * Block for null data type. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.LOGIC_NULL_HELPURL); + this.setColour(LOGIC_HUE); + this.setOutput(true); + this.appendDummyInput() + .appendField(Blockly.Msg.LOGIC_NULL); + this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP); + } +}; + +export const logic_true_or_false = { + init: function () { + this.setColour(LOGIC_HUE); + this.appendValueInput('A'); + this.appendValueInput('B') + .appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE); + this.appendValueInput('C') + .appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE); + this.setOutput(true); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LOGIT_TRUEORFALSE); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/04Logic.html#id17"); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/math.js b/mixly/boards/default_src/arduino_avr/blocks/math.js new file mode 100644 index 00000000..4bd89098 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/math.js @@ -0,0 +1,374 @@ +import * as Blockly from 'blockly/core'; + +const MATH_HUE = 230; + +Blockly.FieldTextInput.math_number_validator = function (text) { + //return window.isNaN(text) ? null : String(text); + return String(text);//不再校验 +}; + +export const math_number = { + /** + * Block for numeric value. + * @this Blockly.Block + */ + init: function () { + this.setColour(MATH_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput('0', + Blockly.FieldTextInput.math_number_validator), 'NUM'); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MATH_NUMBER_TOOLTIP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#id2"); + } +}; + +export const math_arithmetic = { + /** + * Block for basic arithmetic operator. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.MATH_ARITHMETIC_HELPURL); + this.setColour(MATH_HUE); + this.setOutput(true, Number); + this.appendValueInput('A') + .setCheck(null); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#id4"); + this.appendValueInput('B') + .setCheck(null) + .appendField(new Blockly.FieldDropdown(math_arithmetic.OPERATORS), 'OP'); + this.setInputsInline(true); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'ADD': Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD, + 'MINUS': Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS, + 'MULTIPLY': Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY, + 'DIVIDE': Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE, + 'QUYU': Blockly.Msg.MATH_MODULO_TOOLTIP, + 'POWER': Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER + }; + return TOOLTIPS[mode]; + }); + }, + OPERATORS: [ + [Blockly.Msg.MATH_ADDITION_SYMBOL, 'ADD'], + [Blockly.Msg.MATH_SUBTRACTION_SYMBOL, 'MINUS'], + [Blockly.Msg.MATH_MULTIPLICATION_SYMBOL, 'MULTIPLY'], + [Blockly.Msg.MATH_DIVISION_SYMBOL, 'DIVIDE'], + [Blockly.Msg.MATH_QUYU_SYMBOL, 'QUYU'], + [Blockly.Msg.MATH_POWER_SYMBOL, 'POWER'] + ] +}; + +export const math_bit = { + init: function () { + this.setColour(MATH_HUE); + this.setOutput(true, Number); + this.appendValueInput('A') + .setCheck(Number); + this.appendValueInput('B') + .setCheck(Number) + .appendField(new Blockly.FieldDropdown(math_bit.OPERATORS), 'OP'); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#id8"); + }, + OPERATORS: [ + ['&', '&'], + ['|', '|'], + ['xor', '^'], + ['>>', '>>'], + ['<<', '<<'] + ] +}; + +export const math_trig = { + /** + * Block for trigonometry operators. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL); + this.setColour(MATH_HUE); + this.setOutput(true, Number); + this.appendValueInput('NUM') + .setCheck(Number) + .appendField(new Blockly.FieldDropdown(math_trig.OPERATORS), 'OP'); + // Assign 'this' to a variable for use in the tooltip closure below. + var thisBlock = this; + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#id21"); + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'SIN': Blockly.Msg.MATH_TRIG_TOOLTIP_SIN, + 'COS': Blockly.Msg.MATH_TRIG_TOOLTIP_COS, + 'TAN': Blockly.Msg.MATH_TRIG_TOOLTIP_TAN, + 'ASIN': Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN, + 'ACOS': Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS, + 'ATAN': Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN + }; + return TOOLTIPS[mode]; + }); + }, + OPERATORS: [ + ['sin', 'SIN'], + ['cos', 'COS'], + ['tan', 'TAN'], + ['asin', 'ASIN'], + ['acos', 'ACOS'], + ['atan', 'ATAN'], + ['ln', 'LN'], + ['log10', 'LOG10'], + ['e^', 'EXP'], + ['10^', 'POW10'], + ['++', '++'], + ['--', '--'], + ['~', '~'], + ] +}; + +//取整等 +export const math_to_int = { + init: function () { + this.setColour(MATH_HUE); + this.appendValueInput('A') + .setCheck(Number) + .appendField(new Blockly.FieldDropdown(math_to_int.OPERATORS), 'OP'); + this.setOutput(true, Number); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#id35"); + var thisBlock = this; + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'sqrt': Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT, + 'abs': Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS, + 'sq': Blockly.Msg.MATH_SINGLE_TOOLTIP_SQ, + 'log': Blockly.Msg.MATH_SINGLE_TOOLTIP_LN, + 'round': Blockly.Msg.MATH_SINGLE_TOOLTIP_ROUND, + 'ceil': Blockly.Msg.MATH_SINGLE_TOOLTIP_CEIL, + 'floor': Blockly.Msg.MATH_SINGLE_TOOLTIP_FLOOR + }; + return TOOLTIPS[mode]; + }); + }, + OPERATORS: [ + [Blockly.Msg.LANG_MATH_TO_ROUND, 'round'], + [Blockly.Msg.LANG_MATH_TO_CEIL, 'ceil'], + [Blockly.Msg.LANG_MATH_TO_FLOOR, 'floor'], + [Blockly.Msg.MATH_ABS, 'abs'], + [Blockly.Msg.MATH_SQ, 'sq'], + [Blockly.Msg.MATH_SQRT, 'sqrt'] + ] +}; + +//变量定义 +export const arduino_variate_type = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(arduino_variate_type.DATATYPES), "variate_type"); + this.setOutput(true, null); + this.setColour(MATH_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + }, + DATATYPES: [ + [Blockly.Msg.LANG_MATH_INT, 'int'], + [Blockly.Msg.LANG_MATH_UNSIGNED_INT, 'unsigned int'], + [Blockly.Msg.LANG_MATH_WORD, 'word'], + [Blockly.Msg.LANG_MATH_LONG, 'long'], + [Blockly.Msg.LANG_MATH_UNSIGNED_LONG, 'unsigned long'], + [Blockly.Msg.LANG_MATH_FLOAT, 'float'], + [Blockly.Msg.LANG_MATH_DOUBLE, 'double'], + [Blockly.Msg.LANG_MATH_BOOLEAN, 'boolean'], + [Blockly.Msg.LANG_MATH_BYTE, 'byte'], + [Blockly.Msg.LANG_MATH_CHAR, 'char'], + [Blockly.Msg.LANG_MATH_UNSIGNED_CHAR, 'unsigned char'], + [Blockly.Msg.LANG_MATH_STRING, 'String'], + ["uint8_t", "uint8_t"], + ["uint16_t", "uint16_t"], + ["uint32_t", "uint32_t"], + ["uint64_t", "uint64_t"] + ] +}; + +//获取某个变量在内存中所占用的字节数 +export const math_SizeOf = { + init: function () { + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_GET + " " + Blockly.Msg.MIXLY_I2C_BYTES); + this.setInputsInline(false); + this.setOutput(true, null); + this.setColour(MATH_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//最大最小值 +export const math_max_min = { + init: function () { + this.setColour(MATH_HUE); + this.appendValueInput('A') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(math_max_min.OPERATORS), 'OP') + .appendField('('); + this.appendValueInput('B') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(','); + this.appendDummyInput('') + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(')'); + this.setInputsInline(true); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#min-max"); + this.setOutput(true, Number); + var thisBlock = this; + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('OP'); + var TOOLTIPS = { + 'max': Blockly.Msg.MIXLY_TOOLTIP_MATH_MAX, + 'min': Blockly.Msg.MIXLY_TOOLTIP_MATH_MIN + }; + return TOOLTIPS[mode]; + }); + }, + OPERATORS: [ + [Blockly.Msg.MIXLY_MAX, 'max'], + [Blockly.Msg.MIXLY_MIN, 'min'], + ] +}; + +export const math_random_seed = { + init: function () { + this.setColour(MATH_HUE); + // this.appendDummyInput() + // .appendField(Blockly.Msg.LANG_MATH_RANDOM_SEED); + this.appendValueInput('NUM') + .setCheck(Number) + .appendField(Blockly.Msg.LANG_MATH_RANDOM_SEED); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_MATH_RANDOM_SEED); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#randomseed"); + } +}; + +export const math_random_int = { + /** + * Block for random integer between [X] and [Y]. + * @this Blockly.Block + */ + init: function () { + this.setColour(MATH_HUE); + this.setOutput(true, Number); + this.appendValueInput('FROM') + .setCheck(Number) + .appendField(Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT_FROM); + this.appendValueInput('TO') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.LANG_MATH_RANDOM_INT_INPUT_TO); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MATH_RANDOM_INT_TOOLTIP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#random"); + } +}; + +export const math_constrain = { + /** + * Block for constraining a number between two limits. + * @this Blockly.Block + */ + init: function () { + this.setColour(MATH_HUE); + this.setOutput(true, Number); + this.appendValueInput('VALUE') + .setCheck(Number) + .appendField(Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_CONSTRAIN); + this.appendValueInput('LOW') + .setCheck(Number) + .appendField(Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_LOW); + this.appendValueInput('HIGH') + .setCheck(Number) + .appendField(Blockly.Msg.LANG_MATH_CONSTRAIN_INPUT_HIGH); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MATH_CONSTRAIN_TOOLTIP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#constrain"); + } +}; + +export const base_map = { + init: function () { + this.setColour(MATH_HUE); + this.appendValueInput("NUM", Number) + .appendField(Blockly.Msg.MIXLY_MAP) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.LANG_MATH_INT, "map_int"], + [Blockly.Msg.LANG_MATH_FLOAT, "map_float"] + ]), "maptype") + .setCheck(Number); + this.appendValueInput("fromLow", Number) + .appendField(Blockly.Msg.MIXLY_MAP_FROM) + .setCheck(Number); + this.appendValueInput("fromHigh", Number) + .appendField(",") + .setCheck(Number); + this.appendValueInput("toLow", Number) + .appendField(Blockly.Msg.MIXLY_MAP_TO) + .setCheck(Number); + this.appendValueInput("toHigh", Number) + .appendField(",") + .setCheck(Number); + this.appendDummyInput("") + .appendField("]"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_MATH_MAP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/03Mathematics.html#map"); + } +}; + +export const variables_operation = { + init: function () { + this.setColour(MATH_HUE); + this.appendValueInput("variables") + .setCheck(null); + this.appendValueInput("data") + .setCheck(null) + .appendField(new Blockly.FieldDropdown([ + ["+=", "+"], + ["-=", "-"], + ["*=", "*"], + ["/=", "/"] + ]), "type"); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +export const math_auto_add_or_minus = { + init: function () { + this.appendValueInput("math_auto_add_minus_output") + .setCheck(null); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + ["++", "++"], + ["--", "--"] + ]), "math_auto_add_minus_type"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(MATH_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/pinout.js b/mixly/boards/default_src/arduino_avr/blocks/pinout.js new file mode 100644 index 00000000..bedb192d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/pinout.js @@ -0,0 +1,53 @@ +import * as Blockly from 'blockly/core'; + +const PINOUT_HUE = '#555555'; + +export const uno_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/Uno.png'), 515, 372, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const nano_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/Nano.png'), 515, 368, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const mega_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/Mega.png'), 515, 736, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const promini_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ProMini.png'), 515, 371, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const leonardo_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/Leonardo.png'), 515, 371, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/pins.js b/mixly/boards/default_src/arduino_avr/blocks/pins.js new file mode 100644 index 00000000..7ad5d81e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/pins.js @@ -0,0 +1,85 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const PINS_HUE = 230; + +export const pins_digital = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.digital), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_analog = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.analog), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_pwm = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.pwm), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_interrupt = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.interrupt), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_MOSI = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.MOSI), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_MISO = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.MISO), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_SCK = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.SCK), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_SCL = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.SCL), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_SDA = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.SDA), 'PIN'); + this.setOutput(true, Number); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/scoop.js b/mixly/boards/default_src/arduino_avr/blocks/scoop.js new file mode 100644 index 00000000..1446d1d3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/scoop.js @@ -0,0 +1,57 @@ +import * as Blockly from 'blockly/core'; + +const SCOOP_HUE = 120; + +export const SCoopTask = { + init: function () { + this.appendDummyInput() + .appendField("Scoop Task") + .appendField(new Blockly.FieldDropdown(SCoopTask.NUMBER), "_tasknum"); + this.appendStatementInput("setup") + .appendField(Blockly.Msg.MIXLY_SETUP) + .setCheck(null); + this.appendStatementInput("loop") + .appendField(Blockly.Msg.MIXLY_CONTROL_SCoop_loop) + .setCheck(null); + this.setColour(SCOOP_HUE); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#scoop-task"); + }, + NUMBER: [ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"] + ] +}; + +export const SCoop_yield = { + init: function () { + this.setColour(SCOOP_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_CONTROL_SCoop_yield); + this.setPreviousStatement(false, null); + this.setNextStatement(false, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP_YIELD); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/02Control.html#scoop-task"); + } +}; + +export const SCoop_sleep = { + init: function () { + this.setColour(SCOOP_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_CONTROL_SCoop_sleep); + this.appendValueInput("sleeplength", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP_SLEEP); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/sensor.js b/mixly/boards/default_src/arduino_avr/blocks/sensor.js new file mode 100644 index 00000000..ae24f9a5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/sensor.js @@ -0,0 +1,1136 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const SENSOR_HUE = 40; + +export const gps_init = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GPS_INIT) + this.appendValueInput("RX", Number) + .appendField("RX#") + .setCheck(Number); + this.appendValueInput("TX", Number) + .appendField("TX#") + .setCheck(Number); + this.appendValueInput("CONTENT", Number) + .appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_GPS_INIT); + } +}; + +export const gps_data_available = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GPS_DATA_AVAILABLE); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_GPS_DATA_AVAILABLE); + } +}; + +export const gps_data_encode = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GPS_DATA_ENCODE); + this.setOutput(true, Boolean); + } +}; + +export const gps_xxx_isValid = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField("GPS") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_LOCATION, "location"], + [Blockly.Msg.MIXLY_GPS_DATE, "date"], + [Blockly.Msg.MIXLY_GPS_TIME, "time"] + ]), "WHAT") + .appendField(Blockly.Msg.MIXLY_GPS_ISVALID); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_GPS_DATA_VAILD); + } +}; + +export const gps_getData_xxx = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GPS_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_LOCATION_LAT, "location.lat"], + [Blockly.Msg.MIXLY_GPS_LOCATION_LNG, "location.lng"], + [Blockly.Msg.MIXLY_GPS_DATE_YEAR, "date.year"], + [Blockly.Msg.MIXLY_GPS_DATE_MONTH, "date.month"], + [Blockly.Msg.MIXLY_GPS_DATE_DAY, "date.day"], + [Blockly.Msg.MIXLY_GPS_TIME_HOUR, "time.hour"], + [Blockly.Msg.MIXLY_GPS_TIME_MINUTE, "time.minute"], + [Blockly.Msg.MIXLY_GPS_TIME_SECOND, "time.second"], + [Blockly.Msg.MIXLY_GPS_TIME_CENTISECOND, "time.centisecond"] + ]), "WHAT"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_GPS_GETDATA.replace('%1', this.getFieldValue('WHAT'))); + } +}; + +export const chaoshengbo2 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_CHAOSHENGBO); + this.appendDummyInput("") + .appendField('Trig#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "Trig") + .appendField('Echo#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "Echo"); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_CHAOSHENGBO); + // this.setFieldValue("2","Trig"); + // this.setFieldValue("4","Echo"); + } +}; + +//DHT11温湿度传感器 +export const DHT = { + init: function () { + var WHAT = [[Blockly.Msg.MIXLY_GETTEMPERATUE, 'temperature'], [Blockly.Msg.MIXLY_GETHUMIDITY, 'humidity']]; + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([['DHT11', '11'], ['DHT21', '21'], ['DHT22', '22']]), 'TYPE') + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .appendField(new Blockly.FieldDropdown(WHAT), "WHAT"); + this.setOutput(true, Number); + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue('WHAT'); + var TOOLTIPS = { + 'temperature': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_GET_TEM, + 'humidity': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_GET_HUM + }; + return TOOLTIPS[op]; + }); + } +}; + +//lm35温度传感器 +export const LM35 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("LM35" + Blockly.Msg.MIXLY_TEMP); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_LM35); + } +}; + +//DS18B20温度传感器 +export const ds18b20 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DS18B20) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN") + .appendField(Blockly.Msg.MIXLY_GETTEMPERATUE) + .appendField(new Blockly.FieldDropdown(ds18b20.UNIT), "UNIT"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS18); + }, + UNIT: [ + [Blockly.Msg.MIXLY_DS18B20_C, '0'], + [Blockly.Msg.MIXLY_DS18B20_F, '1'] + ] +}; + +//初始化MLX90614红外测温传感器 +export const mlx90614_init = { + init: function () { + this.appendValueInput("mlx90614_address") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SETUP + " MLX90614" + Blockly.Msg.MLX90614_TYPE) + .appendField(Blockly.Msg.MIXLY_LCD_ADDRESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(40); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//MLX90614获取数据 +export const mlx90614_get_data = { + init: function () { + this.appendDummyInput() + .appendField("MLX90614" + Blockly.Msg.MLX90614_TYPE) + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown(mlx90614_get_data.DATA_TYPE), "mlx90614_data"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(40); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_MLX90614_GET_DATA); + this.setHelpUrl(""); + }, + DATA_TYPE: [ + [Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℃)", "readObjectTempC"], + [Blockly.Msg.MLX90614_TARGET_OBJECT_TEMP + "(℉)", "readObjectTempF"], + [Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℃)", "readAmbientTempC"], + [Blockly.Msg.MLX90614_AMBIENT_TEMP + "(℉)", "readAmbientTempF"] + ] +}; + +//DF称重模块 +export const weightSensor = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("Hx711") + .appendField(Blockly.Msg.MIXLY_WEIGHTSENSOR); + this.appendDummyInput("") + .appendField('Dout#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "DOUT") + .appendField('SCK#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "SCK"); + this.appendValueInput("scale") + .setCheck(Number) + .appendField(Blockly.Msg.HX711_scale); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_WEIGHTSENSOR); + // this.setFieldValue("2","DOUT"); + // this.setFieldValue("4","SCK"); + } +}; + +//DS1302 RTC +export const DS1302_init = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DS1302_INITPIN); + //.appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName'); + this.appendValueInput("RST", Number) + .appendField("RST#") + .setCheck(Number); + this.appendValueInput("DAT") + .appendField("DAT#") + .setCheck(Number); + this.appendValueInput("CLK") + .appendField("CLK#") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS1302_INIT); + } +}; + +//DS1307 RTC +export const DS1307_init = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RTCINIT); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(DS1307_init.RTC_TYPE), 'RTCType'); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_PIN); + //.appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName'); + this.appendValueInput("SDA") + .appendField("SDA#") + .setCheck(Number); + this.appendValueInput("SCL") + .appendField("SCL#") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_DS1307_INIT); + }, + RTC_TYPE: [['DS1307', 'RtcDS1307'], ['DS3231', 'RtcDS3231']] +}; + +//传感器-实时时钟块_获取时间 +export const RTC_get_time = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("RTC" + Blockly.Msg.MIXLY_RTCGETTIME); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT); + //.appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName'); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(RTC_get_time.RTC_TIME_TYPE), "TIME_TYPE"); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_GETTIME.replace('%1', this.getFieldValue("TIME_TYPE"))); + }, + RTC_TIME_TYPE: [ + [Blockly.Msg.MIXLY_YEAR, "Year"], + [Blockly.Msg.MIXLY_MONTH, "Month"], + [Blockly.Msg.MIXLY_DAY, "Day"], + [Blockly.Msg.MIXLY_HOUR, "Hour"], + [Blockly.Msg.MIXLY_MINUTE, "Minute"], + [Blockly.Msg.MIXLY_SECOND, "Second"], + [Blockly.Msg.MIXLY_WEEK, "DayOfWeek"] + ] +}; + +// //传感器-实时时钟块_设置时间 +export const RTC_time = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendValueInput("hour") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_HOUR); + this.appendValueInput("minute") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MINUTE); + this.appendValueInput("second") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SECOND); + this.setInputsInline(true); + this.setOutput(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_SETTIME); + } +}; + +export const RTC_date = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendValueInput("year") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_YEAR); + this.appendValueInput("month") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MONTH); + this.appendValueInput("day") + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DAY); + this.setInputsInline(true); + this.setOutput(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_SETTIME); + } +}; + +//设置时间 +export const RTC_set_time = { + init: function () { + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("RTC" + Blockly.Msg.MIXLY_RTCSETTIME); + this.appendValueInput("date") + .appendField(Blockly.Msg.MIXLY_GPS_DATE); + this.appendValueInput("time") + .appendField(Blockly.Msg.MIXLY_GPS_TIME); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//获取烧录时间和日期 +export const get_system_date_time = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GET + " " + Blockly.Msg.MIXLY_SYSTEM) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_DATE, "DATE"], + [Blockly.Msg.MIXLY_GPS_TIME, "TIME"] + ]), "type"); + this.setInputsInline(false); + this.setOutput(true, null); + this.setColour(40); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//传感器-实时时钟块_设置日期 +export const RTC_set_date = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RTCSETDATE); + // .appendField(new Blockly.FieldTextInput('myRTC'), 'RTCName'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_RTC_SETDATE); + } +}; + +export const SHT20 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("SHT20" + Blockly.Msg.MIXLY_DHT11_T_H); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(SHT20.SHT20_TYPE), "SHT20_TYPE"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(); + }, + SHT20_TYPE: [ + [Blockly.Msg.MIXLY_TEMPERATURE, "sht20.readTemperature()"], + [Blockly.Msg.MIXLY_Humidity, "sht20.readHumidity()"], + ] +}; + +//传感器-重力感应块-获取数据 +export const ADXL345 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ADXL345); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(ADXL345.ADXL345_GETAB), "ADXL345_PIN"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(); + }, + ADXL345_GETAB: [ + [Blockly.Msg.MixGo_MPU9250_AX, "accel.getAccelerationX()"], + [Blockly.Msg.MixGo_MPU9250_AY, "accel.getAccelerationY()"], + [Blockly.Msg.MixGo_MPU9250_AZ, "accel.getAccelerationZ()"], + [Blockly.Msg.MixGo_MPU9250_AX + "(g)", "accel.getAccelerationX()/256.0"], + [Blockly.Msg.MixGo_MPU9250_AY + "(g)", "accel.getAccelerationY()/256.0"], + [Blockly.Msg.MixGo_MPU9250_AZ + "(g)", "accel.getAccelerationZ()/256.0"], + ] +}; + +var LIS3DHTR_GETDATA = [ + [Blockly.Msg.MixGo_MPU9250_AX, "LIS.getAccelerationX()"], + [Blockly.Msg.MixGo_MPU9250_AY, "LIS.getAccelerationY()"], + [Blockly.Msg.MixGo_MPU9250_AZ, "LIS.getAccelerationZ()"], + [Blockly.Msg.MIXLY_TEMPERATURE, "LIS.getTemperature()"], +]; + +export const LIS3DHTR = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField('LIS3DHTR' + Blockly.Msg.MixGo_MPU9250); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(LIS3DHTR_GETDATA), "LIS3DHTR_GETDATA"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(); + } +}; + +export const ADXL345_setOffset = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETTING) + .appendField('ADXL345') + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET); + this.appendValueInput("OFFSET") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_X, "setOffsetX"], + [Blockly.Msg.MIXLY_DISPLAY_MATRIX_Y, "setOffsetY"], + [Blockly.Msg.MIXLY_Z_AXIS, "setOffsetZ"] + ]), "MIXEPI_ADXL345_OFFSET"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +//传感器-MPU6050-获取数据 +export const MPU6050 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MPU6050); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_Accel_X, "getAccX()"], + [Blockly.Msg.MIXLY_Accel_Y, "getAccY()"], + [Blockly.Msg.MIXLY_Accel_Z, "getAccZ()"], + [Blockly.Msg.MIXLY_Gyro_X, "getAngleX()"], + [Blockly.Msg.MIXLY_Gyro_Y, "getAngleY()"], + [Blockly.Msg.MIXLY_Gyro_Z, "getAngleZ()"], + [Blockly.Msg.MIXLY_readTempC, "getTemp()"] + ]), "MPU6050_TYPE"); + this.setInputsInline(true); + this.setOutput(true); + } +}; + +//传感器-MPU6050-更新数据 +export const MPU6050_update = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MPU6050 + Blockly.Msg.MIXLY_update_data); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +const Encoder_NO = [ + [Blockly.Msg.MIXLY_ENCODER + 1, "1"], + [Blockly.Msg.MIXLY_ENCODER + 2, "2"], + [Blockly.Msg.MIXLY_ENCODER + 3, "3"], + [Blockly.Msg.MIXLY_ENCODER + 4, "4"] +]; + +//旋转编码器定义 +export const encoder_init = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(Blockly.Msg.MIXLY_ENCODER); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput("") + .appendField('DT') + .appendField(new Blockly + .FieldDropdown(Profile.default.digital), "DT") + .appendField('CLK') + .appendField(new Blockly + .FieldDropdown(Profile.default.digital), "CLK"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl(""); + // this.setFieldValue("2","DT"); + // this.setFieldValue("4","CLK"); + } +}; + +//旋转编码器赋值 +export const encoder_write = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.appendValueInput("value") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(""); + this.setHelpUrl(""); + this.setInputsInline(true); + } +}; + +//旋转编码器读值 +export const encoder_read = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SERIAL_READ); + this.setOutput(true, Number); + this.setTooltip(""); + this.setHelpUrl(""); + this.setInputsInline(true); + } +}; + +//旋转编码器定义 +export const encoder_init1 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(Blockly.Msg.MIXLY_ENCODER); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput("") + .appendField('DT') + .appendField(new Blockly + .FieldDropdown(Profile.default.digital), "DT") + .appendField('CLK') + .appendField(new Blockly + .FieldDropdown(Profile.default.digital), "CLK"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl(""); + // this.setFieldValue("2","DT"); + // this.setFieldValue("4","CLK"); + } +}; + +//旋转编码器赋值 +export const encoder_write1 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.appendValueInput("value") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(""); + this.setHelpUrl(""); + this.setInputsInline(true); + } +}; + +//旋转编码器读值 +export const encoder_read1 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "Encoder_NO"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SERIAL_READ); + this.setOutput(true, Number); + this.setTooltip(""); + this.setHelpUrl(""); + this.setInputsInline(true); + } +}; + +// 旋转编码器定义 +export const sensor_encoder_init = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(new Blockly.FieldDropdown(Encoder_NO), "TYPE") + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_MODE) + .appendField(new Blockly.FieldDropdown([["1", "2"], ["2", "4"]]), "mode"); + this.appendValueInput("CLK") + .setCheck(null) + .appendField("CLK#"); + this.appendValueInput("DT") + .setCheck(null) + .appendField("DT#"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +// 旋转编码器读取 +export const sensor_encoder_get = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "TYPE") + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_LOCATION, "getPosition"], + [Blockly.Msg.MIXLY_MICROBIT_Direction, "getDirection"], + [Blockly.Msg.MIXLY_INCREMENT, "getIncrement"], + [Blockly.Msg.MIXLY_UPPERBOUND, "getUpperBound"], + [Blockly.Msg.MIXLY_LOWERBOUND, "getLowerBound"] + ]), "OPERATE_TYPE"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +// 旋转编码器设置 +export const sensor_encoder_set = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "TYPE"); + this.appendValueInput("DATA") + .setCheck(null) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_GPS_LOCATION, "resetPosition"], + [Blockly.Msg.MIXLY_INCREMENT, "setIncrement"], + [Blockly.Msg.MIXLY_UPPERBOUND, "setUpperBound"], + [Blockly.Msg.MIXLY_LOWERBOUND, "setLowerBound"] + ]), "OPERATE_TYPE") + .appendField(Blockly.Msg.MIXLY_STAT); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +// 旋转编码器事件 +export const sensor_encoder_handle = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Encoder_NO), "TYPE") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ENCODER_CHANGED, "setChangedHandler"], + [Blockly.Msg.MIXLY_ENCODER_LEFT_ROTATION, "setLeftRotationHandler"], + [Blockly.Msg.MIXLY_ENCODER_RIGHT_ROTATION, "setRightRotationHandler"], + [Blockly.Msg.MIXLY_ENCODER_UPPER_OVERFLOW, "setUpperOverflowHandler"], + [Blockly.Msg.MIXLY_ENCODER_LOWER_OVERFLOW, "setLowerOverflowHandler"] + ]), "OPERATE_TYPE"); + this.appendStatementInput("DO") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setInputsInline(true); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//BME280读取 +export const BME280_READ = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SERIAL_READ) + .appendField(new Blockly.FieldDropdown([["BME280", "bme"], ["BMP280", "bmp"]]), 'TYPE'); + this.appendValueInput("address") + .appendField(Blockly.Msg.MIXLY_LCD_ADDRESS); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDependentDropdown( + "TYPE", this.BMX280_VALUE_TYPE, this.BMX280_VALUE_TYPE['bme']), 'BME_TYPE' + ); + this.setOutput(true, null); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl(""); + }, + BMX280_VALUE_TYPE: { + bme: [ + [Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"], + [Blockly.Msg.MIXLY_Humidity, "readHumidity()"], + [Blockly.Msg.MIXLY_Altitude, "readPressure()"], + [Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"] + ], + bmp: [ + [Blockly.Msg.blynk_IOT_IR_TEMP, "readTemperature()"], + [Blockly.Msg.MIXLY_Altitude, "readPressure()"], + [Blockly.Msg.MIXLY_HEIGHT, "readAltitude(SEALEVELPRESSURE_HPA)"] + ] + } +}; + +//PS2 +export const PS2_init = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.PS2); + this.appendDummyInput("") + .appendField('DAT#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PS2_DAT") + .appendField('CMD#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PS2_CMD") + .appendField('SEL#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PS2_SEL") + .appendField('CLK#') + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PS2_CLK"); + this.appendDummyInput("") + .appendField(Blockly.Msg.PS2_setRumble) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ON, "true"], + [Blockly.Msg.MIXLY_OFF, "false"] + ]), "rumble"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(''); + this.setFieldValue("2", "PS2_DAT"); + this.setFieldValue("4", "PS2_CMD"); + this.setFieldValue("5", "PS2_SEL"); + this.setFieldValue("12", "PS2_CLK"); + } +}; + +export const PS2_update = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.PS2 + Blockly.Msg.MIXLY_update_data); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +// +export const PS2_Button = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.PS2_BUTTON) + .appendField(new Blockly.FieldDropdown(PS2_Button.PSBUTTON), "psbt") + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_BUTTON_HOLD, "Button"], + [Blockly.Msg.MIXLY_BUTTON_PRESSED, "ButtonPressed"], + [Blockly.Msg.MIXLY_BUTTON_RELEASED, "ButtonReleased"], + [Blockly.Msg.MIXLY_CHANGE, "NewButtonState"] + ]), "btstate"); + this.setOutput(true, Boolean); + this.setTooltip(''); + }, + PSBUTTON: [ + [Blockly.Msg.PS2_TRIANGLE, "PSB_GREEN"], + [Blockly.Msg.PS2_CIRCLE, "PSB_RED"], + [Blockly.Msg.PS2_CROSS, "PSB_BLUE"], + [Blockly.Msg.PS2_SQUARE, "PSB_PINK"], + [Blockly.Msg.PS2_L1, "PSB_L1"], + [Blockly.Msg.PS2_L2, "PSB_L2"], + // ["PSB_L3","PSB_L3"], + [Blockly.Msg.PS2_R1, "PSB_R1"], + [Blockly.Msg.PS2_R2, "PSB_R2"], + // ["PSB_R3","PSB_R3"], + [Blockly.Msg.PS2_UP, "PSB_PAD_UP"], + [Blockly.Msg.PS2_RIGHT, "PSB_PAD_RIGHT"], + [Blockly.Msg.PS2_DOWN, "PSB_PAD_DOWN"], + [Blockly.Msg.PS2_LEFT, "PSB_PAD_LEFT"], + [Blockly.Msg.PS2_SELECT, "PSB_SELECT"], + [Blockly.Msg.PS2_START, "PSB_START"] + ] +}; + +export const PS2_stk = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.PS2_stick) + .appendField(new Blockly.FieldDropdown(PS2_stk.PSSTK), "psstk"); + this.setOutput(true, Number); + this.setTooltip(''); + }, + PSSTK: [ + [Blockly.Msg.PS2_RX, "PSS_RX"], + [Blockly.Msg.PS2_RY, "PSS_RY"], + [Blockly.Msg.PS2_LX, "PSS_LX"], + [Blockly.Msg.PS2_LY, "PSS_LY"], + ] +}; + +export const TCS34725_Get_RGB = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.TCS34725_Get_RGB) + .appendField(new Blockly.FieldDropdown(TCS34725_Get_RGB.DF_TCS34725_COLOR), "DF_TCS34725_COLOR"); + this.setInputsInline(true); + this.setOutput(true); + }, + DF_TCS34725_COLOR: [ + [Blockly.Msg.COLOUR_RGB_RED, "tcs34725.getRedToGamma()"], + [Blockly.Msg.COLOUR_RGB_GREEN, "tcs34725.getGreenToGamma()"], + [Blockly.Msg.COLOUR_RGB_BLUE, "tcs34725.getBlueToGamma()"], + ] +}; + +//初始化TCS230颜色传感器 +export const tcs230_init = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + " TCS230"); + this.appendValueInput("tcs230_s0") + .setCheck(null) + .appendField("S0"); + this.appendValueInput("tcs230_s1") + .setCheck(null) + .appendField("S1"); + this.appendValueInput("tcs230_s2") + .setCheck(null) + .appendField("S2"); + this.appendValueInput("tcs230_s3") + .setCheck(null) + .appendField("S3"); + this.appendValueInput("tcs230_led") + .setCheck(null) + .appendField("LED"); + this.appendValueInput("tcs230_out") + .setCheck(null) + .appendField("OUT"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//TCS230颜色传感器 获取RGB值 +export const tcs230_Get_RGB = { + init: function () { + this.appendDummyInput() + .appendField("TCS230") + .appendField(Blockly.Msg.MIXLY_GET) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.COLOUR_RGB_RED, "R"], + [Blockly.Msg.COLOUR_RGB_GREEN, "G"], + [Blockly.Msg.COLOUR_RGB_BLUE, "B"] + ]), "tcs230_color"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const Arduino_keypad_4_4_start = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_Keypad); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldTextInput("KEYPAD_4_4"), "keypad_name"); + this.appendValueInput("keypad_row") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.DATAFRAME_RAW + Blockly.Msg.MIXLY_PIN); + this.appendValueInput("keypad_col") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.DATAFRAME_COLUMN + Blockly.Msg.MIXLY_PIN); + this.appendValueInput("keypad_type") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_Keypad_define); + this.setNextStatement(true, null); + this.setPreviousStatement(true); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const keypad_row_data = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendValueInput("keypad_row_1", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("1#"); + this.appendValueInput("keypad_row_2", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("2#"); + this.appendValueInput("keypad_row_3", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("3#"); + this.appendValueInput("keypad_row_4", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("4#"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const keypad_col_data = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendValueInput("keypad_col_1", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("1#"); + this.appendValueInput("keypad_col_2", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("2#"); + this.appendValueInput("keypad_col_3", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("3#"); + this.appendValueInput("keypad_col_4", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("4#"); + this.setInputsInline(true); + this.setOutput(true, null); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const keypad_type_data = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldTextInput("1"), "keypad_1_1") + .appendField(new Blockly.FieldTextInput("2"), "keypad_1_2") + .appendField(new Blockly.FieldTextInput("3"), "keypad_1_3") + .appendField(new Blockly.FieldTextInput("A"), "keypad_1_4"); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldTextInput("4"), "keypad_2_1") + .appendField(new Blockly.FieldTextInput("5"), "keypad_2_2") + .appendField(new Blockly.FieldTextInput("6"), "keypad_2_3") + .appendField(new Blockly.FieldTextInput("B"), "keypad_2_4"); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldTextInput("7"), "keypad_3_1") + .appendField(new Blockly.FieldTextInput("8"), "keypad_3_2") + .appendField(new Blockly.FieldTextInput("9"), "keypad_3_3") + .appendField(new Blockly.FieldTextInput("C"), "keypad_3_4"); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.CENTRE) + .appendField(new Blockly.FieldTextInput("*"), "keypad_4_1") + .appendField(new Blockly.FieldTextInput("0"), "keypad_4_2") + .appendField(new Blockly.FieldTextInput("#"), "keypad_4_3") + .appendField(new Blockly.FieldTextInput("D"), "keypad_4_4"); + this.setOutput(true, null); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const get_keypad_num = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("KEYPAD_4_4"), "keypad_name") + .appendField(Blockly.Msg.MIXLY_Keypad_GETKEY); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const arduino_keypad_event = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_Keypad) + .appendField(new Blockly.FieldTextInput("KEYPAD_4_4"), "keypad_name"); + this.appendValueInput("keypad_event_input") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_Keypad_EVENT); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_MONITOR_SCROLL_INTERVAL) + .appendField(new Blockly.FieldTextInput("1000"), "keypad_start_event_delay") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.appendStatementInput("keypad_event_data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_DO); + this.setInputsInline(false); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//传感器_重力感应块_获取9轴数据 +export const mixgo_MPU9250 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("MPU9250" + Blockly.Msg.MixGo_MPU9250); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(mixgo_MPU9250.MixGo_MPU9250_GETAB), "MixGo_MPU9250_GETAB"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(""); + this.setHelpUrl(''); + }, + MixGo_MPU9250_GETAB: [ + [Blockly.Msg.MixGo_MPU9250_AX, "a"], + [Blockly.Msg.MixGo_MPU9250_AY, "b"], + [Blockly.Msg.MixGo_MPU9250_AZ, "c"], + [Blockly.Msg.MixGo_MPU9250_GX, "d"], + [Blockly.Msg.MixGo_MPU9250_GY, "e"], + [Blockly.Msg.MixGo_MPU9250_GZ, "f"], + [Blockly.Msg.MixGo_MPU9250_MX, "g"], + [Blockly.Msg.MixGo_MPU9250_MY, "h"], + [Blockly.Msg.MixGo_MPU9250_MZ, "i"] + ] +}; + +//NTC电阻 +export const NTC_TEMP = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("NTC") + .appendField(Blockly.Msg.MIXLY_TEMP); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.digital), "PIN"); + this.appendValueInput("NominalResistance") + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_NominalResistance); + this.appendValueInput("betaCoefficient") + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_betaCoefficient); + this.appendValueInput("seriesResistor") + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_seriesResistor); + this.setInputsInline(false); + this.setOutput(true, Number); + this.setTooltip(); + } +}; + +//AHT20/21温湿度传感器 +export const AHT20_21 = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("AHT20/21" + Blockly.Msg.MIXLY_TEM_HUM) + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_TEMPERATURE, "AHT21.GetTemperature()"], + [Blockly.Msg.MIXLY_Humidity, "AHT21.GetHumidity()"], + [Blockly.Msg.MIXLY_DewPoint, "AHT21.GetDewPoint()"] + ]), "AHT21_TYPE"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/serial.js b/mixly/boards/default_src/arduino_avr/blocks/serial.js new file mode 100644 index 00000000..bf5fdf7e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/serial.js @@ -0,0 +1,198 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const SERIAL_HUE = 65; + +export const serial_begin = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_BEGIN); + } +}; + +export const serial_write = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_WRITE); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_WRITE_TOOLTIP); + } +}; + +export const serial_print = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"], + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"] + ]), "new_line"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP); + } +}; + +export const serial_println = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"], + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"] + ]), "new_line"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP); + } +}; + +export const serial_print_num = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"], + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"] + ]), "new_line") + .appendField(Blockly.Msg.MIXLY_NUMBER); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MATH_HEX, "HEX"], + [Blockly.Msg.MATH_BIN, "BIN"], + [Blockly.Msg.MATH_OCT, "OCT"], + [Blockly.Msg.MATH_DEC, "DEC"] + ]), "STAT") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.TEXT_PRINT_HEX_TOOLTIP); + } +}; + +export const serial_print_hex = serial_print_num; + +export const serial_available = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_AVAILABLE); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_AVAILABLE); + } +}; + +export const serial_readstr = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_READSTR); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_STR); + } +}; + +export const serial_readstr_until = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_READSTR_UNTIL) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_READSTRUNITL.replace('%1', Blockly.Arduino.valueToCode(this, 'CONTENT', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const serial_parseInt_Float = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + //.appendField(Blockly.Msg.MIXLY_SERIAL_READ) + .appendField(new Blockly.FieldDropdown([ + ["read", "read"], + ["peek", "peek"], + ["parseInt", "parseInt"], + ["parseFloat", "parseFloat"] + ]), "STAT"); + this.setOutput(true, Number); + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue('STAT'); + var TOOLTIPS = { + 'parseInt': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_INT, + 'parseFloat': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_FLOAT + }; + return TOOLTIPS[op]; + }); + } +}; + +export const serial_flush = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_FLUSH); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_FLUSH); + } +}; + +export const serial_softserial = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select"); + this.appendValueInput("RX", Number) + .setCheck(Number) + .appendField("RX#") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("TX", Number) + .appendField("TX#") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SOFTSERIAL.replace('%1', Blockly.Arduino.valueToCode(this, 'RX', Blockly.Arduino.ORDER_ATOMIC)) + .replace('%2', Blockly.Arduino.valueToCode(this, 'TX', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const serial_event = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_EVENT); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIALEVENT); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/storage.js b/mixly/boards/default_src/arduino_avr/blocks/storage.js new file mode 100644 index 00000000..2c232300 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/storage.js @@ -0,0 +1,309 @@ +import * as Blockly from 'blockly/core'; + +const STORAGE_HUE = 0; + +export const store_sd_init = { + init: function () { + this.appendDummyInput("") + .appendField("SD") + .appendField(Blockly.Msg.MIXLY_SETUP); + this.appendValueInput("PIN_MOSI") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MOSI") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_MISO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MISO") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_SCK") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CLK") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_CS") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CS") + .appendField(Blockly.Msg.MIXLY_PIN); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setInputsInline(false); + this.setTooltip(); + this.setHelpUrl(''); + } +}; + +export const store_sd_init_32 = { + init: function () { + this.appendDummyInput("") + .appendField("SD") + .appendField(Blockly.Msg.MIXLY_SETUP); + this.appendValueInput("PIN_MOSI") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MOSI") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_MISO") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("MISO") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_SCK") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CLK") + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput("PIN_CS") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField("CS") + .appendField(Blockly.Msg.MIXLY_PIN); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setInputsInline(false); + this.setTooltip(); + this.setHelpUrl(''); + } +}; + +export const sd_card_type = { + init: function () { + this.appendDummyInput() + .appendField("SD" + Blockly.Msg.MIXLY_TYPE); + this.setOutput(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const sd_card_root_files = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SD_LIST_FILES); + this.setOutput(false, null); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const sd_volume = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendDummyInput() + .appendField("SD") + .appendField(new Blockly.FieldDropdown(sd_volume.VOLUME_TYPE), 'volume_TYPE'); + this.setOutput(true, Number); + this.setTooltip(); + }, + VOLUME_TYPE: [ + [Blockly.Msg.MIXLY_SD_clusterCount, 'volume.clusterCount()'], + [Blockly.Msg.MIXLY_SD_blocksPerCluster, 'volume.blocksPerCluster()'], + [Blockly.Msg.MIXLY_SD_TOTAL_blocks, 'volume.blocksPerCluster() * volume.clusterCount()'], + ["FAT" + Blockly.Msg.MIXLY_TYPE, 'volume.fatType()'], + [Blockly.Msg.MIXLY_volume + "(KB)", 'volume.blocksPerCluster()*volume.clusterCount()/2'], + [Blockly.Msg.MIXLY_volume + "(MB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024'], + [Blockly.Msg.MIXLY_volume + "(GB)", 'volume.blocksPerCluster()*volume.clusterCount()/2/1024/1024.0'], + ] +}; + +export const sd_exist = { + init: function () { + this.appendValueInput("FileName"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SD_FILE_Exist); + this.setOutput(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const sd_DelFile = { + init: function () { + this.appendValueInput("FileName") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_DELETE_VAR); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const sd_read = { + init: function () { + this.appendValueInput("FileName") + .appendField(Blockly.Msg.MIXLY_SERIAL_READ); + this.setOutput(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const store_sd_write = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("FILE") + .appendField(Blockly.Msg.MIXLY_WRITE_SD_FILE); + this.appendValueInput("DATA", String) + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendValueInput("NEWLINE", Boolean) + .setCheck(Boolean) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_NEWLINE); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_SDWRITE); + } +}; + +export const store_eeprom_write_long = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_EEPROM_WRITE_LONG); + this.appendValueInput("DATA", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DATA); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_WRITELONG); + } +}; + +export const store_eeprom_read_long = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_EEPROM_READ_LONG); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_READLONG); + } +}; + + +export const store_eeprom_write_byte = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_EEPROM_WRITE_BYTE); + this.appendValueInput("DATA", Number) + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DATA); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_WRITEBYTE); + } +}; + +export const store_eeprom_read_byte = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS", Number) + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_EEPROM_READ_BYTE); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_READBYTE); + } +}; + +export const store_eeprom_put = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ESP32_WRITE) + .appendField("EEPROM") + .appendField(Blockly.Msg.MQTT_SERVER_ADD); + this.appendValueInput("DATA") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_PUT); + } +}; + +export const store_eeprom_get = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("ADDRESS") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SERIAL_READ) + .appendField("EEPROM") + .appendField(Blockly.Msg.MQTT_SERVER_ADD); + this.appendValueInput("DATA") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.SAVETO + ' ' + Blockly.Msg.MSG["catVar"]); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_EEPROM_GET); + } +}; + +export const simple_spiffs_read = { + init: function () { + this.appendValueInput("FileName") + .appendField(Blockly.Msg.MIXLY_SERIAL_READ); + this.setOutput(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const simple_spiffs_store_spiffs_write = { + init: function () { + this.setColour(STORAGE_HUE); + this.appendValueInput("FILE") + .appendField(Blockly.Msg.MIXLY_WRITE_SPIFFS_FILE); + this.appendValueInput("DATA", String) + .setCheck([String, Number]) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendValueInput("NEWLINE", Boolean) + .setCheck(Boolean) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SD_NEWLINE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown(simple_spiffs_store_spiffs_write.OPEN_MODE), 'MODE'); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_STORE_SDWRITE); + }, + OPEN_MODE: [ + [Blockly.Msg.TEXT_WRITE_TEXT, '1'], + [Blockly.Msg.TEXT_APPEND_APPENDTEXT, '2'] + ] +}; + +export const simple_spiffs_DelFile = { + init: function () { + this.appendValueInput("FileName") + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_DELETE_VAR); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/text.js b/mixly/boards/default_src/arduino_avr/blocks/text.js new file mode 100644 index 00000000..1d9dfdeb --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/text.js @@ -0,0 +1,589 @@ +import * as Blockly from 'blockly/core'; + +const TEXTS_HUE = 160; + +export const text = { + /** + * Block for text value. + * @this Blockly.Block + */ + init: function () { + //this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL); + this.setColour(TEXTS_HUE); + this.appendDummyInput() + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput(''), 'TEXT') + .appendField(this.newQuote_(false)); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP); + }, + /** + * Create an image of an open or closed quote. + * @param {boolean} open True if open quote, false if closed. + * @return {!Blockly.FieldImage} The field image of the quote. + * @private + */ + newQuote_: function (open) { + if (open == this.RTL) { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg=='; + } else { + var file = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC'; + } + return new Blockly.FieldImage(file, 12, 12, '"'); + } +}; + +const charValidator = function (text) { + if (text.length > 1) { + if (text.charAt(0) === "\\") { + var charAtOne = text.charAt(1); + if (charAtOne === "0" || + charAtOne === "b" || + charAtOne === "f" || + charAtOne === "n" || + charAtOne === "r" || + charAtOne === "t" || + charAtOne === "\\" || + charAtOne === "'") { + return String(text).substring(0, 2); + } else if (charAtOne === "x" && text.charAt(2) === "0" && text.charAt(3) === "B") { + return String(text).substring(0, 4); + } + } + } + return String(text).substring(0, 1); +}; + +export const text_char = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendDummyInput() + .appendField(this.newQuote_(true)) + .appendField(new Blockly.FieldTextInput('', charValidator), 'TEXT') + .appendField(this.newQuote_(false)); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.TEXT_CHAR_TOOLTIP); + }, + newQuote_: function (open) { + if (open == true) { + var file = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAkBAMAAAB/KNeuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAbUExURQAAAP///////////////////////////////+tNPsIAAAAIdFJOUwAe1q4KRGaFPS0VAQAAAKlJREFUGNNVkD0LwkAMhlNsnUvBH+DmKnXoeODgWgXBsaOj+AGuVfTys8318l7OTA/hTe7JEWmVNwekA/fAHfNSsVoxew0/mfkbeSvo6wkLSbx0tJH2XdPS/pClsfxs7TA5WOQNl5M9X3bMF8RlS608z+JhFOZNMowybftw4GDvjHmTsc84PJJ4iPbgWcZVxuEUMHXKvS2dZHVgxJHpV4qr4Brei+Oe/usHT1JfDpNGeM0AAAAASUVORK5CYII="; + + } else { + var file = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAkBAMAAAB/KNeuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAbUExURQAAAP///////////////////////////////+tNPsIAAAAIdFJOUwAe1q4KRGaFPS0VAQAAAKpJREFUGNNV0bEKAjEMBuActOd6KIKrg+h4cII3Cg6u5yA6Ot4DONxcUfPYJmnaxn/6KEmaUoD/LK+XxAUibhuhR85bvBLjQHR99DqXIL7ItTo0xdyQ3RrvjWlQZQyT8cnYjcXgbl2XzBmNe5kv4WUfar6kUc9o56N6nh4Zy1NrHZ8iuSN+lB5LCR0HnXIuy/hd7qymUs3bf7WajsNQrn9CHr7Jn+IOaUH4ATxJW2wDnL5kAAAAAElFTkSuQmCC"; + } + return new Blockly.FieldImage(file, 7, 12, '"'); + } +}; + +export const text_join = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput('A') + .setCheck([String, Number]); + this.appendValueInput('B') + .setCheck([String, Number]) + .appendField(Blockly.Msg.MIXLY_TEXT_JOIN); + this.setInputsInline(true); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_JOIN); + } +}; + +export const text_to_number = { + init: function () { + var TO_INT_FLOAT = [ + [Blockly.Msg.MIXLY_TO_INT, 'toInt'], + [Blockly.Msg.MIXLY_TO_FLOAT, 'toFloat'] + ]; + this.setColour(TEXTS_HUE); + this.appendValueInput('VAR') + .setCheck([String, Number]) + .appendField(new Blockly.FieldDropdown(TO_INT_FLOAT), 'TOWHAT'); + this.setOutput(true, Number); + var thisBlock = this; + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('TOWHAT'); + var TOOLTIPS = { + 'toInt': Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOINT, + 'toFloat': Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOFLOAT + }; + return TOOLTIPS[mode]; + }); + } +}; + +export const ascii_to_char = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput('VAR') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_TOCHAR); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOCHAR); + } +}; + +export const char_to_ascii = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_TOASCII) + .appendField("'") + .appendField(new Blockly.FieldTextInput('', charValidator), 'TEXT') + .appendField("'"); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOASCII); + } +}; + +export const number_to_text = { + init: function () { + var TO_INT_FLOAT = [ + [Blockly.Msg.MATH_BIN, 'BIN'], + [Blockly.Msg.MATH_OCT, 'OCT'], + [Blockly.Msg.MATH_DEC, 'DEC'], + [Blockly.Msg.MATH_HEX, 'HEX'] + ]; + this.setColour(TEXTS_HUE); + this.appendValueInput('VAR') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_TOSTRING) + .appendField(new Blockly.FieldDropdown(TO_INT_FLOAT), 'TOWHAT'); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOTEXT); + } +}; + +export const number_to_text_ = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput('VAR') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_TOSTRING); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_TOTEXT); + } +}; + +export const text_length = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput("VAR") + .appendField(Blockly.Msg.MIXLY_LENGTH) + .setCheck(String); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_TEXT_LENGTH); + } +}; + +export const text_char_at = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput("VAR") + .setCheck(String); + this.appendValueInput("AT") + .appendField(Blockly.Msg.TEXT_CHARAT) + .setCheck(Number); + this.appendDummyInput() + .appendField(Blockly.Msg.TEXT_CHARAT2); + this.setOutput(true, Number); + this.setInputsInline(true); + var self = this; + this.setTooltip(function () { + return Blockly.Msg.MIXLY_TOOLTIP_TEXT_FIND_CHAR_AT.replace('%1', Blockly.Arduino.valueToCode(self, 'VAR', Blockly.Arduino.ORDER_ATOMIC)); + }); + } +}; + +export const text_equals_starts_ends = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput("STR1") + .setCheck([String, Number]); + this.appendValueInput("STR2") + .appendField(new Blockly.FieldDropdown(text_equals_starts_ends.TEXT_DOWHAT), 'DOWHAT') + .setCheck([String, Number]); + this.setOutput(true, [Boolean, Number]); + this.setInputsInline(true); + var self = this; + this.setTooltip(function () { + var op = self.getFieldValue('DOWHAT'); + var TOOLTIPS = { + 'equals': Blockly.Msg.MIXLY_EQUALS, + 'startsWith': Blockly.Msg.MIXLY_STARTSWITH, + 'endsWith': Blockly.Msg.MIXLY_ENDSWITH + }; + return Blockly.Msg.MIXLY_TOOLTIP_TEXT_EQUALS_STARTS_ENDS.replace('%1', TOOLTIPS[op]).replace('%2', Blockly.Arduino.valueToCode(self, 'STR2', Blockly.Arduino.ORDER_ATOMIC)); + }); + }, + TEXT_DOWHAT: [ + [Blockly.Msg.MIXLY_EQUALS, 'equals'], + [Blockly.Msg.MIXLY_STARTSWITH, 'startsWith'], + [Blockly.Msg.MIXLY_ENDSWITH, 'endsWith'] + ] +}; + +export const text_compareTo = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput("STR1") + .setCheck([String, Number]); + this.appendValueInput("STR2") + .appendField(Blockly.Msg.MIXLY_COMPARETO) + .setCheck([String, Number]); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_COMPARETO_HELP); + } +}; + +//小数获取有效位 +export const decimal_places = { + init: function () { + this.setColour(TEXTS_HUE); + this.appendValueInput("numeral") + .setCheck(null) + .appendField(Blockly.Msg.LANG_MATH_FLOAT); + this.appendValueInput("decimal_places") + .setCheck(null) + .appendField(Blockly.Msg.TEXT_KEEP); + this.appendDummyInput() + .appendField(Blockly.Msg.TEXT_DECIMAL); + this.setOutput(true, null); + this.setTooltip(Blockly.Msg.DECIMAL_PLACES_HELP); + this.setHelpUrl(""); + } +}; + +//截取字符串 +export const substring = { + init: function () { + this.appendValueInput("name") + .setCheck(null); + this.appendValueInput("Start") + .setCheck(null) + .appendField(Blockly.Msg.LISTS_GET_INDEX_GET); + this.appendValueInput("end") + .setCheck(null) + .appendField(Blockly.Msg.TEXT_TO); + this.appendDummyInput() + .appendField(Blockly.Msg.LANG_MATH_STRING); + this.setOutput(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.SUBSTRING_HELP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/05Text.html#id13"); + } +}; + +//字符串转化为大小写 +export const letter_conversion = { + init: function () { + this.appendValueInput("String") + .setCheck(null) + .appendField(Blockly.Msg.STRING_VARIABLE); + this.appendDummyInput() + .appendField(Blockly.Msg.LETTERS_ARE_CONVERTED_TO) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.CAPITAL, ".toUpperCase()"], + [Blockly.Msg.LOWER_CASE, ".toLowerCase()"] + ]), "type"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.LETTER_CONVERSION_HELP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/05Text.html#id19"); + } +}; + +//字符串变量替换 +export const data_replacement = { + init: function () { + this.appendValueInput("String") + .setCheck(null) + .appendField(Blockly.Msg.STRING_VARIABLE); + this.appendValueInput("source_data") + .setCheck(null) + .appendField(Blockly.Msg.LANG_MATH_STRING); + this.appendValueInput("replace") + .setCheck(null) + .appendField(Blockly.Msg.REPLACE_WITH); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.DATA_REPLACEMENT_HELP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/05Text.html#id23"); + } +}; + +//消除非可视字符 +export const eliminate = { + init: function () { + this.appendValueInput("String") + .setCheck(null) + .appendField(Blockly.Msg.STRING_VARIABLE); + this.appendDummyInput() + .appendField(Blockly.Msg.ELIMINATE_NON_VISUAL_CHARACTERS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.ELIMINATE_HELP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/05Text.html#id27"); + } +}; + +//检测是否以特定字符串开头或结尾 +export const first_and_last = { + init: function () { + this.appendValueInput("String") + .setCheck(null) + .appendField(Blockly.Msg.LANG_MATH_STRING); + this.appendValueInput("String1") + .setCheck(null) + .appendField(Blockly.Msg.AS_A_STRING); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.STARTSWITH, ".startsWith"], + [Blockly.Msg.ENDSWITH, ".endsWith"] + ]), "type"); + this.setOutput(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.FIRST_AND_LAST_HELP); + this.setHelpUrl("https://mixly.readthedocs.io/zh-cn/latest/Arduino/AVR/05Text.html#id31"); + } +}; + +//数据类型转换 +export const type_conversion = { + init: function () { + this.appendValueInput("variable") + .setCheck(null) + .appendField(Blockly.Msg.DATA_TYPE_CONVERSION) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.LANG_MATH_STRING, "String"], + [Blockly.Msg.LANG_MATH_CHAR, "char"], + [Blockly.Msg.LANG_MATH_BYTE, "byte"], + [Blockly.Msg.LANG_MATH_INT, "int"], + [Blockly.Msg.LANG_MATH_LONG, "long"], + [Blockly.Msg.LANG_MATH_FLOAT, "float"], + [Blockly.Msg.LANG_MATH_WORD, "word"] + ]), "type"); + this.setOutput(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(Blockly.Msg.TYPE_CONVERSION_HELP); + this.setHelpUrl(""); + } +}; + +export const create_with_item = { + /** + * Mutator bolck for adding items. + * @this Blockly.Block + */ + init: function () { + this.setColour(TEXTS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP); + this.contextMenu = false; + } +}; + +export const create_with_container = { + /** + * Mutator block for list container. + * @this Blockly.Block + */ + init: function () { + this.setColour(TEXTS_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.HTML_TEXT); + this.appendStatementInput('STACK'); + this.setTooltip(""); + this.contextMenu = false; + } +}; + +export const String_indexOf = { + init: function () { + this.appendValueInput("str1") + .setCheck(null); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN); + this.appendValueInput("str2") + .setCheck(null); + this.appendDummyInput() + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.SERIES_INDEX); + this.setInputsInline(true); + this.setOutput(true, null); + this.setColour(160); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +export const text_join2 = { + /** + * Block for creating a list with any number of elements of any type. + * @this Blockly.Block + */ + init: function () { + this.setColour(TEXTS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_TEXT_JOIN + Blockly.Msg.MIXLY_MICROBIT_TYPE_STRING); + this.itemCount_ = 3; + this.updateShape_(); + this.setInputsInline(true); + this.setOutput(true, null); + this.setMutator(new Blockly.icons.MutatorIcon(['create_with_item'], this)); + this.setTooltip(""); + }, + /** + * Create XML to represent list inputs. + * @return {Element} XML storage element. + * @this Blockly.Block + */ + mutationToDom: function () { + var container = Blockly.utils.xml.createElement('mutation'); + container.setAttribute('items', this.itemCount_); + return container; + }, + /** + * Parse XML to restore the list inputs. + * @param {!Element} xmlElement XML storage element. + * @this Blockly.Block + */ + domToMutation: function (xmlElement) { + this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10); + this.updateShape_(); + }, + /** + * Populate the mutator's dialog with this block's components. + * @param {!Blockly.Workspace} workspace Mutator's workspace. + * @return {!Blockly.Block} Root block in mutator. + * @this Blockly.Block + */ + decompose: function (workspace) { + var containerBlock = + workspace.newBlock('create_with_container'); + containerBlock.initSvg(); + var connection = containerBlock.getInput('STACK').connection; + for (var i = 0; i < this.itemCount_; i++) { + var itemBlock = workspace.newBlock('create_with_item'); + itemBlock.initSvg(); + connection.connect(itemBlock.previousConnection); + connection = itemBlock.nextConnection; + } + return containerBlock; + }, + /** + * Reconfigure this block based on the mutator dialog's components. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + compose: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + // Count number of inputs. + var connections = []; + var i = 0; + while (itemBlock) { + connections[i] = itemBlock.valueConnection_; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + i++; + } + this.itemCount_ = i; + this.updateShape_(); + // Reconnect any child blocks. + for (var i = 0; i < this.itemCount_; i++) { + if (connections[i]) { + this.getInput('ADD' + i).connection.connect(connections[i]); + } + } + }, + /** + * Store pointers to any connected child blocks. + * @param {!Blockly.Block} containerBlock Root block in mutator. + * @this Blockly.Block + */ + saveConnections: function (containerBlock) { + var itemBlock = containerBlock.getInputTargetBlock('STACK'); + var i = 0; + while (itemBlock) { + var input = this.getInput('ADD' + i); + itemBlock.valueConnection_ = input && input.connection.targetConnection; + i++; + itemBlock = itemBlock.nextConnection && + itemBlock.nextConnection.targetBlock(); + } + }, + /** + * Modify this block to have the correct number of inputs. + * @private + * @this Blockly.Block + */ + updateShape_: function () { + // Delete everything. + if (this.getInput('EMPTY')) { + this.removeInput('EMPTY'); + } else { + var i = 0; + while (this.getInput('ADD' + i)) { + this.removeInput('ADD' + i); + i++; + } + } + // Rebuild block. + if (this.itemCount_ == 0) { + this.appendDummyInput('EMPTY') + .appendField("无需要连接的字符串"); + } else { + for (var i = 0; i < this.itemCount_; i++) { + var input = this.appendValueInput('ADD' + i); + if (i > 0) { + input.setAlign(Blockly.inputs.Align.RIGHT) + input.appendField("+"); + } + } + } + } +}; + +//Arduinojson数据解析 +export const Arduinojson = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.ARDUINOJSON_STRING_PARSING); + this.appendDummyInput("") + .appendField(new Blockly.FieldMultilineInput('const size_t capacity = JSON_ARRAY_SIZE(3) + 10;\nDynamicJsonBuffer jsonBuffer(capacity);\nconst char* json = "[\\"0\\",\\"74\\",\\"134\\"]";\nJsonArray& root = jsonBuffer.parseArray(json);\nconst char* root_0 = root[0]; // "0"\nconst char* root_1 = root[1]; // "74"\nconst char* root_2 = root[2]; // "134"'), 'VALUE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setColour(120); + this.setTooltip(Blockly.Msg.ARDUINOJSON_STRING_PARSING1); + this.setHelpUrl("https://arduinojson.org/v5/assistant/"); + } +}; + +//字符串转长整数 +export const String_to_Long_Integer = { + init: function () { + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MICROBIT_TYPE_STRING + Blockly.Msg.A_TO_B + Blockly.Msg.LANG_MATH_LONG) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MATH_HEX, "16"], + [Blockly.Msg.MATH_DEC, "10"], + [Blockly.Msg.MATH_OCT, "8"], + [Blockly.Msg.MATH_BIN, "2"], + [Blockly.Msg.blynk_IOT_AUTO, "0"] + ]), "type"); + this.setOutput(true, null); + this.setColour(TEXTS_HUE); + this.setTooltip(""); + this.setHelpUrl("https://blog.csdn.net/lizhengze1117/article/details/103318662?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-10.base&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-10.base"); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/blocks/tools.js b/mixly/boards/default_src/arduino_avr/blocks/tools.js new file mode 100644 index 00000000..54cb9f0f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/blocks/tools.js @@ -0,0 +1,160 @@ +import * as Blockly from 'blockly/core'; + +const TOOLS_HUE = "#555555"; +const LISTS_HUE = 260; + +export const factory_notes = { + init: function () { + this.setColour(TOOLS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_CONTROL_NOTES) + .appendField(new Blockly.FieldMultilineInput(''), 'VALUE'); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const folding_block = { + init: function () { + this.setColour(TOOLS_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput(Blockly.Msg.FOLDING_BLOCK), "peien"); + this.appendStatementInput('DO') + .appendField(''); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.FOLDING_BLOCK_HELP); + } +}; + +//IIC地址查找 +export const IICSCAN = { + init: function () { + this.setColour(TOOLS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.IICSCAN); + this.setInputsInline(true); + this.setTooltip(''); + } +}; + +//取模工具显示数据部分 +export const tool_modulus_show = { + init: function () { + this.setColour(LISTS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.OLED_BITMAP_NAME) + .appendField(new Blockly.FieldTextInput('mylist'), 'VAR') + .appendField('[') + .appendField(new Blockly.FieldTextInput('3'), 'x') + .appendField(']'); + this.appendDummyInput("") + .appendField(Blockly.Msg.SAVETO + " flash") + .appendField(new Blockly.FieldCheckbox("true"), "save_hz"); + this.appendValueInput("input_data"); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(""); + } +}; + +//取模工具设置部分 +export const tool_modulus = { + init: function () { + this.appendDummyInput() + .appendField("点阵格式") + .appendField(new Blockly.FieldDropdown([["阴码", "1"], ["阳码", "2"]]), "bitmap_formats") + .appendField(" 取模方式") + .appendField(new Blockly.FieldDropdown([["逐列式", "1"], ["逐行式", "2"], ["列行式", "3"], ["行列式", "4"]]), "modulus_way") + .appendField(" 取模走向") + .appendField(new Blockly.FieldDropdown([["顺向(高位在前)", "1"], ["逆向(低位在前)", "2"]]), "modulus_direction"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NAME) + .appendField(new Blockly.FieldDropdown([["华文黑体", "STHeiti"], ["华文楷体", "STKaiti"], ["华文细黑", "STXihei"], ["华文宋体", "STSong"], ["华文中宋", "STZhongsong"], ["华文仿宋", "STFangsong"], ["华文彩云", "STCaiyun"], ["华文琥珀", "STHupo"], ["华文隶书", "STLiti"], ["华文行楷", "STXingkai"], ["华文新魏", "STXinwei"], ["黑体", "simHei"], ["宋体", "simSun"], ["新宋体", "NSimSun"], ["仿宋", "FangSong"], ["楷体", "KaiTi"], ["仿宋_GB2312", "FangSong_GB2312"], ["楷体_GB2312", "KaiTi_GB2312"], ["隶书", "LiSu"], ["幼圆", "YouYuan"], ["新细明体", "PMingLiU"], ["细明体", "MingLiU"], ["标楷体", "DFKai-SB"], ["微软正黑体", "Microsoft JhengHei"], ["微软雅黑体", "Microsoft YaHei"]]), "hz_sharp") + .appendField(Blockly.Msg.MIXLY_TURTLE_WRITE_FONT_NUM) + .appendField(new Blockly.FieldTextInput("16"), "hz_line_height") + .appendField("px") + //.appendField("px "+Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_FILE_SEEK_OFFSET+":") + //.appendField(new Blockly.FieldDropdown([["上移","hz_up"],["下移","hz_down"]]), "hz_up_down") + //.appendField(new Blockly.FieldTextInput("0"), "hz_up_down_data") + //.appendField("px ") + // .appendField(new Blockly.FieldDropdown([["左移","hz_left"],["右移","hz_right"]]), "hz_left_right") + //.appendField(new Blockly.FieldTextInput("0"), "hz_left_right_data") + //.appendField("px"); + // this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_WIDTH) + .appendField(new Blockly.FieldTextInput("16"), "bitmap_width") + .appendField("px " + Blockly.Msg.MIXLY_HEIGHT) + .appendField(new Blockly.FieldTextInput("16"), "bitmap_height") + .appendField("px"); + // .appendField(new Blockly.FieldCheckbox("true"), "show_hz"); + this.appendDummyInput() + .appendField("输入数据") + .appendField(new Blockly.FieldTextInput(""), "input_data"); + this.setInputsInline(false); + this.setOutput(true, null); + //this.setColour("#cc66cc"); + this.setColour(180); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//获取两个日期差值 +export const get_the_number_of_days_between_the_two_dates = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.GET_THE_DIFFERENCE_BETWEEN_TWO_DATES); + this.appendValueInput("year_start") + .setCheck(null) + .appendField(Blockly.Msg.START + Blockly.Msg.MIXLY_GPS_DATE_YEAR); + this.appendValueInput("month_start") + .setCheck(null) + .appendField(Blockly.Msg.START + Blockly.Msg.MIXLY_GPS_DATE_MONTH); + this.appendValueInput("day_start") + .setCheck(null) + .appendField(Blockly.Msg.START + Blockly.Msg.MIXLY_GPS_DATE_DAY); + this.appendValueInput("year_end") + .setCheck(null) + .appendField(Blockly.Msg.END + Blockly.Msg.MIXLY_GPS_DATE_YEAR); + this.appendValueInput("month_end") + .setCheck(null) + .appendField(Blockly.Msg.END + Blockly.Msg.MIXLY_GPS_DATE_MONTH); + this.appendValueInput("day_end") + .setCheck(null) + .appendField(Blockly.Msg.END + Blockly.Msg.MIXLY_GPS_DATE_DAY); + this.setOutput(true, null); + this.setColour(TOOLS_HUE); + this.setTooltip(""); + this.setHelpUrl("https://blog.csdn.net/a_ran/article/details/43601699?utm_source=distribute.pc_relevant.none-task"); + } +}; + +var esp8266_board_pin_type = [ + ["D0", "16"], + ["D1", "5"], + ["D2", "4"], + ["D3", "0"], + ["D4", "2"], + ["D5", "14"], + ["D6", "12"], + ["D7", "13"], + ["D8", "15"], + ["RX", "3"], + ["TX", "1"], + ["A0", "A0"], + ["SD3", "10"], + ["SD2", "9"] +]; + +export const esp8266_board_pin = { + init: function () { + this.appendDummyInput() + .appendField("ESP8266 GPIO") + .appendField(new Blockly.FieldDropdown(esp8266_board_pin_type), "pin"); + this.setOutput(true, null); + this.setColour(TOOLS_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; diff --git a/mixly/boards/default_src/arduino_avr/css/color.css b/mixly/boards/default_src/arduino_avr/css/color.css new file mode 100644 index 00000000..9bccb7c7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/css/color.css @@ -0,0 +1,319 @@ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/motor.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/motor2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/voice.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/voice2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/light.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/light2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第五个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(5)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第五个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(5)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div.blocklyTreeRow>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div.blocklyTreeRow.blocklyTreeSelected>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第1个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第1个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第2个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第2个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第3个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第3个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第4个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第4个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow.blocklyTreeSelected>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(17)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory3.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(17)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory4.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool2.png') no-repeat; + background-size: 100% auto; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/export.js b/mixly/boards/default_src/arduino_avr/export.js new file mode 100644 index 00000000..e2f4b279 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/export.js @@ -0,0 +1,83 @@ +import ArduinoAVRPins from './pins/pins'; + +import * as ArduinoAVRActuatorBlocks from './blocks/actuator'; +import * as ArduinoAVRBlynkBlocks from './blocks/blynk'; +import * as ArduinoAVRCommunicateBlocks from './blocks/communicate'; +import * as ArduinoAVRControlBlocks from './blocks/control'; +import * as ArduinoAVRDisplayBlocks from './blocks/display'; +import * as ArduinoAVREthernetBlocks from './blocks/ethernet'; +import * as ArduinoAVRFactoryBlocks from './blocks/factory'; +import * as ArduinoAVRInoutBlocks from './blocks/inout'; +import * as ArduinoAVRListsBlocks from './blocks/lists'; +import * as ArduinoAVRLogicBlocks from './blocks/logic'; +import * as ArduinoAVRMathBlocks from './blocks/math'; +import * as ArduinoAVRPinoutBlocks from './blocks/pinout'; +import * as ArduinoAVRPinsBlocks from './blocks/pins'; +import * as ArduinoAVRScoopBlocks from './blocks/scoop'; +import * as ArduinoAVRSensorBlocks from './blocks/sensor'; +import * as ArduinoAVRSerialBlocks from './blocks/serial'; +import * as ArduinoAVRStorageBlocks from './blocks/storage'; +import * as ArduinoAVRTextBlocks from './blocks/text'; +import * as ArduinoAVRToolsBlocks from './blocks/tools'; + +import * as ArduinoAVRActuatorGenerators from './generators/actuator'; +import * as ArduinoAVRBlynkGenerators from './generators/blynk'; +import * as ArduinoAVRCommunicateGenerators from './generators/communicate'; +import * as ArduinoAVRControlGenerators from './generators/control'; +import * as ArduinoAVRDisplayGenerators from './generators/display'; +import * as ArduinoAVREthernetGenerators from './generators/ethernet'; +import * as ArduinoAVRFactoryGenerators from './generators/factory'; +import * as ArduinoAVRInoutGenerators from './generators/inout'; +import * as ArduinoAVRListsGenerators from './generators/lists'; +import * as ArduinoAVRLogicGenerators from './generators/logic'; +import * as ArduinoAVRMathGenerators from './generators/math'; +import * as ArduinoAVRPinoutGenerators from './generators/pinout'; +import * as ArduinoAVRPinsGenerators from './generators/pins'; +import * as ArduinoAVRScoopGenerators from './generators/scoop'; +import * as ArduinoAVRSensorGenerators from './generators/sensor'; +import * as ArduinoAVRSerialGenerators from './generators/serial'; +import * as ArduinoAVRStorageGenerators from './generators/storage'; +import * as ArduinoAVRTextGenerators from './generators/text'; +import * as ArduinoAVRToolsGenerators from './generators/tools'; + +export { + ArduinoAVRPins, + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinoutBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRScoopBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinoutGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRScoopGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/actuator.js b/mixly/boards/default_src/arduino_avr/generators/actuator.js new file mode 100644 index 00000000..44f4397a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/actuator.js @@ -0,0 +1,733 @@ +import { JSFuncs } from 'mixly'; +import { Variables } from 'blockly/core'; + +export const servo_move = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + var delay_time = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.write(' + value_degree + ');\n' + 'delay(' + delay_time + ');\n'; + return code; +}; + +export const servo_writeMicroseconds = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.writeMicroseconds(' + value_degree + ');\n'; + return code; +}; + +export const servo_read_degrees = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.read()'; + return [code, generator.ORDER_ATOMIC]; +}; + +export const servo_move1 = function (_, generator) { + var mode = this.getFieldValue('mode'); + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + var delay_time = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ATOMIC) || '0' + if (mode == 0) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + } + if (mode == 1) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Timer2Servo servo_' + dropdown_pin + ';'; + } + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.write(' + value_degree + ');\n' + 'delay(' + delay_time + ');\n'; + return code; +}; + +export const servo_writeMicroseconds1 = function (_, generator) { + var mode = this.getFieldValue('mode'); + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + if (mode == 0) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + } + if (mode == 1) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Timer2Servo servo_' + dropdown_pin + ';'; + } + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.writeMicroseconds(' + value_degree + ');\n'; + return code; +}; + +export const servo_read_degrees1 = function (_, generator) { + var mode = this.getFieldValue('mode'); + var dropdown_pin = this.getFieldValue('PIN'); + if (mode == 0) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + } + if (mode == 1) { + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Timer2Servo servo_' + dropdown_pin + ';'; + } + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ');'; + var code = 'servo_' + dropdown_pin + '.read()'; + return [code, generator.ORDER_ATOMIC]; +}; + +export const tone_notes = function (_, generator) { + var code = this.getFieldValue('STAT'); + return [code, generator.ORDER_ATOMIC]; +}; + +export const controls_tone = function (_, generator) { + /*var xmlDom = Blockly.Xml.workspaceToDom(Mixly.Editor.blockEditor); + var xmlText = Blockly.Xml.domToPrettyText(xmlDom); + if (xmlText.indexOf("type=\"ir_recv\"") == -1 && xmlText.indexOf("type=\"ir_recv_enable\"") == -1 && xmlText.indexOf("type=\"ir_recv_raw\"") == -1) { + this.setWarningText(null); + } + else { + this.setWarningText(Blockly.Msg.IR_AND_TONE_WARNING); + }*/ + + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var fre = generator.valueToCode(this, 'FREQUENCY', + generator.ORDER_ASSIGNMENT) || '0'; + var code = ""; + if (window.isNaN(dropdown_pin)) { + code = code + 'pinMode(' + dropdown_pin + ', OUTPUT);\n'; + } else { + generator.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + } + code += "tone(" + dropdown_pin + "," + fre + ");\n"; + return code; +}; + +export const controls_notone = function (_, generator) { + /*var xmlDom = Blockly.Xml.workspaceToDom(Mixly.Editor.blockEditor); + var xmlText = Blockly.Xml.domToPrettyText(xmlDom); + if (xmlText.indexOf("type=\"ir_recv\"") == -1 && xmlText.indexOf("type=\"ir_recv_enable\"") == -1 && xmlText.indexOf("type=\"ir_recv_raw\"") == -1) { + this.setWarningText(null); + } + else { + this.setWarningText(Blockly.Msg.IR_AND_TONE_WARNING); + }*/ + + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = ''; + if (window.isNaN(dropdown_pin)) { + code = code + 'pinMode(' + dropdown_pin + ', OUTPUT);\n'; + } else { + generator.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + } + code += "noTone(" + dropdown_pin + ");\n"; + return code; +}; + +// 执行器-蜂鸣器 +export const controls_tone_noTimer = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var fre = generator.valueToCode(this, 'FREQUENCY', generator.ORDER_ASSIGNMENT) || '0'; + var dur = generator.valueToCode(this, 'DURATION', generator.ORDER_ASSIGNMENT) || '0'; + generator.definitions_['include_NewTone'] = '#include '; + generator.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + var code = "NewTone(" + dropdown_pin + "," + fre + "," + dur + ");\n"; + return code; +}; + +// 执行器-蜂鸣器结束声音 +export const controls_notone_noTimer = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + var code = "NewNoTone(" + dropdown_pin + ");\n"; + return code; +}; + +export const group_stepper_setup = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var dropdown_pin1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var dropdown_pin2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var steps = generator.valueToCode(this, 'steps', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ATOMIC); + generator.definitions_['include_Stepper'] = '#include '; + generator.definitions_['var_declare_stepper' + varName] = 'Stepper ' + varName + '(' + steps + ', ' + dropdown_pin1 + ', ' + dropdown_pin2 + ');'; + generator.setups_['setup_stepper' + varName] = varName + '.setSpeed(' + speed + ');'; + return ''; +}; + +export const group_stepper_setup2 = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var dropdown_pin1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var dropdown_pin2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var dropdown_pin3 = generator.valueToCode(this, 'PIN3', generator.ORDER_ATOMIC); + var dropdown_pin4 = generator.valueToCode(this, 'PIN4', generator.ORDER_ATOMIC); + var steps = generator.valueToCode(this, 'steps', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ATOMIC); + generator.definitions_['include_Stepper'] = '#include '; + generator.definitions_['var_declare_stepper' + varName] = 'Stepper ' + varName + '(' + steps + ', ' + dropdown_pin1 + ', ' + dropdown_pin2 + ', ' + dropdown_pin3 + ', ' + dropdown_pin4 + ');'; + generator.setups_['setup_stepper' + varName] = varName + '.setSpeed(' + speed + ');'; + return ''; +}; + +export const group_stepper_move = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var step = generator.valueToCode(this, 'step', generator.ORDER_ATOMIC); + generator.definitions_['include_Stepper'] = '#include '; + return varName + '.step(' + step + ');\n'; +}; + +export const RGB_color_seclet = function (_, generator) { + var colour = this.getFieldValue('COLOR'); + colour = '0x' + colour.substring(1, colour.length); + return [colour, generator.ORDER_NONE]; +}; + +export const RGB_color_rgb = function (_, generator) { + var R = generator.valueToCode(this, 'R', generator.ORDER_ATOMIC); + var G = generator.valueToCode(this, 'G', generator.ORDER_ATOMIC); + var B = generator.valueToCode(this, 'B', generator.ORDER_ATOMIC); + var colour = "((" + R + " & 0xffffff) << 16) | ((" + G + " & 0xffffff) << 8) | " + B; + return [colour, generator.ORDER_NONE]; +}; + +export const display_rgb_init = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var type = this.getFieldValue('TYPE'); + var value_ledcount = generator.valueToCode(this, 'LEDCOUNT', generator.ORDER_ATOMIC); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display' + dropdown_rgbpin] = 'Adafruit_NeoPixel rgb_display_' + dropdown_rgbpin + ' = Adafruit_NeoPixel(' + value_ledcount + ', ' + dropdown_rgbpin + ', ' + type + ' + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_' + dropdown_rgbpin] = 'rgb_display_' + dropdown_rgbpin + '.begin();'; + return ''; +}; + +export const display_rgb_Brightness = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var Brightness = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.setups_['setup_rgb_display_begin_' + dropdown_rgbpin] = 'rgb_display_' + dropdown_rgbpin + '.begin();'; + var code = 'rgb_display_' + dropdown_rgbpin + '.setBrightness(' + Brightness + ');\n'; + return code; +}; + +export const display_rgb = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var value_led = generator.valueToCode(this, '_LED_', generator.ORDER_ATOMIC); + var COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + var code = 'rgb_display_' + dropdown_rgbpin + '.setPixelColor(' + value_led + ' - 1, ' + COLOR + ');\n'; + return code; +}; + +export const RGB_color_HSV = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var value_led = generator.valueToCode(this, '_LED_', generator.ORDER_ATOMIC); + var H = generator.valueToCode(this, 'H', generator.ORDER_ATOMIC); + var S = generator.valueToCode(this, 'S', generator.ORDER_ATOMIC); + var V = generator.valueToCode(this, 'V', generator.ORDER_ATOMIC); + var code = 'rgb_display_' + dropdown_rgbpin + '.setPixelColor(' + value_led + ' - 1, ' + 'rgb_display_' + dropdown_rgbpin + '.ColorHSV(' + H + ', ' + S + ', ' + V + '));\n'; + return code; +}; + +export const display_rgb_show = function () { + var board_type = JSFuncs.getPlatform(); + var dropdown_rgbpin = this.getFieldValue('PIN'); + var code = 'rgb_display_' + dropdown_rgbpin + '.show();\n'; + if (board_type.match(RegExp(/ESP32/))) { + code += 'rgb_display_' + dropdown_rgbpin + '.show();\n'; + } + return code; +}; + +export const display_rgb_rainbow1 = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var wait_time = generator.valueToCode(this, 'WAIT', generator.ORDER_ATOMIC); + generator.setups_['setup_rgb_display_begin_' + dropdown_rgbpin] = 'rgb_display_' + dropdown_rgbpin + '.begin();\n'; + var funcName2 = 'Wheel'; + var code2 = 'uint32_t Wheel(byte WheelPos) {\n' + + ' if(WheelPos < 85) {\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n' + + ' } else if (WheelPos < 170) {\n' + + ' WheelPos -= 85;\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n' + + ' } else {\n' + + ' WheelPos -= 170;\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName2] = code2; + var funcName3 = 'rainbow'; + var code3 = 'void rainbow(uint8_t wait) {\n' + + ' uint16_t i, j;\n' + + ' for(j = 0; j < 256; j++) {\n' + + ' for(i = 0; i < rgb_display_' + dropdown_rgbpin + '.numPixels(); i++){\n' + + ' rgb_display_' + dropdown_rgbpin + '.setPixelColor(i, Wheel((i+j) & 255));\n' + + ' }\n' + + ' rgb_display_' + dropdown_rgbpin + '.show();\n' + + ' delay(wait);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName3] = code3; + var code = 'rainbow(' + wait_time + ');\n' + return code; +}; + +export const display_rgb_rainbow2 = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var wait_time = generator.valueToCode(this, 'WAIT', generator.ORDER_ATOMIC); + var funcName2 = 'Wheel'; + var code2 = 'uint32_t Wheel(byte WheelPos) {\n' + + ' if (WheelPos < 85) {\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n' + + ' } else if (WheelPos < 170) {\n' + + ' WheelPos -= 85;\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n' + + ' } else {\n' + + ' WheelPos -= 170;\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName2] = code2; + var funcName3 = 'rainbow'; + var code3 = 'void rainbow(uint8_t wait) {\n' + + ' uint16_t i, j;\n' + + ' for(j = 0; j < 256; j++){\n' + + ' for(i = 0; i < rgb_display_' + dropdown_rgbpin + '.numPixels(); i++) {\n' + + ' rgb_display_' + dropdown_rgbpin + '.setPixelColor(i, Wheel((i+j) & 255));\n' + + ' }\n' + + ' rgb_display_' + dropdown_rgbpin + '.show();\n' + + ' delay(wait);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName3] = code3; + var funcName4 = 'rainbowCycle'; + var code4 = 'void rainbowCycle(uint8_t wait){\n' + + ' uint16_t i, j;\n' + + ' for(j = 0; j < 256 * 5; j++) {\n' + + ' for(i = 0; i < rgb_display_' + dropdown_rgbpin + '.numPixels(); i++){\n' + + ' rgb_display_' + dropdown_rgbpin + '.setPixelColor(i, Wheel(((i * 256 / rgb_display_' + dropdown_rgbpin + '.numPixels()) + j) & 255));\n' + + ' }\n' + + ' rgb_display_' + dropdown_rgbpin + '.show();\n' + + ' delay(wait);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName4] = code4; + var code = 'rainbowCycle(' + wait_time + ');\n' + return code; +}; + +export const display_rgb_rainbow3 = function (_, generator) { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var rainbow_color = generator.valueToCode(this, 'rainbow_color', generator.ORDER_ATOMIC); + var type = this.getFieldValue('TYPE'); + var funcName2 = 'Wheel'; + var code2 = 'uint32_t Wheel(byte WheelPos) {\n' + + ' if (WheelPos < 85) {\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n' + + ' } else if (WheelPos < 170) {\n' + + ' WheelPos -= 85;\n' + + ' return rgb_display_' + dropdown_rgbpin + '.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n' + + ' } else {\n' + + ' WheelPos -= 170;return rgb_display_' + dropdown_rgbpin + '.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName2] = code2; + if (type == "normal") + var code3 = 'for (int RGB_RAINBOW_i = 0; RGB_RAINBOW_i < rgb_display_' + dropdown_rgbpin + '.numPixels(); RGB_RAINBOW_i++) {\n' + + ' rgb_display_' + dropdown_rgbpin + '.setPixelColor(RGB_RAINBOW_i, Wheel(' + rainbow_color + ' & 255));\n' + + '}\n' + + 'rgb_display_' + dropdown_rgbpin + '.show();\n'; + else + var code3 = 'for (int RGB_RAINBOW_i = 0; RGB_RAINBOW_i < rgb_display_' + dropdown_rgbpin + '.numPixels(); RGB_RAINBOW_i++) {\n' + + ' rgb_display_' + dropdown_rgbpin + '.setPixelColor(RGB_RAINBOW_i, Wheel(((RGB_RAINBOW_i * 256 / rgb_display_' + dropdown_rgbpin + '.numPixels()) + ' + rainbow_color + ') & 255));\n' + + '}\n' + + 'rgb_display_' + dropdown_rgbpin + '.show();\n'; + return code3; +}; + +// 执行器-电机转动 +export const Mixly_motor = function (_, generator) { + var PIN1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var PIN2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var PIN_EN = generator.valueToCode(this, 'PIN_EN', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ASSIGNMENT) || '0'; + var code = 'setMotor(' + PIN1 + ', ' + PIN2 + ', ' + PIN_EN + ', ' + speed + ');\n'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_S'] = 'pinMode(' + PIN1 + ', OUTPUT);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_D'] = 'pinMode(' + PIN2 + ', OUTPUT);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_S_W'] = 'digitalWrite(' + PIN1 + ', LOW);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_D_W'] = 'digitalWrite(' + PIN2 + ', LOW);'; + var funcName = 'setMotor'; + var code2 = 'void ' + funcName + '(int dirpin1, int dirpin2, int speedpin, int speed) {\n' + + ' digitalWrite(dirpin2, !digitalRead(dirpin1));\n' + + ' if (speed == 0) {\n' + + ' digitalWrite(dirpin1, LOW);\n' + + ' analogWrite(speedpin, 0);\n' + + ' } else if (speed > 0) {\n' + + ' digitalWrite(dirpin1, LOW);\n' + + ' analogWrite(speedpin, speed);\n' + + ' } else {\n' + + ' digitalWrite(dirpin1, HIGH);\n' + + ' analogWrite(speedpin, -speed);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return code; +}; + +export const Motor_8833 = function (_, generator) { + var PIN1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var PIN2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ASSIGNMENT) || '0'; + var code = 'setMotor8833(' + PIN1 + ', ' + PIN2 + ', ' + speed + ');\n'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_S'] = 'pinMode(' + PIN1 + ', OUTPUT);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_D'] = 'pinMode(' + PIN2 + ', OUTPUT);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_S_W'] = 'digitalWrite(' + PIN1 + ', LOW);'; + generator.setups_['setup_output_' + PIN1 + PIN2 + '_D_W'] = 'digitalWrite(' + PIN2 + ', LOW);'; + var funcName = 'setMotor8833'; + var code2 = 'void ' + funcName + '(int speedpin, int dirpin, int speed) {\n' + + ' if (speed == 0) {\n' + + ' digitalWrite(dirpin, LOW);\n' + + ' analogWrite(speedpin, 0);\n' + + ' } else if (speed > 0) {\n' + + ' digitalWrite(dirpin, LOW);\n' + + ' analogWrite(speedpin, speed);\n' + + ' } else {\n' + + ' digitalWrite(dirpin, HIGH);\n' + + ' analogWrite(speedpin, 255 + speed);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return code; +}; + +// 语音模块(68段日常用语) +export const voice_module = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_voice = this.getFieldValue('VOICE'); + var wait_time = generator.valueToCode(this, 'WAIT', generator.ORDER_ASSIGNMENT) || '0'; + generator.setups_['setup_output_sda'] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + var code = 'send_data(' + dropdown_voice + '); // volume control 0xE0-E7;\n'; + code += 'delay(' + wait_time + ');\n' + var code2 = 'void send_data(int addr) {\n' + + ' int i;\n' + + ' digitalWrite(' + dropdown_pin + ', LOW);\n' + + ' delay(3); // >2ms\n' + + ' for (i = 0; i < 8; i++) {\n' + + ' digitalWrite(' + dropdown_pin + ', HIGH);\n' + + ' if (addr & 1) {\n' + + ' delayMicroseconds(2400); // >2400us\n' + + ' digitalWrite(' + dropdown_pin + ', LOW);\n' + + ' delayMicroseconds(800);\n' + + ' } // >800us\n' + + ' else {\n' + + ' delayMicroseconds(800); // >800us\n' + + ' digitalWrite(' + dropdown_pin + ', LOW);\n' + + ' delayMicroseconds(2400);\n' + + ' } // >2400us\n' + + ' addr >>= 1;\n' + + ' }\n' + + ' digitalWrite(' + dropdown_pin + ', HIGH);\n' + + '}\n'; + generator.definitions_['funcName'] = code2; + return code; +}; + +// gd5800 mp3 控制播放 +export const GD5800_MP3_CONTROL = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var CONTROL_TYPE = this.getFieldValue('CONTROL_TYPE'); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.' + CONTROL_TYPE + '\n'; + return code; +}; + +export const GD5800_MP3_Set_Device = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var DEVICEID = this.getFieldValue('DEVICEID'); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.setDevice(' + DEVICEID + ');\n'; + return code; + +}; + +// gd5800 mp3 循环模式 +export const GD5800_MP3_LOOP_MODE = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var LOOP_MODE = this.getFieldValue('LOOP_MODE'); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.setLoopMode(' + LOOP_MODE + ');\n'; + return code; +}; + +// gd5800 mp3 EQ模式 +export const GD5800_MP3_EQ_MODE = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var EQ_MODE = this.getFieldValue('EQ_MODE'); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.setEqualizer(' + EQ_MODE + ');\n'; + return code; +}; + +// gd5800 mp3 设置音量 +export const GD5800_MP3_VOL = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var vol = generator.valueToCode(this, 'vol', generator.ORDER_ATOMIC); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.setVolume(' + vol + ');\n'; + return code; +}; + +// gd5800 mp3 播放第N首 +export const GD5800_MP3_PLAY_NUM = function (_, generator) { + var rxpin = generator.valueToCode(this, 'RXPIN', generator.ORDER_ATOMIC); + var txpin = generator.valueToCode(this, 'TXPIN', generator.ORDER_ATOMIC); + var NUM = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['include_GD5800'] = '#include '; + generator.definitions_['var_declare_GD5800_ mp3' + rxpin + txpin] = 'GD5800_Serial mp3' + rxpin + txpin + '(' + rxpin + ', ' + txpin + ');'; + generator.setups_['setup_ mp3' + rxpin + txpin] = 'mp3' + rxpin + txpin + '.begin(9600);'; + var code = 'mp3' + rxpin + txpin + '.playFileByIndexNumber(' + NUM + ');\n'; + return code; +}; + +export const AFMotorRun = function (_, generator) { + generator.definitions_['include_AFMotor'] = '#include '; + var motorNO = this.getFieldValue('motor'); + var direction = this.getFieldValue('direction'); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ATOMIC); + var code = ""; + generator.definitions_['var_declare_motor_' + motorNO] = "AF_DCMotor" + ' motor' + motorNO + '(' + motorNO + ');'; + code = 'motor' + motorNO + ".setSpeed(" + speed + ");\n" + 'motor' + motorNO + ".run(" + direction + ");\n"; + return code; +}; + +export const AFMotorStop = function (_, generator) { + generator.definitions_['include_AFMotor'] = '#include '; + var motorNO = this.getFieldValue('motor'); + var code = ""; + generator.definitions_['var_declare_motor_' + motorNO] = "AF_DCMotor" + ' motor' + motorNO + '(' + motorNO + ');'; + code = 'motor' + motorNO + ".setSpeed(0);\n" + 'motor' + motorNO + ".run(RELEASE);\n"; + return code; +}; + +// 初始化DFPlayer Mini +export const arduino_dfplayer_mini_begin = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_dfplayer_pin = generator.valueToCode(this, 'dfplayer_pin', generator.ORDER_ATOMIC); + generator.definitions_['include_Arduino'] = '#include '; + generator.definitions_['include_DFRobotDFPlayerMini'] = '#include "DFRobotDFPlayerMini.h"'; + generator.definitions_['var_declare_DFPlayerMini_' + text_dfplayer_name] = 'DFRobotDFPlayerMini ' + text_dfplayer_name + ';'; + generator.setups_['setup_DFPlayerMini_' + text_dfplayer_name] = '' + text_dfplayer_name + '.begin(' + value_dfplayer_pin + ');'; + var code = ''; + return code; +}; + +// 定义DFPlayer Mini 所使用的串口类型 +export const arduino_dfplayer_mini_pin = function (_, generator) { + var dropdown_pin_type = this.getFieldValue('pin_type'); + generator.definitions_['include_SoftwareSerial'] = '#include '; + var code = dropdown_pin_type; + return [code, generator.ORDER_ATOMIC]; +}; + +// DFPlayer Mini 设置串口通信的超时时间 +export const arduino_dfplayer_mini_setTimeOut = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_timeout_data = generator.valueToCode(this, 'timeout_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.setTimeOut(' + value_timeout_data + ');\n'; + return code; +}; + +// DFPlayer Mini 设置音量 +export const arduino_dfplayer_mini_volume = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_volume_data = generator.valueToCode(this, 'volume_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.volume(' + value_volume_data + ');\n'; + return code; +}; + +// DFPlayer Mini 音量+|- +export const arduino_dfplayer_mini_volume_up_down = function () { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var dropdown_volume_type = this.getFieldValue('volume_type'); + var code = '' + text_dfplayer_name + '.' + dropdown_volume_type + '();\n'; + return code; +}; + +// DFPlayer Mini 设置音效 +export const arduino_dfplayer_mini_EQ = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_eq_data = generator.valueToCode(this, 'eq_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.EQ(' + value_eq_data + ');\n'; + return code; +}; + +// DFPlayer Mini 定义音效类型 +export const arduino_dfplayer_mini_EQ_type = function (_, generator) { + var dropdown_eq_type = this.getFieldValue('eq_type'); + var code = dropdown_eq_type; + return [code, generator.ORDER_ATOMIC]; +}; + +// DFPlayer Mini 指定播放设备 +export const arduino_dfplayer_mini_outputDevice = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_outputdevice_data = generator.valueToCode(this, 'outputdevice_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.outputDevice(' + value_outputdevice_data + ');\n'; + return code; +}; + +// DFPlayer Mini 定义播放设备类型 +export const arduino_dfplayer_mini_outputDevice_type = function (_, generator) { + var dropdown_outputdevice_type = this.getFieldValue('outputdevice_type'); + var code = dropdown_outputdevice_type; + return [code, generator.ORDER_ATOMIC]; +}; + +// DFPlayer Mini 设置-1 +export const arduino_dfplayer_set_1 = function () { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var dropdown_set_data = this.getFieldValue('set_data'); + var code = '' + text_dfplayer_name + '.' + dropdown_set_data + '();\n'; + return code; +}; + +// DFPlayer Mini 播放和循环指定曲目 +export const arduino_dfplayer_play_loop = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_play_data = generator.valueToCode(this, 'play_data', generator.ORDER_ATOMIC); + var dropdown_play_type = this.getFieldValue('play_type'); + var code = '' + text_dfplayer_name + '.' + dropdown_play_type + '(' + value_play_data + ');\n'; + return code; +}; + +// DFPlayer Mini 播放指定文件夹下的曲目 +export const arduino_dfplayer_playFolder = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_fold_data = generator.valueToCode(this, 'fold_data', generator.ORDER_ATOMIC); + var dropdown_fold_type = this.getFieldValue('fold_type'); + var value_play_data = generator.valueToCode(this, 'play_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.' + dropdown_fold_type + '(' + value_fold_data + ', ' + value_play_data + ');\n'; + return code; +}; + +// DFPlayer Mini 循环播放指定文件夹下的曲目 +export const arduino_dfplayer_loopFolder = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_fold_data = generator.valueToCode(this, 'fold_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.loopFolder(' + value_fold_data + ');\n'; + return code; +}; + +// DFPlayer Mini 获取当前信息 +export const arduino_dfplayer_read_now = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var dropdown_read_type = this.getFieldValue('read_type'); + var code = '' + text_dfplayer_name + '.' + dropdown_read_type + '()'; + return [code, generator.ORDER_ATOMIC]; +}; + +// DFPlayer Mini 获取U盘|SD卡|FLASH的总文件数 +export const arduino_dfplayer_readFileCounts = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_device_type = generator.valueToCode(this, 'device_type', generator.ORDER_ATOMIC); + var dropdown_play_data = this.getFieldValue('play_data'); + var code = '' + text_dfplayer_name + '.' + dropdown_play_data + '(' + value_device_type + ')'; + return [code, generator.ORDER_ATOMIC]; +}; + +// DFPlayer Mini 获取指定文件夹下的文件数 +export const arduino_dfplayer_readFileCountsInFolder = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var value_folder_data = generator.valueToCode(this, 'folder_data', generator.ORDER_ATOMIC); + var code = '' + text_dfplayer_name + '.readFileCountsInFolder(' + value_folder_data + ')'; + return [code, generator.ORDER_ATOMIC]; +}; + +export const arduino_dfplayer_available = function (_, generator) { + var text_dfplayer_name = this.getFieldValue('dfplayer_name'); + var dropdown_type = this.getFieldValue('type'); + var code = '' + text_dfplayer_name + '.' + dropdown_type + '()'; + return [code, generator.ORDER_ATOMIC]; +}; + +export const I2Cmotor = function (_, generator) { + var motorNO = this.getFieldValue('motor'); + var speed = generator.valueToCode(this, 'SPEED', generator.ORDER_ASSIGNMENT) || '0'; + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_Adafruit_PWMServoDriver'] = '#include '; + generator.definitions_['var_declare_Adafruit_PWMServoDriver'] = 'Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();'; + generator.setups_['setup_pwm_begin'] = 'pwm.begin();\n' + + 'pwm.setOscillatorFrequency(27000000);\n' + + 'pwm.setPWMFreq(400);\n' + + 'Wire.setClock(400000);'; + var code2; + code2 = 'void motor(int ID, int SPEED) { // 0-7\n' + + ' if(SPEED > 0) {\n' + + ' pwm.setPin(ID * 2, 0);\n' + + ' pwm.setPin(ID * 2 + 1, (SPEED + 1) * 16 - 1);\n' + + ' } else if (SPEED == 0) {\n' + + ' pwm.setPin(ID * 2, 4095);\n' + + ' pwm.setPin(ID * 2 + 1, 4095);\n' + + ' } else if (SPEED < 0) {\n' + + ' pwm.setPin(ID * 2, 1 - (SPEED + 1) * 16);\n' + + ' pwm.setPin(ID * 2 + 1, 0);\n' + + ' }\n' + + '}\n'; + generator.definitions_['motor'] = code2; + var code = 'motor(' + motorNO + ',' + speed + ');\n'; + return code; +}; + +// M9101X mp3 单线控制播放 +export const M9101X_S_MP3_CONTROL = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var CONTROL_TYPE = this.getFieldValue('CONTROL_TYPE'); + generator.definitions_['include_N910X'] = '#include '; + generator.definitions_['var_declare_N910X_ mp3' + dropdown_pin] = 'N910X mp3_' + dropdown_pin + '(' + dropdown_pin + ');'; + generator.setups_['setup_ mp3' + dropdown_pin] = 'mp3_' + dropdown_pin + '.begin();'; + var code = 'mp3_' + dropdown_pin + '.' + CONTROL_TYPE + '\n'; + return code; +}; + +// M9101X mp3 单线音量控制 +export const M9101X_S_MP3_VOL_CONTROL = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var vol = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['include_N910X'] = '#include '; + generator.definitions_['var_declare_N910X_ mp3' + dropdown_pin] = 'N910X mp3_' + dropdown_pin + '(' + dropdown_pin + ');'; + generator.setups_['setup_ mp3' + dropdown_pin] = ' mp3_' + dropdown_pin + '.begin();'; + var code = 'mp3_' + dropdown_pin + '.set_volume(' + vol + ');\n'; + return code; +}; + +// M9101X mp3 单线播放第N首 +export const M9101X_S_MP3_PLAY_NUM = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['include_N910X'] = '#include '; + generator.definitions_['var_declare_N910X_ mp3' + dropdown_pin] = 'N910X mp3_' + dropdown_pin + '(' + dropdown_pin + ');'; + generator.setups_['setup_ mp3' + dropdown_pin] = ' mp3_' + dropdown_pin + '.begin();'; + var code = 'mp3_' + dropdown_pin + '.set_play_number(' + num + ');\n'; + return code; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/blynk.js b/mixly/boards/default_src/arduino_avr/generators/blynk.js new file mode 100644 index 00000000..0f740777 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/blynk.js @@ -0,0 +1,894 @@ +import { JSFuncs } from 'mixly'; +import { Variables } from 'blockly/core'; + +// 物联网-授权码 +export const blynk_iot_auth = function () { + return ''; +}; + +// 物联网-一键配网 +export const blynk_smartconfig = function (_, generator) { + let auth_key = generator.valueToCode(this, 'auth_key', generator.ORDER_ATOMIC); + let server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + if (!isNaN(server_add.charAt(2))) { + server_add = server_add.replace(/"/g, "").replace(/\./g, ","); + server_add = 'IPAddress(' + server_add + ')'; + } + let board_type = JSFuncs.getPlatform(); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth_key + ';'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_smartconfig'] = 'WiFi.mode(WIFI_STA);\n' + + ' int cnt = 0;\n' + + ' while (WiFi.status() != WL_CONNECTED) {\n' + + ' delay(500); \n' + + ' Serial.print("."); \n' + + ' if (cnt++ >= 10) {\n' + + ' WiFi.beginSmartConfig();\n' + + ' while (1) {\n' + + ' delay(1000);\n' + + ' if (WiFi.smartConfigDone()) {\n' + + ' Serial.println();\n' + + ' Serial.println("SmartConfig: Success");\n' + + ' break;\n' + + ' }\n' + + ' Serial.print("|");\n' + + ' }\n' + + ' }\n' + + ' }\n' + + ' WiFi.printDiag(Serial);\n'; + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp8266'] = '#include '; + } + else if (board_type.match(RegExp(/ESP32/))) { + generator.definitions_['include_WiFi'] = '#include '; + generator.definitions_['include_WiFiClient'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp32'] = '#include '; + } + generator.setups_['setup_smartconfig'] += 'Blynk.config(auth,' + server_add + ',8080);'; + let code = "Blynk.run();\n"; + return code; +}; + +// 物联网-wifi信息 +export const blynk_server = function (_, generator) { + let wifi_ssid = generator.valueToCode(this, 'wifi_ssid', generator.ORDER_ATOMIC); + let wifi_pass = generator.valueToCode(this, 'wifi_pass', generator.ORDER_ATOMIC); + let auth_key = generator.valueToCode(this, 'auth_key', generator.ORDER_ATOMIC); + let server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + let board_type = JSFuncs.getPlatform(); + //let board_type ="ESP8266"; + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth_key + ';'; + generator.definitions_['var_declare_wifi_ssid'] = 'char ssid[] = ' + wifi_ssid + ';'; + generator.definitions_['var_declare_wifi_pass'] = 'char pass[] = ' + wifi_pass + ';'; + if (board_type.match(RegExp(/AVR/))) { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp8266'] = '#include '; + generator.definitions_['define_BLYNK_PRINT'] = '#define ESP8266_BAUD 115200'; + generator.definitions_['var_declare_ESP8266'] = 'ESP8266 wifi(&Serial);'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(115200);'; + generator.setups_['delay_10_1'] = 'delay(10);'; + generator.setups_['wifi.setOprToStation'] = 'wifi.setOprToStation(2, 2);'; + generator.setups_['delay_10_2'] = 'delay(10);'; + generator.setups_['wifi.enableMUX'] = 'wifi.enableMUX();'; + generator.setups_['delay_10_3'] = 'delay(10);'; + generator.setups_['setup_Blynk.begin'] = 'Blynk.begin(auth, wifi,ssid, pass,' + server_add + ',8080);'; + } + if (!isNaN(server_add.charAt(2))) { + server_add = server_add.replace(/"/g, "").replace(/\./g, ","); + server_add = 'IPAddress(' + server_add + ')'; + } + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp8266'] = '#include '; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = ' Blynk.begin(auth, ssid, pass,' + server_add + ',8080);'; + } + else if (board_type.match(RegExp(/ESP32/))) { + generator.definitions_['include_WiFi'] = '#include '; + generator.definitions_['include_WiFiClient'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp32'] = '#include '; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Blynk.begin(auth, ssid, pass,' + server_add + ',8080);'; + } + let code = "Blynk.run();\n"; + return code; +}; + +// 物联网-wifi信息 +export const blynk_usb_server = function (_, generator) { + // generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT DebugSerial'; + generator.definitions_['include_SoftwareSerial'] = '#include '; + generator.definitions_['include_BlynkSimpleStream'] = '#include '; + generator.definitions_['var_declare_SoftwareSerial'] = 'SoftwareSerial DebugSerial(2, 3);'; + let auth_key = generator.valueToCode(this, 'auth_key', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth_key + ';'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Blynk.begin(Serial, auth);'; + generator.setups_['setup_DebugSerial'] = 'DebugSerial.begin(9600);'; + let code = "Blynk.run();\n"; + return code; +}; + +// 物联网-发送数据到app +export const blynk_iot_push_data = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + let code = 'Blynk.virtualWrite(' + Vpin + ', ' + data + ');\n'; + return code; +}; + +// 从app接收数据 +export const blynk_iot_get_data = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'STACK'); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, '\'' + this.id + '\'') + branch; + } + let args = []; + for (let x = 0; x < this.arguments_.length; x++) { + args[x] = this.argumentstype_[x] + ' ' + generator.variableDB_.getName(this.arguments_[x], Variables.NAME_TYPE); + } + let GetDataCode = ""; + if (this.arguments_.length == 1) { + GetDataCode = generator.variableDB_.getName(this.arguments_[0], Variables.NAME_TYPE); + if (this.argumentstype_[0] == "int") + GetDataCode = " " + GetDataCode + " = param.asInt();\n" + else if (this.argumentstype_[0] == "String") + GetDataCode = " " + GetDataCode + " = param.asStr();\n" + else if (this.argumentstype_[0] == "long") + GetDataCode = " " + GetDataCode + " = param.asDouble();\n" + else if (this.argumentstype_[0] == "float") + GetDataCode = " " + GetDataCode + " = param.asFloat();\n" + else if (this.argumentstype_[0] == "boolean") + GetDataCode = " " + GetDataCode + " = param.asInt();\n" + else if (this.argumentstype_[0] == "byte") + GetDataCode = " " + GetDataCode + " = param.asStr();\n" + else if (this.argumentstype_[0] == "char") + GetDataCode = " " + GetDataCode + " = param.asStr();\n" + } + else { + for (let x = 0; x < this.arguments_.length; x++) { + args[x] = this.argumentstype_[x] + ' ' + generator.variableDB_.getName(this.arguments_[x], Variables.NAME_TYPE); + + GetDataCode = GetDataCode + " " + generator.variableDB_.getName(this.arguments_[x], Variables.NAME_TYPE); + if (this.argumentstype_[x] == "int") + GetDataCode += " = param[" + x + "].asInt();\n" + else if (this.argumentstype_[x] == "String") + GetDataCode += " = param[" + x + "].asStr();\n" + else if (this.argumentstype_[x] == "long") + GetDataCode += " = param[" + x + "].asDouble();\n" + else if (this.argumentstype_[x] == "float") + GetDataCode += " = param[" + x + "].asFloat();\n" + else if (this.argumentstype_[x] == "boolean") + GetDataCode += " = param[" + x + "].asInt();\n" + else if (this.argumentstype_[x] == "byte") + GetDataCode += " = param[" + x + "].asStr();\n" + else if (this.argumentstype_[x] == "char") + GetDataCode += " = param[" + x + "].asStr();\n" + } + } + if (this.arguments_.length > 0) + generator.definitions_['var_declare_' + args] = args.join(';\n') + ";"; + let code = 'BLYNK_WRITE(' + Vpin + ') {\n' + GetDataCode + + branch + '}\n'; + // let code = 'BLYNK_WRITE(' + Vpin+ ') {\n'+letiable+" = param.as"+datatype+"();\n"+branch+'}\n'; + code = generator.scrub_(this, code); + generator.definitions_[Vpin] = code; + return null; +}; + +// blynk 定时器 +export const Blynk_iot_timer = function (_, generator) { + generator.definitions_['var_declare_BlynkTimer'] = 'BlynkTimer timer;'; + let timerNo = this.getFieldValue('timerNo'); + let time = generator.valueToCode(this, 'TIME', generator.ORDER_ATOMIC); + let funcName = 'myTimerEvent' + timerNo; + let branch = generator.statementToCode(this, 'DO'); + let code = 'void' + ' ' + funcName + '() {\n' + + branch + + '}\n'; + generator.definitions_[funcName] = code; + generator.setups_[funcName] = 'timer.setInterval(' + time + 'L, ' + funcName + ');\n'; + return "timer.run();\n"; +}; + +// blynk 连接状态函数 +export const Blynk_iot_CONNECT_STATE = function (_, generator) { + let funcName = this.getFieldValue('state'); + let branch = generator.statementToCode(this, 'DO'); + let code = funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code; + return ""; +}; + +// blynk 同步所有管脚状态 +export const Blynk_iot_BLYNK_syncAll = function () { + let code = 'Blynk.syncAll();\n'; + return code; +}; + +// 物联网-发送数据到app +export const blynk_iot_syncVirtual = function () { + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.syncVirtual(' + Vpin + ');\n'; + return code; +}; + +//LED组件颜色&开关 +export const blynk_iot_WidgetLED_COLOR = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "").replace(/\(/g, "").replace(/\)/g, "").replace(/0x/g, ''); + let dropdown_stat = generator.valueToCode(this, 'STAT', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_WidgetLED' + Vpin] = 'WidgetLED led' + Vpin + '(' + Vpin + ');'; + let code = 'led' + Vpin + '.setColor("#' + COLOR + '");\n'; + if (dropdown_stat == "HIGH") + code += 'led' + Vpin + '.on();\n'; + else if (dropdown_stat == "LOW") + code += 'led' + Vpin + '.off();\n'; + return code; +}; + +//LED组件颜色&亮度 +export const blynk_iot_WidgetLED_VALUE = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "").replace(/\(/g, "").replace(/\)/g, "").replace(/0x/g, ''); + let value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_WidgetLED' + Vpin] = 'WidgetLED led' + Vpin + '(' + Vpin + ');'; + let code = 'led' + Vpin + '.setColor("#' + COLOR + '");\n'; + code += 'led' + Vpin + '.setValue(' + value_num + ');'; + return code; +}; + +// 红外控制空调 +export const blynk_iot_ir_send_ac = function (_, generator) { + let AC_TYPE = this.getFieldValue('AC_TYPE'); + let AC_POWER = this.getFieldValue('AC_POWER'); + let AC_MODE = this.getFieldValue('AC_MODE'); + let AC_FAN = this.getFieldValue('AC_FAN'); + let dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + let AC_TEMP = generator.valueToCode(this, 'AC_TEMP', generator.ORDER_ATOMIC); + generator.definitions_['include_Arduino'] = '#ifndef UNIT_TEST\n#include \n#endif'; + generator.definitions_['include_IRremoteESP8266'] = '#include '; + generator.definitions_['include_IRsend'] = '#include '; + generator.definitions_['include' + AC_TYPE] = '#include '; + generator.definitions_['define_IR_LED' + dropdown_pin] = '#define IR_LED ' + dropdown_pin; + generator.definitions_['IR' + AC_TYPE + 'AC'] = 'IR' + AC_TYPE + 'AC ' + AC_TYPE + 'AC(IR_LED); '; + generator.setups_['setup' + AC_TYPE] = AC_TYPE + 'AC.begin();'; + let code = AC_TYPE + 'AC.setPower(' + AC_POWER + ');\n'; + code += AC_TYPE + 'AC.setFan(' + AC_FAN + ');\n'; + code += AC_TYPE + 'AC.setMode(' + AC_MODE + ');\n'; + code += AC_TYPE + 'AC.setTemp(' + AC_TEMP + ');\n'; + code += AC_TYPE + 'AC.send();\n'; + return code; +}; + +// 红外接收 +export const blynk_iot_ir_recv_raw = function (_, generator) { + let dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.definitions_['include_IRremote'] = '#ifndef UNIT_TEST\n' + + '#include \n' + + '#endif\n#include \n#include \n#include \n#if DECODE_AC\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#endif \n'; + generator.definitions_['define_RECV_PIN' + dropdown_pin] = '#define RECV_PIN ' + dropdown_pin + '\n'; + // generator.definitions_['define_BAUD_RATE'] = '#define BAUD_RATE 115200\n'; + generator.definitions_['var_declare_CAPTURE_BUFFER_SIZE'] = '#define CAPTURE_BUFFER_SIZE 1024\n#if DECODE_AC\n#define TIMEOUT 50U\n#else\n#define TIMEOUT 15U \n#endif\n#define MIN_UNKNOWN_SIZE 12\n#define IN_UNKNOWN_SIZE 12\nIRrecv irrecv(RECV_PIN, CAPTURE_BUFFER_SIZE, TIMEOUT, true);\ndecode_results results;'; + generator.setups_['ir_recv_begin'] = 'while(!Serial)\n' + + ' delay(50);\n' + + ' #if DECODE_HASH\n' + + ' irrecv.setUnknownThreshold(MIN_UNKNOWN_SIZE);\n' + + ' #endif \n' + + ' irrecv.enableIRIn();'; + let code = "if(irrecv.decode(&results)){\n" + + ' uint32_t now = millis();\n' + + ' dumpACInfo(&results);\n' + + ' Serial.println(resultToSourceCode(&results));\n' + + '}\n'; + let funcode = 'void dumpACInfo(decode_results *results){\n' + + ' String description="";\n' + + ' #if DECODE_DAIKIN\n' + + ' if(results->decode_type == DAIKIN){\n' + + ' IRDaikinESP ac(0);\n' + + ' ac.setRaw(results->state);\n' + + ' description=ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_FUJITSU_AC\n' + + ' if(results->decode_type==FUJITSU_AC){\n' + + ' IRFujitsuAC ac(0);\n' + + ' ac.setRaw(results->state, results->bits / 8);\n' + + ' description = ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_KELVINATOR\n' + + ' if(results->decode_type == KELVINATOR){\n' + + ' IRKelvinatorAC ac(0);\n' + + ' ac.setRaw(results->state);\n' + + ' description = ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_TOSHIBA_AC\n' + + ' if(results->decode_type == TOSHIBA_AC){\n' + + ' IRToshibaAC ac(0);\n' + + ' ac.setRaw(results->state);\n' + + ' description = ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_GREE\n' + + ' if (results->decode_type == GREE){\n' + + ' IRGreeAC ac(0);\n' + + ' ac.setRaw(results->state);\n' + + ' description = ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_MIDEA\n' + + ' if(results->decode_type == MIDEA){\n' + + ' IRMideaAC ac(0);\n' + + ' ac.setRaw(results->value);\n' + + ' description=ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' #if DECODE_HAIER_AC\n' + + ' if(results->decode_type == HAIER_AC){\n' + + ' IRHaierAC ac(0);\n' + + ' ac.setRaw(results->state);\n' + + ' description = ac.toString();\n' + + ' }\n' + + ' #endif\n' + + ' if(description != "")\n' + + ' Serial.println("Mesg Desc.: " + description);\n' + + '}\n'; + generator.definitions_['dumpACInfo'] = funcode; + return code; +}; + +// 红外发射 +export const blynk_iot_ir_send = function (_, generator) { + let dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + let IR_CODE = this.getFieldValue('IR_CODE'); + let IR_CODE_LENGTH = IR_CODE.split(',').length; + let random_num = Math.ceil(Math.random() * 100000); + generator.definitions_['define_IRremote'] = '#ifndef UNIT_TEST\n#include \n#endif\n#include \n#include \n#define IR_LED ' + dropdown_pin; + generator.definitions_['var_declare_IRsend_irsend'] = 'IRsend irsend(IR_LED);\n'; + generator.definitions_['var_declare_send' + random_num] = 'uint16_t rawData' + random_num + '[' + IR_CODE_LENGTH + '] = {' + IR_CODE + '};'; + // generator.setups_['Serial.begin'] = 'irsend.begin();\n Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);\n'; + generator.setups_['irsend_begin'] = 'irsend.begin();\n'; + let code = 'irsend.sendRaw(rawData' + random_num + ', ' + IR_CODE_LENGTH + ', 38);\ndelay(2000);\n'; + return code; +} + +// 发送邮件 +export const blynk_email = function (_, generator) { + let email_add = generator.valueToCode(this, 'email_add', generator.ORDER_ATOMIC); + let Subject = generator.valueToCode(this, 'Subject', generator.ORDER_ATOMIC); + let content = generator.valueToCode(this, 'content', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_MAX_SENDBYTES'] = '#define BLYNK_MAX_SENDBYTES 128 \n'; + let code = 'Blynk.email(' + email_add + ', ' + Subject + ', ' + content + ');\n'; + return code; +}; + +// 发送通知 +export const blynk_notify = function (_, generator) { + let content = generator.valueToCode(this, 'content', generator.ORDER_ATOMIC); + let code = 'Blynk.notify(' + content + ');\n'; + return code; +}; + +// 物联网-终端组件显示文本 +export const blynk_terminal = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + generator.definitions_['var_declare_WidgetTerminal' + Vpin] = 'WidgetTerminal terminal' + Vpin + '(' + Vpin + ');\n'; + let content = generator.valueToCode(this, 'content', generator.ORDER_ATOMIC); + let code = 'terminal' + Vpin + '.println(' + content + ');\nterminal' + Vpin + '.flush();\n'; + return code; +}; + +// 从终端获取字符串 +export const blynk_iot_terminal_get = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + generator.definitions_['var_declare_WidgetTerminal'] = 'WidgetTerminal terminal(' + Vpin + ');\n'; + generator.definitions_['var_declare_action'] = 'String terminal_text ;'; + let branch = generator.statementToCode(this, 'DO'); + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格s + let code = 'BLYNK_WRITE' + '(' + Vpin + '){\n' + + ' terminal_text = param.asStr();\n' + + ' ' + branch + '\n' + + ' terminal.flush();\n' + + '}\n' + generator.definitions_[Vpin] = code; + return null; +}; + +// 视频流 +export const blynk_videourl = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let url = generator.valueToCode(this, 'url', generator.ORDER_ATOMIC); + let code = 'Blynk.setProperty(' + Vpin + ',"url",' + url + ');\n'; + return code; +}; + +// 桥接授权码 +export const blynk_bridge_auth = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let auth = generator.valueToCode(this, 'auth', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_WidgetBridge' + Vpin] = 'WidgetBridge bridge' + Vpin + '(' + Vpin + ');\n'; + let code = 'bridge' + Vpin + '.setAuthToken(' + auth + ');\n'; + return code; +}; + +// 桥接数字输出 +export const blynk_bridge_digitalWrite = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + let dropdown_stat = generator.valueToCode(this, 'STAT', generator.ORDER_ATOMIC); + let code = 'bridge' + Vpin + '.digitalWrite(' + dropdown_pin + ', ' + dropdown_stat + ');\n'; + return code; +}; + +// 桥接模拟输出 +export const blynk_bridge_AnaloglWrite = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + let value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + let code = 'bridge' + Vpin + '.analogWrite(' + dropdown_pin + ', ' + value_num + ');\n'; + return code; +}; + +// 桥接虚拟管脚 +export const blynk_bridge_VPin = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let Vpin2 = this.getFieldValue('Vpin2'); + let value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + let code = 'bridge' + Vpin + '.virtualWrite(' + Vpin2 + ', ' + value_num + ');\n'; + return code; +}; + +// RTC组件初始化 +export const blynk_WidgetRTC_init = function (_, generator) { + generator.definitions_['include_TimeLib'] = '#include '; + generator.definitions_['include_WidgetRTC'] = '#include '; + let value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_WidgetRTC'] = 'WidgetRTC rtc;\n'; + generator.setups_['setSyncInterval'] = 'setSyncInterval(' + value_num + '* 60);'; + let code = 'rtc.begin();\n'; + return code; +}; + +// RTC获取时间 +export const blynk_WidgetRTC_get_time = function (_, generator) { + let timeType = this.getFieldValue('TIME_TYPE'); + let code = timeType + '()'; + return [code, generator.ORDER_ATOMIC]; +}; + +// 播放音乐组件 +export const blynk_iot_playmusic = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'DO'); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, '\'' + this.id + '\'') + branch; + } + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + let code = 'BLYNK_WRITE(' + Vpin + '){\n' + + ' action = param.asStr();\n' + + ' ' + branch + '\n' + + ' Blynk.setProperty(' + Vpin + ', "label", action);\n' + + '}\n'; + code = generator.scrub_(this, code); + generator.definitions_[Vpin] = code; + return ""; +}; + +// 光线传感器 +export const blynk_light = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'DO'); + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + let code = 'BLYNK_WRITE' + '(' + Vpin + '){\n' + + ' int lx = param.asInt();\n' + + ' ' + branch + '\n' + + '}\n'; + generator.definitions_[Vpin] = code; + return ""; +}; + +// 重力传感器 +export const blynk_gravity = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'DO'); + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + let code = 'BLYNK_WRITE' + '(' + Vpin + '){\n' + + ' int x = param[0].asFloat();\n' + + ' int y = param[1].asFloat();\n' + + ' int z = param[2].asFloat();\n' + + ' ' + branch + '\n' + + '}\n'; + generator.definitions_[Vpin] = code; + return ""; +}; + +// 加速度传感器 +export const blynk_acc = blynk_gravity; + +// 时间输入 +export const blynk_time_input_1 = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'DO'); + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + let code = 'BLYNK_WRITE' + '(' + Vpin + '){\n' + + ' long startTimeInSecs = param[0].asLong();\n' + + ' long hour =startTimeInSecs/3600;\n' + + ' long minute=(startTimeInSecs-3600*hour)/60;\n' + + ' long second=(startTimeInSecs-3600*hour)%60;\n' + + ' ' + branch + '\n' + + '}\n'; + generator.definitions_[Vpin] = code; + return ""; +}; + +// 执行器-蜂鸣器频率选择列表 +export const tone_notes = function (_, generator) { + let code = this.getFieldValue('STAT'); + return [code, generator.ORDER_ATOMIC]; +}; + +export const factory_declare2 = function (_, generator) { + let VALUE = this.getFieldValue('VALUE'); + generator.definitions_['var_' + VALUE] = VALUE; + return ''; +}; + +// 一键配网(无需安可信) +export const blynk_AP_config = function (_, generator) { + let server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + let auth_key = generator.valueToCode(this, 'auth_key', generator.ORDER_ATOMIC); + let board_type = JSFuncs.getPlatform(); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp8266'] = '#include '; + } + else if (board_type.match(RegExp(/ESP32/))) { + generator.definitions_['include_WiFi'] = '#include '; + generator.definitions_['include_WiFiClient'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp32'] = '#include '; + } + generator.definitions_['include_DNSServer'] = '#include '; + generator.definitions_['include_ESP8266WebServer'] = '#include \n'; + generator.definitions_['include_WiFiManager'] = '#include '; + generator.definitions_['var_declare_WiFiServer'] = 'WiFiServer server(80);'; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth_key + ';'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_WiFiManager'] = 'WiFiManager wifiManager;'; + generator.setups_['setup_wifiManagerautoConnect'] = 'wifiManager.autoConnect("Blynk");'; + generator.setups_['setup_server.begin'] = 'Serial.println("Connected.");\n server.begin();'; + if (isNaN(server_add.charAt(2))) { + generator.setups_['setup_Blynkconfig'] = 'Blynk.config(auth, ' + server_add + ', 8080);'; + } + else { + server_add = server_add.replace(/"/g, "").replace(/\./g, ","); + generator.setups_['setup_Blynkconfig'] = 'Blynk.config(auth, ' + 'IPAddress(' + server_add + '), 8080);'; + } + let code = 'Blynk.run();'; + return code; +}; + +// 一键配网手动配置授权码(无需安可信) +export const blynk_AP_config_2 = function (_, generator) { + let server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['include_FS'] = '#include '; + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp8266'] = '#include '; + generator.definitions_['include_DNSServer'] = '#include '; + generator.definitions_['include_ESP8266WebServer'] = '#include '; + generator.definitions_['include_WiFiManager'] = '#include '; + generator.definitions_['include_ArduinoJson'] = '#include '; + generator.definitions_['var_declare_auth_key'] = 'char blynk_token[34] = "YOUR_BLYNK_TOKEN";'; + generator.definitions_['var_declare_shouldSaveConfig'] = 'bool shouldSaveConfig = false;'; + generator.definitions_['saveConfigCallback'] = 'void saveConfigCallback (){\n' + + ' Serial.println("Should save config");\n' + + ' shouldSaveConfig = true;\n' + + '}'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['otasetup1'] = 'Serial.println("mounting FS...");\n' + + ' if (SPIFFS.begin()){\n' + + ' Serial.println("mounted file system");\n' + + ' if (SPIFFS.exists("/config.json")) {\n' + + ' Serial.println("reading config file");\n' + + ' File configFile = SPIFFS.open("/config.json", "r");\n' + + ' if (configFile) {\n' + + ' Serial.println("opened config file");\n' + + ' size_t size = configFile.size();\n' + + ' std::unique_ptr buf(new char[size]);\n' + + ' configFile.readBytes(buf.get(), size);\n' + + ' DynamicJsonBuffer jsonBuffer;\n' + + ' JsonObject& json = jsonBuffer.parseObject(buf.get());\n' + + ' json.printTo(Serial);\n' + + ' if (json.success()){\n' + + ' Serial.println("parsed json");\n' + + ' strcpy(blynk_token, json["blynk_token"]);\n' + + ' }\n' + + ' else{\n' + + ' Serial.println("failed to load json config");\n' + + ' }\n' + + ' configFile.close();\n' + + ' }\n' + + ' }\n' + + ' }' + + ' else{\n' + + ' Serial.println("failed to mount FS");\n' + + ' }\n' + + ' WiFiManagerParameter custom_blynk_token("blynk", "blynk token", blynk_token, 32);\n' + + ' WiFiManager wifiManager;\n' + + ' wifiManager.setSaveConfigCallback(saveConfigCallback);\n' + + ' wifiManager.addParameter(&custom_blynk_token);\n' + + ' wifiManager.setMinimumSignalQuality(10);\n' + + ' if (!wifiManager.autoConnect()){\n' + + ' Serial.println("failed to connect and hit timeout");\n' + + ' delay(3000);\n' + + ' ESP.reset();\n' + + ' delay(5000);\n' + + ' }\n' + + ' Serial.println("connected...yeey :)");\n' + + ' strcpy(blynk_token, custom_blynk_token.getValue());\n' + + ' if(shouldSaveConfig){\n' + + ' Serial.println("saving config");\n' + + ' DynamicJsonBuffer jsonBuffer;\n' + + ' JsonObject& json = jsonBuffer.createObject();\n' + + ' json["blynk_token"] = blynk_token;\n' + + ' File configFile = SPIFFS.open("/config.json", "w");\n' + + ' if(!configFile){\n' + + ' Serial.println("failed to open config file for writing");\n' + + ' }\n' + + ' json.printTo(Serial);\n' + + ' json.printTo(configFile);\n' + + ' configFile.close();\n' + + ' }\n' + + ' Serial.println("local ip");\n' + + ' Serial.println(WiFi.localIP());\n'; + if (isNaN(server_add.charAt(2))) { + generator.setups_['otasetup1'] += ' Blynk.config(blynk_token,' + server_add + ',8080);'; + } + else { + server_add = server_add.replace(/"/g, "").replace(/\./g, ","); + generator.setups_['otasetup1'] += ' Blynk.config(blynk_token,' + 'IPAddress(' + server_add + '),8080);'; + } + let code = 'Blynk.run();\n'; + return code; +}; + +export const Blynk_connect_state = function (_, generator) { + let code = 'Blynk.connected()'; + return [code, generator.ORDER_ATOMIC]; +}; + +// Blynk终端清屏 +export const blynk_terminal_clear = function () { + let code = 'terminal.clear();\n'; + return code; +}; + +// Blynk LCD显示 +export const blynk_lcd = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let x = generator.valueToCode(this, 'x', generator.ORDER_ATOMIC); + let y = generator.valueToCode(this, 'y', generator.ORDER_ATOMIC); + let value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC); + generator.definitions_['include_lcd'] = 'WidgetLCD lcd(' + Vpin + ');\n'; + let code = 'lcd.print(' + x + ', ' + y + ', ' + value + ');\n'; + return code; +}; + +// Blynk LCD清屏 +export const blynk_lcd_clear = function () { + let code = 'lcd.clear();\n'; + return code; +}; + +// ESP32 blynk BLE连接方式 +export const blynk_esp32_ble = function (_, generator) { + let auth = generator.valueToCode(this, 'auth', generator.ORDER_ATOMIC); + let name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['define_BLYNK_USE_DIRECT_CONNECT'] = '#define BLYNK_USE_DIRECT_CONNECT'; + generator.definitions_['include_BlynkSimpleEsp32_BLE'] = '#include '; + generator.definitions_['include_BLEDevice'] = '#include '; + generator.definitions_['include_BLEServer'] = '#include \n'; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth + ';'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Serial.println("Waiting for connections...");\n' + + ' Blynk.setDeviceName(' + name + ');\n' + + ' Blynk.begin(auth);\n'; + let code = 'Blynk.run();\n'; + return code; +}; + +// ESP32 blynk Bluetooth连接方式 +export const blynk_esp32_Bluetooth = function (_, generator) { + let auth = generator.valueToCode(this, 'auth', generator.ORDER_ATOMIC); + let name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['define_BLYNK_USE_DIRECT_CONNECT'] = '#define BLYNK_USE_DIRECT_CONNECT'; + generator.definitions_['include_BlynkSimpleEsp32_BT'] = '#include \n'; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth + ';'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Serial.println("Waiting for connections...");\n' + + ' Blynk.setDeviceName(' + name + ');\n' + + ' Blynk.begin(auth);\n'; + let code = 'Blynk.run();\n'; + return code; +}; + +// Arduino blynk Bluetooth 连接方式 +export const arduino_blynk_bluetooth = function (_, generator) { + let auth = generator.valueToCode(this, 'auth', generator.ORDER_ATOMIC); + let RX = generator.valueToCode(this, 'RX', generator.ORDER_ATOMIC); + let TX = generator.valueToCode(this, 'TX', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['include_SoftwareSerial'] = '#include '; + generator.definitions_['include_BlynkSimpleSerialBLE'] = '#include '; + generator.definitions_['define_auth'] = 'char auth[] = ' + auth + ';'; + if (RX != 0 || TX != 1) { + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.definitions_['var_declare_SoftwareSerial'] = 'SoftwareSerial SerialBLE(' + RX + ', ' + TX + ');'; + generator.setups_['setup_SerialBLE_begin'] = 'SerialBLE.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Blynk.begin(SerialBLE, auth);'; + } + else { + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_Blynk.begin'] = 'Blynk.begin(Serial, auth);'; + } + generator.setups_['setup_Serial.println'] = 'Serial.println("Waiting for connections...");'; + let code = 'Blynk.run();\n'; + return code; +}; + +// Blynk Table小部件添加数据 +export const blynk_table = function (_, generator) { + let id = generator.valueToCode(this, 'id', generator.ORDER_ATOMIC); + let mingcheng = generator.valueToCode(this, 'mingcheng', generator.ORDER_ATOMIC); + let shujv = generator.valueToCode(this, 'shujv', generator.ORDER_ATOMIC); + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.virtualWrite(' + Vpin + ', "add", ' + id + ',' + mingcheng + ', ' + shujv + ');\n'; + return code; +}; + +// Blynk Table小部件更新数据 +export const blynk_table_update = function (_, generator) { + let id = generator.valueToCode(this, 'id', generator.ORDER_ATOMIC); + let mingcheng = generator.valueToCode(this, 'mingcheng', generator.ORDER_ATOMIC); + let shujv = generator.valueToCode(this, 'shujv', generator.ORDER_ATOMIC); + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.virtualWrite(' + Vpin + ', "update", ' + id + ',' + mingcheng + ', ' + shujv + ');\n'; + return code; +}; + +// Blynk Table小部件高亮显示数据 +export const blynk_table_highlight = function (_, generator) { + let id = generator.valueToCode(this, 'id', generator.ORDER_ATOMIC); + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.virtualWrite(' + Vpin + ', "pick", ' + id + ');\n'; + return code; +}; + +// Blynk Table小部件选择数据 +export const blynk_table_select = function (_, generator) { + let id = generator.valueToCode(this, 'id', generator.ORDER_ATOMIC); + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.virtualWrite(' + Vpin + ', "select", ' + id + ');\n'; + return code; +}; + +// Blynk Table小部件取消选择数据 +export const blynk_table_unselect = function (_, generator) { + let id = generator.valueToCode(this, 'id', generator.ORDER_ATOMIC); + let Vpin = this.getFieldValue('Vpin'); + let code = 'Blynk.virtualWrite(' + Vpin + ', "deselect", ' + id + ');\n'; + return code; +}; + +// Blynk Table小部件数据清除 +export const blynk_table_cleardata = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + generator.definitions_["rowIndex_" + Vpin] = 'int rowIndex_' + Vpin + ' = 0;\n'; + let code = 'Blynk.virtualWrite(' + Vpin + ', "clr");\nrowIndex_' + Vpin + ' = 0;\n'; + return code; +}; + +// blynk服务器连接状态 +export const blynk_connected = function (_, generator) { + let code = 'Blynk.connected()'; + return [code, generator.ORDER_ATOMIC]; +}; + +// ESP32 CAM相机 +export const esp_camera = function (_, generator) { + let wifi_ssid = generator.valueToCode(this, 'wifi_ssid', generator.ORDER_ATOMIC); + let wifi_pass = generator.valueToCode(this, 'wifi_pass', generator.ORDER_ATOMIC); + let mode = this.getFieldValue('mode'); + let code = ""; + if (mode > 0) { + code = 'WiFi.begin(wif_ssid,wif_password);\n' + + ' while (WiFi.status() != WL_CONNECTED){\n' + + ' delay(500);\n' + + ' Serial.print(".");\n' + + ' }\n' + + ' Serial.println("");\n' + + ' Serial.println("WiFi connected");\n' + + ' Serial.print("Camera Stream Ready! Go to: http://");\n' + + ' Serial.print(WiFi.localIP());\n' + + ' Serial.println("");\n'; + } else { + code = 'Serial.print("Setting AP (Access Point)…");\n' + + 'WiFi.softAP(wif_ssid,wif_password);\n' + + 'IPAddress IP = WiFi.softAPIP();\n' + + 'Serial.print("Camera Stream Ready! Connect to the ESP32 AP and go to: http://");\n' + + 'Serial.println(IP);\n' + + 'Serial.println("");\n'; + } + generator.definitions_['esp_camera'] = '#include "esp_camera.h"\n#include \n#include "esp_timer.h"\n#include "img_converters.h"\n#include \n#include "fb_gfx.h"\n#include "soc/soc.h"\n#include "soc/rtc_cntl_reg.h"\n#include "dl_lib.h"\n#include "esp_http_server.h"\nconst char*wif_ssid = ' + wifi_ssid + ';\nconst char*wif_password = ' + wifi_pass + ';\n#define PART_BOUNDARY "123456789000000000000987654321"\n#define PWDN_GPIO_NUM 32\n#define RESET_GPIO_NUM -1\n#define XCLK_GPIO_NUM 0\n#define SIOD_GPIO_NUM 26\n#define SIOC_GPIO_NUM 27\n#define Y9_GPIO_NUM 35\n#define Y8_GPIO_NUM 34\n#define Y7_GPIO_NUM 39\n#define Y6_GPIO_NUM 36\n#define Y5_GPIO_NUM 21\n#define Y4_GPIO_NUM 19\n#define Y3_GPIO_NUM 18\n#define Y2_GPIO_NUM 5\n#define VSYNC_GPIO_NUM 25\n#define HREF_GPIO_NUM 23\n#define PCLK_GPIO_NUM 22\nstatic const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;\nstatic const char* _STREAM_BOUNDARY = "\\r\\n--" PART_BOUNDARY "\\r\\n";\nstatic const char* _STREAM_PART = "Content-Type: image/jpeg\\r\\nContent-Length: %u\\r\\n\\r\\n";\nhttpd_handle_t stream_httpd = NULL;\nstatic esp_err_t stream_handler(httpd_req_t *req){\n camera_fb_t * fb = NULL;\n esp_err_t res = ESP_OK;\n size_t _jpg_buf_len = 0;\n uint8_t * _jpg_buf = NULL;\n char * part_buf[64];\n res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);\n if(res != ESP_OK){\n return res;\n }\n while(true){\n fb = esp_camera_fb_get();\n if (!fb) {\n Serial.println("Camera capture failed");\n res = ESP_FAIL;\n } else {\n if(fb->width > 400){\n if(fb->format != PIXFORMAT_JPEG){\n bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);\n esp_camera_fb_return(fb);\n fb = NULL;\n if(!jpeg_converted){\n Serial.println("JPEG compression failed");\n res = ESP_FAIL;\n }\n } else {\n _jpg_buf_len = fb->len;\n _jpg_buf = fb->buf;\n }\n }\n }\n if(res == ESP_OK){\n size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);\n res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);\n }\n if(res == ESP_OK){\n res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);\n }\n if(res == ESP_OK){\n res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));\n }\n if(fb){\n esp_camera_fb_return(fb);\n fb = NULL;\n _jpg_buf = NULL;\n } else if(_jpg_buf){\n free(_jpg_buf);\n _jpg_buf = NULL;\n }\n if(res != ESP_OK){\n break;\n }\n }\n return res;\n}\nvoid startCameraServer(){\n httpd_config_t config = HTTPD_DEFAULT_CONFIG();\n config.server_port = 80;\n httpd_uri_t index_uri = {\n .uri = "/",\n .method = HTTP_GET,\n .handler = stream_handler,\n .user_ctx = NULL\n };\n if (httpd_start(&stream_httpd, &config) == ESP_OK) {\n httpd_register_uri_handler(stream_httpd, &index_uri);\n } \n}\n'; + generator.setups_['setups_esp_camera'] = ' WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);\n Serial.begin(115200);\n Serial.setDebugOutput(false);\n camera_config_t config;\n config.ledc_channel = LEDC_CHANNEL_0;\n config.ledc_timer = LEDC_TIMER_0;\n config.pin_d0 = Y2_GPIO_NUM;\n config.pin_d1 = Y3_GPIO_NUM;\n config.pin_d2 = Y4_GPIO_NUM;\n config.pin_d3 = Y5_GPIO_NUM;\n config.pin_d4 = Y6_GPIO_NUM;\n config.pin_d5 = Y7_GPIO_NUM;\n config.pin_d6 = Y8_GPIO_NUM;\n config.pin_d7 = Y9_GPIO_NUM;\n config.pin_xclk = XCLK_GPIO_NUM;\n config.pin_pclk = PCLK_GPIO_NUM;\n config.pin_vsync = VSYNC_GPIO_NUM;\n config.pin_href = HREF_GPIO_NUM;\n config.pin_sscb_sda = SIOD_GPIO_NUM;\n config.pin_sscb_scl = SIOC_GPIO_NUM;\n config.pin_pwdn = PWDN_GPIO_NUM;\n config.pin_reset = RESET_GPIO_NUM;\n config.xclk_freq_hz = 20000000;\n config.pixel_format = PIXFORMAT_JPEG; \n if(psramFound()){\n config.frame_size = FRAMESIZE_UXGA;\n config.jpeg_quality = 10;\n config.fb_count = 2;\n } else {\n config.frame_size = FRAMESIZE_SVGA;\n config.jpeg_quality = 12;\n config.fb_count = 1;\n }\n esp_err_t err = esp_camera_init(&config);\n if (err != ESP_OK) {\n Serial.printf("Camera init failed with error 0x%x", err);\n return;\n }\n ' + code + ' startCameraServer();\n'; + return 'delay(1);\n'; +}; + +// ESP32 CAM相机 & blynk +export const esp_camera_blynk = function (_, generator) { + let wifi_ssid = generator.valueToCode(this, 'wifi_ssid', generator.ORDER_ATOMIC); + let wifi_pass = generator.valueToCode(this, 'wifi_pass', generator.ORDER_ATOMIC); + let server_add = generator.valueToCode(this, 'server', generator.ORDER_ATOMIC); + if (!isNaN(server_add.charAt(2))) { + server_add = server_add.replace(/"/g, "").replace(/\./g, ","); + server_add = 'IPAddress(' + server_add + ')'; + } + let auth = generator.valueToCode(this, 'auth', generator.ORDER_ATOMIC); + generator.definitions_['define_BLYNK_PRINT'] = '#define BLYNK_PRINT Serial'; + generator.definitions_['include_WiFi'] = '#include '; + generator.definitions_['include_BlynkSimpleEsp32'] = '#include '; + generator.definitions_['include_WidgetRTC'] = '#include '; + generator.definitions_['include_WiFiClient'] = '#include '; + generator.definitions_['include_TimeLib'] = '#include '; + generator.definitions_['var_declare_auth_key'] = 'char auth[] = ' + auth + ';'; + + generator.definitions_['esp_camera'] = '#include "esp_camera.h"\n#include "esp_timer.h"\n#include "img_converters.h"\n#include \n#include "fb_gfx.h"\n#include "soc/soc.h"\n#include "soc/rtc_cntl_reg.h"\n#include "dl_lib.h"\n#include "esp_http_server.h"\nconst char*wif_ssid = ' + wifi_ssid + ';\nconst char*wif_password = ' + wifi_pass + ';\n#define PART_BOUNDARY "123456789000000000000987654321"\n#define PWDN_GPIO_NUM 32\n#define RESET_GPIO_NUM -1\n#define XCLK_GPIO_NUM 0\n#define SIOD_GPIO_NUM 26\n#define SIOC_GPIO_NUM 27\n#define Y9_GPIO_NUM 35\n#define Y8_GPIO_NUM 34\n#define Y7_GPIO_NUM 39\n#define Y6_GPIO_NUM 36\n#define Y5_GPIO_NUM 21\n#define Y4_GPIO_NUM 19\n#define Y3_GPIO_NUM 18\n#define Y2_GPIO_NUM 5\n#define VSYNC_GPIO_NUM 25\n#define HREF_GPIO_NUM 23\n#define PCLK_GPIO_NUM 22\nstatic const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;\nstatic const char* _STREAM_BOUNDARY = "\\r\\n--" PART_BOUNDARY "\\r\\n";\nstatic const char* _STREAM_PART = "Content-Type: image/jpeg\\r\\nContent-Length: %u\\r\\n\\r\\n";\nhttpd_handle_t stream_httpd = NULL;\nstatic esp_err_t stream_handler(httpd_req_t *req){\n camera_fb_t * fb = NULL;\n esp_err_t res = ESP_OK;\n size_t _jpg_buf_len = 0;\n uint8_t * _jpg_buf = NULL;\n char * part_buf[64];\n res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);\n if(res != ESP_OK){\n return res;\n }\n while(true){\n fb = esp_camera_fb_get();\n if (!fb) {\n Serial.println("Camera capture failed");\n res = ESP_FAIL;\n } else {\n if(fb->width > 400){\n if(fb->format != PIXFORMAT_JPEG){\n bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);\n esp_camera_fb_return(fb);\n fb = NULL;\n if(!jpeg_converted){\n Serial.println("JPEG compression failed");\n res = ESP_FAIL;\n }\n } else {\n _jpg_buf_len = fb->len;\n _jpg_buf = fb->buf;\n }\n }\n }\n if(res == ESP_OK){\n size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);\n res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);\n }\n if(res == ESP_OK){\n res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);\n }\n if(res == ESP_OK){\n res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));\n }\n if(fb){\n esp_camera_fb_return(fb);\n fb = NULL;\n _jpg_buf = NULL;\n } else if(_jpg_buf){\n free(_jpg_buf);\n _jpg_buf = NULL;\n }\n if(res != ESP_OK){\n break;\n }\n }\n return res;\n}\nvoid startCameraServer(){\n httpd_config_t config = HTTPD_DEFAULT_CONFIG();\n config.server_port = 80;\n httpd_uri_t index_uri = {\n .uri = "/",\n .method = HTTP_GET,\n .handler = stream_handler,\n .user_ctx = NULL\n };\n if (httpd_start(&stream_httpd, &config) == ESP_OK) {\n httpd_register_uri_handler(stream_httpd, &index_uri);\n } \n}\n'; + generator.setups_['setups_esp_camera'] = 'WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);\n Serial.begin(115200);\n Serial.setDebugOutput(false);\n camera_config_t config;\n config.ledc_channel = LEDC_CHANNEL_0;\n config.ledc_timer = LEDC_TIMER_0;\n config.pin_d0 = Y2_GPIO_NUM;\n config.pin_d1 = Y3_GPIO_NUM;\n config.pin_d2 = Y4_GPIO_NUM;\n config.pin_d3 = Y5_GPIO_NUM;\n config.pin_d4 = Y6_GPIO_NUM;\n config.pin_d5 = Y7_GPIO_NUM;\n config.pin_d6 = Y8_GPIO_NUM;\n config.pin_d7 = Y9_GPIO_NUM;\n config.pin_xclk = XCLK_GPIO_NUM;\n config.pin_pclk = PCLK_GPIO_NUM;\n config.pin_vsync = VSYNC_GPIO_NUM;\n config.pin_href = HREF_GPIO_NUM;\n config.pin_sscb_sda = SIOD_GPIO_NUM;\n config.pin_sscb_scl = SIOC_GPIO_NUM;\n config.pin_pwdn = PWDN_GPIO_NUM;\n config.pin_reset = RESET_GPIO_NUM;\n config.xclk_freq_hz = 20000000;\n config.pixel_format = PIXFORMAT_JPEG; \n if(psramFound()){\n config.frame_size = FRAMESIZE_UXGA;\n config.jpeg_quality = 10;\n config.fb_count = 2;\n } else {\n config.frame_size = FRAMESIZE_SVGA;\n config.jpeg_quality = 12;\n config.fb_count = 1;\n }\n esp_err_t err = esp_camera_init(&config);\n if (err != ESP_OK) {\n Serial.printf("Camera init failed with error 0x%x", err);\n return;\n }\n WiFi.begin(wif_ssid,wif_password);\n while (WiFi.status() != WL_CONNECTED) {\n delay(500);\n Serial.print(".");\n }\n Serial.println("");\n Serial.println("WiFi connected");\n Serial.print("Camera Stream Ready! Go to: http://");\n Serial.print(WiFi.localIP());\n Serial.println("");\n startCameraServer();\n Blynk.config(auth,' + server_add + ',8080);\n'; + return 'Blynk.run();\n'; +}; + +export const take_a_photo1 = function (_, generator) { + generator.definitions_['take_a_photo'] = '#include "esp_camera.h"\n#include "esp_timer.h"\n#include "img_converters.h"\n#include \n#include "fb_gfx.h"\n#include "fd_forward.h"\n#include "fr_forward.h"\n#include "FS.h" \n#include "SD_MMC.h" \n#include "soc/soc.h"\n#include "soc/rtc_cntl_reg.h" \n#include "dl_lib.h"\n#include "driver/rtc_io.h"\n#include \n#define EEPROM_SIZE 1\n#define PWDN_GPIO_NUM 32\n#define RESET_GPIO_NUM -1\n#define XCLK_GPIO_NUM 0\n#define SIOD_GPIO_NUM 26\n#define SIOC_GPIO_NUM 27\n#define Y9_GPIO_NUM 35\n#define Y8_GPIO_NUM 34\n#define Y7_GPIO_NUM 39\n#define Y6_GPIO_NUM 36\n#define Y5_GPIO_NUM 21\n#define Y4_GPIO_NUM 19\n#define Y3_GPIO_NUM 18\n#define Y2_GPIO_NUM 5\n#define VSYNC_GPIO_NUM 25\n#define HREF_GPIO_NUM 23\n#define PCLK_GPIO_NUM 22\nint pictureNumber = 0;\n'; + let code = 'WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);\nSerial.begin(115200);\ncamera_config_t config;\nconfig.ledc_channel = LEDC_CHANNEL_0;\nconfig.ledc_timer = LEDC_TIMER_0;\nconfig.pin_d0 = Y2_GPIO_NUM;\nconfig.pin_d1 = Y3_GPIO_NUM;\nconfig.pin_d2 = Y4_GPIO_NUM;\nconfig.pin_d3 = Y5_GPIO_NUM;\nconfig.pin_d4 = Y6_GPIO_NUM;\nconfig.pin_d5 = Y7_GPIO_NUM;\nconfig.pin_d6 = Y8_GPIO_NUM;\nconfig.pin_d7 = Y9_GPIO_NUM;\nconfig.pin_xclk = XCLK_GPIO_NUM;\nconfig.pin_pclk = PCLK_GPIO_NUM;\nconfig.pin_vsync = VSYNC_GPIO_NUM;\nconfig.pin_href = HREF_GPIO_NUM;\nconfig.pin_sscb_sda = SIOD_GPIO_NUM;\nconfig.pin_sscb_scl = SIOC_GPIO_NUM;\nconfig.pin_pwdn = PWDN_GPIO_NUM;\nconfig.pin_reset = RESET_GPIO_NUM;\nconfig.xclk_freq_hz = 20000000;\nconfig.pixel_format = PIXFORMAT_JPEG; \nif(psramFound()){\n config.frame_size = FRAMESIZE_UXGA;\n config.jpeg_quality = 10;\n config.fb_count = 2;\n} else {\n config.frame_size = FRAMESIZE_SVGA;\n config.jpeg_quality = 12;\n config.fb_count = 1;\n}\nesp_err_t err = esp_camera_init(&config);\nif (err != ESP_OK) {\n Serial.printf("Camera init failed with error 0x%x", err);\n return;\n}\nif(!SD_MMC.begin()){\n Serial.println("SD Card Mount Failed");\n return;\n}\nuint8_t cardType = SD_MMC.cardType();\nif(cardType == CARD_NONE){\n Serial.println("No SD Card attached");\n return;\n}\ncamera_fb_t * fb = NULL;\nfb = esp_camera_fb_get();\nif(!fb) {\n Serial.println("Camera capture failed");\n return;\n}\nEEPROM.begin(EEPROM_SIZE);\npictureNumber = EEPROM.read(0) + 1;\nString path = "/picture" + String(pictureNumber) +".jpg";\nfs::FS &fs = SD_MMC; \nSerial.printf("Picture file name: %s\\n", path.c_str());\nFile file = fs.open(path.c_str(), FILE_WRITE);\nif(!file){\n Serial.println("Failed to open file in writing mode");\n} \nelse {\n file.write(fb->buf, fb->len);\n Serial.printf("Saved file to path: %s\\n", path.c_str());\n EEPROM.write(0, pictureNumber);\n EEPROM.commit();\n}\nfile.close();\nesp_camera_fb_return(fb); \npinMode(4, OUTPUT);\ndigitalWrite(4, LOW);\nrtc_gpio_hold_en(GPIO_NUM_4);\n'; + return code; +}; + +export const blynk_table_click = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'function'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_["blynk_table" + Vpin] = 'WidgetTable table_' + Vpin + ';\nBLYNK_ATTACH_WIDGET(table_' + Vpin + ', ' + Vpin + ');\n'; + generator.setups_["setup_blynk_table_click" + Vpin] = 'table_' + Vpin + '.onSelectChange([](int index, bool selected) {\n ' + branch + '\n });\n'; + let code = ''; + return code; +}; + +export const blynk_table_order = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let branch = generator.statementToCode(this, 'function'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_["blynk_table" + Vpin] = 'WidgetTable table_' + Vpin + ';\nBLYNK_ATTACH_WIDGET(table_' + Vpin + ', ' + Vpin + ');\n'; + generator.setups_["setup_blynk_table_order" + Vpin] = 'table_' + Vpin + '.onOrderChange([](int indexFrom, int indexTo) {\n ' + branch + '\n });\n'; + let code = ''; + return code; +}; + +export const blynk_table_add_data = function (_, generator) { + let Vpin = this.getFieldValue('Vpin'); + let data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + let name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + generator.definitions_["rowIndex_" + Vpin] = 'int rowIndex_' + Vpin + ' = 0;\n'; + let code = 'table_' + Vpin + '.addRow(rowIndex_' + Vpin + ', ' + name + ', ' + data + ');\ntable_' + Vpin + '.pickRow(rowIndex_' + Vpin + ');\nrowIndex_' + Vpin + '++;\n'; + return code; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/communicate.js b/mixly/boards/default_src/arduino_avr/generators/communicate.js new file mode 100644 index 00000000..55fe3b1b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/communicate.js @@ -0,0 +1,696 @@ +import { Profile } from 'mixly'; + +export const ir_recv = function (_, generator) { + /*var xmlDom = Blockly.Xml.workspaceToDom(Mixly.Editor.blockEditor); + var xmlText = Blockly.Xml.domToPrettyText(xmlDom); + if (xmlText.indexOf("type=\"controls_tone\"") === -1 && xmlText.indexOf("type=\"controls_notone\"") === -1) { + this.setWarningText(null); + } else { + this.setWarningText(Blockly.Msg.IR_AND_TONE_WARNING); + }*/ + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var branch = generator.statementToCode(this, 'DO'); + var branch2 = generator.statementToCode(this, 'DO2'); + generator.definitions_['include_IRremote'] = '#include \n'; + generator.definitions_['var_declare_irProtocolList'] = + `const String IR_PROTOCOL_TYPE[] = { + "UNKNOWN", + "PULSE_DISTANCE", + "PULSE_WIDTH", + "DENON", + "DISH", + "JVC", + "LG", + "LG2", + "NEC", + "PANASONIC", + "KASEIKYO", + "KASEIKYO_JVC", + "KASEIKYO_DENON", + "KASEIKYO_SHARP", + "KASEIKYO_MITSUBISHI", + "RC5", + "RC6", + "SAMSUNG", + "SHARP", + "SONY", + "ONKYO", + "APPLE", + "BOSEWAVE", + "LEGO_PF", + "MAGIQUEST", + "WHYNTER" +};`; + generator.definitions_['var_declare_irrecv_' + dropdown_pin] = `IRrecv irrecv_${dropdown_pin}(${dropdown_pin});\n`; + generator.setups_['setup_ir_recv_' + dropdown_pin] = `irrecv_${dropdown_pin}.enableIRIn();`; + var code = + `if (irrecv_${dropdown_pin}.decode()) { + struct IRData *pIrData = &irrecv_${dropdown_pin}.decodedIRData; + long ir_item = pIrData->decodedRawData; + String irProtocol = IR_PROTOCOL_TYPE[pIrData->protocol]; + Serial.print("IR TYPE:" + irProtocol + "\\tVALUE:"); + Serial.println(ir_item, HEX); + irrecv_${dropdown_pin}.resume(); +${branch} +} else { +${branch2} +}\n`; + return code; +}; + +export const ir_recv_enable = function (_, generator) { + /*var xmlDom = Blockly.Xml.workspaceToDom(Mixly.Editor.blockEditor); + var xmlText = Blockly.Xml.domToPrettyText(xmlDom); + if (xmlText.indexOf("type=\"controls_tone\"") == -1 && xmlText.indexOf("type=\"controls_notone\"") == -1) { + this.setWarningText(null); + } + else { + this.setWarningText(Blockly.Msg.IR_AND_TONE_WARNING); + }*/ + + generator.definitions_['include_IRremote'] = '#include '; + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = 'irrecv_' + dropdown_pin + '.enableIRIn();\n'; + return code; +} + +export const ir_send_nec = function (_, generator) { + var pin = this.getFieldValue('PIN'); + generator.definitions_['include_IRremote'] = '#include \n'; + generator.definitions_['var_declare_ir_send_' + pin] = `IRsend irsend_${pin}(${pin});`; + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC) || '0'; + var bits = generator.valueToCode(this, 'bits', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = `irsend_${pin}.send${type}(${data},${bits});\n`; + return code; +} + +export const ir_recv_raw = function (_, generator) { + /*var xmlDom = Blockly.Xml.workspaceToDom(Mixly.Editor.blockEditor); + var xmlText = Blockly.Xml.domToPrettyText(xmlDom); + if (xmlText.indexOf("type=\"controls_tone\"") == -1 && xmlText.indexOf("type=\"controls_notone\"") == -1) { + this.setWarningText(null); + } + else { + this.setWarningText(Blockly.Msg.IR_AND_TONE_WARNING); + }*/ + + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.definitions_['include_IRremote'] = '#include \n'; + generator.definitions_['var_declare_ir_recv' + dropdown_pin] = 'IRrecv irrecv_' + dropdown_pin + '(' + dropdown_pin + ');\ndecode_results results_' + dropdown_pin + ';\n'; + if (!generator.setups_['setup_serial_Serial']) { + generator.setups_['setup_serial_Serial'] = 'Serial.begin(' + Profile.default.serial + ');'; + } + generator.setups_['setup_ir_recv_' + dropdown_pin] = 'irrecv_' + dropdown_pin + '.enableIRIn();\n'; + var code = "if (irrecv_" + dropdown_pin + ".decode(&results_" + dropdown_pin + ")) {\n" + code += ' ' + 'dumpRaw(&results_' + dropdown_pin + ');\n'; + code += ' irrecv_' + dropdown_pin + '.resume();\n' + code += '}\n'; + var funcode = 'void dumpRaw(decode_results *results) {\n' + + ' int count = results->rawlen;\n' + + ' Serial.print("RawData (");\n' + + ' Serial.print(count, DEC);\n' + + ' Serial.print("): ");\n' + + ' for (int i = 0; i < count; i++) {\n' + + ' Serial.print(results->rawbuf[i]*MICROS_PER_TICK, DEC);\n' + + ' if(i!=count-1){\n' + + ' Serial.print(",");\n' + + ' }\n' + + ' }\n' + + ' Serial.println("");\n' + + '}\n'; + generator.definitions_['dumpRaw'] = funcode; + return code; +}; + +export const ir_send_raw = function (_, generator) { + var pin = this.getFieldValue('PIN'); + generator.definitions_['include_IRremote'] = '#include \n'; + generator.definitions_['var_declare_ir_send_' + pin] = `IRsend irsend_${pin}(${pin});`; + var length = generator.valueToCode(this, 'length', generator.ORDER_ATOMIC) || '0'; + var freq = generator.valueToCode(this, 'freq', generator.ORDER_ATOMIC) || '0'; + var text = this.getFieldValue('TEXT'); + var code = 'unsigned int buf_raw[' + length + ']={' + text + '};\n' + code = code + `irsend_${pin}.sendRaw(buf_raw,${length},${freq});\n`; + return code; +} + +export const i2c_master_writer = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var device = generator.valueToCode(this, 'device', generator.ORDER_ATOMIC) || '0'; + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC) || '0'; + var code = "Wire.beginTransmission(" + device + ");\n"; + code += "Wire.write(" + value + ");\n"; + code += "Wire.endTransmission();\n"; + return code; +}; + +export const i2c_master_reader2 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + //generator.setups_['setup_wire_begin'] ='Wire.begin();'; + var code = "Wire.read()"; + return [code, generator.ORDER_ATOMIC]; +}; + +// YANG add slave write +export const i2c_slave_write = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC) || '0'; + var code = "Wire.write(" + value + ");\n"; + return code; +}; + +export const RFID_init = function (_, generator) { + var sda = this.getFieldValue('SDA'); + generator.definitions_['include_SPI'] = '#include '; + generator.definitions_['include_RFID'] = '#include '; + generator.definitions_['var_declare_RFID'] = 'RFID rfid(' + sda + ',5);'; + generator.definitions_['var_declare__i and tmp'] = 'unsigned char i,tmp;'; + generator.definitions_['var_declare__status'] = 'unsigned char status;'; + generator.definitions_['var_declare__strmax'] = 'unsigned char str[MAX_LEN];'; + generator.definitions_['var_declare__RC_size'] = 'unsigned char RC_size;'; + generator.definitions_['var_declare__blockAddr'] = 'unsigned char blockAddr; //选择操作的块地址0~63'; + generator.definitions_['define_1'] = '//4字节卡序列号,第5字节为校验字节'; + generator.definitions_['define_2'] = 'unsigned char serNum[5];'; + generator.definitions_['define_3'] = '//写卡数据'; + generator.definitions_['define_5'] = '//原扇区A密码,16个扇区,每个扇区密码6Byte'; + generator.definitions_['define_6'] = 'unsigned char sectorKeyA[16][16] = {'; + generator.definitions_['define_7'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},'; + generator.definitions_['define_8'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},'; + generator.definitions_['define_9'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},};'; + + generator.definitions_['define_10'] = '//新扇区A密码,16个扇区,每个扇区密码6Byte'; + generator.definitions_['define_11'] = 'unsigned char sectorNewKeyA[16][16] = {'; + generator.definitions_['define_12'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},'; + generator.definitions_['define_13'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xff,0x07,0x80,0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},'; + generator.definitions_['define_14'] = ' {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xff,0x07,0x80,0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},};'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_output_2'] = 'SPI.begin();'; + generator.setups_['setup_output_3'] = 'rfid.init();'; + return ""; +}; + +export const RFID_on = function (_, generator) { + // Do while/until loop. + var branch = generator.statementToCode(this, 'do_'); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, + '\'' + this.id + '\'') + branch; + } + + return 'if(rfid.isCard()){\n' + branch + '}\n'; +}; + +export const RFID_readcardnum = function (_, generator) { + var funcName = 'RFID_readcardnum'; + var code = 'String ' + funcName + '(){\n' + + ' rfid.readCardSerial();\n' + + ' String stringserNum = String(rfid.serNum[0], HEX)+String(rfid.serNum[1], HEX)+String(rfid.serNum[2], HEX)+String(rfid.serNum[3], HEX)+String(rfid.serNum[4], HEX);\n' + + ' //选卡,返回卡容量(锁定卡片,防止多次读写)\n' + + ' rfid.selectTag(rfid.serNum);\n' + + ' return stringserNum;\n'//直接返回string + + '}\n'; + generator.definitions_[funcName] = code; + return [funcName + '()', generator.ORDER_ATOMIC]; +}; + +/* export const RFID_serialprintcardnum = function() { + var funcName='RFID_serialprintcardnum'; + var code='void'+ ' ' + funcName + '() {\n' + +"\n"+' //找卡 ' + +"\n"+' //读取卡序列号 ' + +"\n"+' if (rfid.readCardSerial()) ' + +"\n"+' {' + +"\n"+' Serial.print("The card\'s number is : "); ' + +"\n"+' Serial.print(rfid.serNum[0],HEX); ' + +"\n"+' Serial.print(rfid.serNum[1],HEX); ' + +"\n"+' Serial.print(rfid.serNum[2],HEX); ' + +"\n"+' Serial.print(rfid.serNum[3],HEX); ' + +"\n"+' Serial.print(rfid.serNum[4],HEX); ' + +"\n"+' Serial.println(" "); ' + +"\n"+' }' + +"\n"+' //选卡,返回卡容量(锁定卡片,防止多次读写)' + +"\n"+' rfid.selectTag(rfid.serNum);' + + '\n}\n'; + generator.definitions_[funcName] = code; + return funcName+'();\n'; +}; */ + +export const RFID_writecarddata = function (_, generator) { + var address2 = generator.valueToCode(this, 'address1', generator.ORDER_ATOMIC); + var data2 = this.getFieldValue('data1'); + var funcName = 'RFID_writecarddata'; + var code = 'void' + ' ' + funcName + '(int ad2){\n' + + ' rfid.readCardSerial();\n' + + ' //选卡,返回卡容量(锁定卡片,防止多次读写)\n' + + ' rfid.selectTag(rfid.serNum);\n' + + ' //写数据卡\n' + + ' blockAddr = ad2;\n' + + ' if(rfid.auth(PICC_AUTHENT1A, blockAddr, sectorKeyA[blockAddr/4], rfid.serNum) == MI_OK){\n' + + ' //写数据\n' + + ' status = rfid.write(blockAddr, sectorKeyA[blockAddr/4]);\n' + + ' Serial.print("set the new card password, and can modify the data of the Sector: ");\n' + + ' Serial.println(blockAddr/4,DEC);\n' + + ' blockAddr=blockAddr-3;\n' + + ' status=rfid.write(blockAddr,(unsigned char*)' + data2 + ');\n' + + ' if(status == MI_OK){\n' + + ' Serial.println("Write card OK!");\n' + + ' }\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName] = code; + return funcName + '(' + address2 + ');\n'; +} + +export const RFID_readcarddata = function (_, generator) { + var address3 = generator.valueToCode(this, 'address', generator.ORDER_ATOMIC); + var funcName = 'RFID_readcarddata' + var code = 'String' + ' ' + funcName + '(int ad3){\n' + + ' //读卡\n' + + ' blockAddr =ad3;\n' + + ' status = rfid.auth(PICC_AUTHENT1A, blockAddr, sectorNewKeyA[blockAddr/4], rfid.serNum);\n' + + ' if(status == MI_OK){ //认证\n' + + ' //读数据\n' + + ' if(rfid.read(blockAddr, str) == MI_OK)\n' + + ' {\n' + + ' Serial.print("Read from the card ,the data is : ");\n' + + ' Serial.println((char *)str);\n' + + ' }\n' + + ' }\n' + + ' rfid.halt();\n' + + ' String stringstr((char*)str);\n'//str是一个char数组,必须先转换成char*,才能继续转换成string + + ' return stringstr;\n' + + '}\n'; + generator.definitions_[funcName] = code; + return [funcName + '(' + address3 + ')', generator.ORDER_ATOMIC]; +}; + +/* export const RFID_serialprintcarddata = function() { + var address3 = generator.valueToCode(this, 'address', generator.ORDER_ATOMIC); + var funcName='RFID_serialprintcarddata'; + var code='void'+ ' ' + funcName + '(int ad3) {\n' + +"\n"+'//读卡 ' + +"\n"+' blockAddr =ad3; ' + +"\n"+' status = rfid.auth(PICC_AUTHENT1A, blockAddr, sectorNewKeyA[blockAddr/4], rfid.serNum);' + +"\n"+' if (status == MI_OK) //认证' + +"\n"+' {' + +"\n"+' //读数据' + +"\n"+' if( rfid.read(blockAddr, str) == MI_OK)' + +"\n"+' {' + +"\n"+' Serial.print("Read from the card ,the data is : ");' + +"\n"+' Serial.println((char *)str);' + +"\n"+' } ' + +"\n"+' } ' + +"\n"+' rfid.halt();' + + '\n}\n'; + generator.definitions_[funcName] = code; + return funcName+'('+address3+');\n'; +}; */ + +export const RFID_off = function (_, generator) { + var funcName = 'RFID_off'; + var code = 'void' + ' ' + funcName + '() {\n' + + "\n" + ' rfid.halt(); ' + + '\n}\n'; + generator.definitions_[funcName] = code; + return funcName + '();\n'; +}; + +export const RFID_in = function (_, generator) { + // Do while/until loop. + var funcName = 'RFID_readcardnum'; + var code = 'String' + ' ' + funcName + '() {\n' + + "\n" + ' rfid.readCardSerial(); ' + + "\n" + ' String stringserNum=String(rfid.serNum[0], HEX)+String(rfid.serNum[1], HEX)+String(rfid.serNum[2], HEX)+String(rfid.serNum[3], HEX)+String(rfid.serNum[4], HEX);' + + "\n" + ' //选卡,返回卡容量(锁定卡片,防止多次读写)' + + "\n" + ' rfid.selectTag(rfid.serNum);' + + "\n" + ' return stringserNum; '//直接返回string + + '\n}\n'; + generator.definitions_[funcName] = code; + var argument0 = generator.valueToCode(this, 'uid_', + generator.ORDER_NONE) || 'false'; + var branch = generator.statementToCode(this, 'do_'); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, + '\'' + this.id + '\'') + branch; + } + /* + fixed bug caused by parameter of strcmp() must be const char* + author:zyc + date:2018-12-7 + */ + if (argument0 != 'false') { + if (argument0.indexOf('"') === 0) + return 'if (' + 'strcmp(RFID_readcardnum().c_str(),' + argument0 + ')==0' + ') {\n' + branch + '}\n'; + return 'if (' + 'strcmp(RFID_readcardnum().c_str(),' + argument0 + '.c_str())==0' + ') {\n' + branch + '}\n'; + } + return ''; + +}; + +// 初始化RFID +export const MFRC522_init = function (_, generator) { + var text_rfid_name = this.getFieldValue('rfid_name'); + var value_PIN_SDA = generator.valueToCode(this, 'PIN_SDA', generator.ORDER_ATOMIC); + var value_PIN_RST = generator.valueToCode(this, 'PIN_RST', generator.ORDER_ATOMIC); + generator.definitions_['include_SPI'] = '#include '; + generator.definitions_['include_MFRC522'] = '#include '; + generator.definitions_['var_declare_' + text_rfid_name] = 'MFRC522 ' + text_rfid_name + '(' + value_PIN_SDA + ', ' + value_PIN_RST + ');'; + generator.setups_['setup_spi'] = 'SPI.begin();'; + generator.setups_['setup_mfc522_' + text_rfid_name] = text_rfid_name + '.PCD_Init();'; + var code = ''; + return code; +}; + +// RFID侦测到信号 +export const MFRC522_IsNewCard = function (_, generator) { + var text_rfid_name = this.getFieldValue('rfid_name'); + var statements_DO = generator.statementToCode(this, 'DO'); + generator.definitions_['function_MFRC522_IsNewCard'] = 'boolean MFRC522_IsNewCard(MFRC522 *_name){\n' + + ' if(!_name->PICC_IsNewCardPresent())\n' + + ' return false;\n' + + ' if(!_name->PICC_ReadCardSerial())\n' + + ' return false;\n' + + ' return true;\n' + + '}\n'; + var code = 'if(MFRC522_IsNewCard(&' + text_rfid_name + ')){\n' + + (statements_DO != '' ? statements_DO : '') + + ' ' + text_rfid_name + '.PICC_HaltA();\n' + + ' ' + text_rfid_name + '.PCD_StopCrypto1();\n' + + '}\n'; + return code; +}; + +// RFID读取卡号 +export const MFRC522_ReadCardUID = function (_, generator) { + var text_rfid_name = this.getFieldValue('rfid_name'); + generator.definitions_['function_MFRC522_ReadCardUID'] = 'String MFRC522_ReadCardUID(MFRC522 *_name){\n' + + ' String _CardUID = "";\n' + + ' for (byte _i = 0; _i < _name->uid.size; _i++){\n' + + ' if(_name->uid.uidByte[_i] < 0x10)\n' + + ' _CardUID += "0";\n' + + ' _CardUID += String(_name->uid.uidByte[_i], HEX);\n' + + ' }\n' + + ' return _CardUID;\n' + + '}\n'; + var code = 'MFRC522_ReadCardUID(&' + text_rfid_name + ')'; + return [code, generator.ORDER_ATOMIC]; +}; + +// RFID写卡 +export const MFRC522_WriteCard = function (_, generator) { + var text_rfid_name = this.getFieldValue('rfid_name'); + var value_block = generator.valueToCode(this, 'block', generator.ORDER_ATOMIC); + var value_buffer = generator.valueToCode(this, 'buffer', generator.ORDER_ATOMIC); + var value_length = generator.valueToCode(this, 'length', generator.ORDER_ATOMIC); + generator.definitions_['function_MFRC522_WriteCard'] = 'boolean MFRC522_WriteCard(MFRC522 *_name, byte _block, byte *_buffer, byte _length){\n' + + ' MFRC522::MIFARE_Key _key;\n' + + ' for(byte i = 0; i < 6; i++)\n' + + ' _key.keyByte[i] = 0xFF;\n' + + ' MFRC522::StatusCode _status;\n' + + ' _status = _name->PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, _block, &_key, &(_name->uid));\n' + + ' if(_status != MFRC522::STATUS_OK){\n' + + ' Serial.print(F("PCD_Authenticate() failed: "));\n' + + ' Serial.println(_name->GetStatusCodeName(_status));\n' + + ' return false;\n' + + ' }\n' + + ' else{\n' + + ' Serial.println(F("PCD_Authenticate() success;"));\n' + + ' }\n' + + ' _status = _name->MIFARE_Write(_block, _buffer, _length);\n' + + ' if(_status != MFRC522::STATUS_OK){\n' + + ' Serial.print(F("MIFARE_Write() failed: "));\n' + + ' Serial.println(_name->GetStatusCodeName(_status));\n' + + ' return false;\n' + + ' }\n' + + ' else{\n' + + ' Serial.println(F("MIFARE_Write() success;"));\n' + + ' }\n' + + ' return true;\n' + + '}\n' + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = 'MFRC522_WriteCard(&' + text_rfid_name + ', ' + value_block + ', ' + value_buffer + ', ' + value_length + ');\n'; + return code; +}; + +// RFID读卡 +export const MFRC522_ReadCard = function (_, generator) { + var text_rfid_name = this.getFieldValue('rfid_name'); + var value_block = generator.valueToCode(this, 'block', generator.ORDER_ATOMIC); + var value_buffer = generator.valueToCode(this, 'buffer', generator.ORDER_ATOMIC); + var value_length = generator.valueToCode(this, 'length', generator.ORDER_ATOMIC); + generator.definitions_['function_MFRC522_ReadCard'] = 'boolean MFRC522_ReadCard(MFRC522 *_name, byte _block, byte *_buffer, byte _length){\n' + + ' MFRC522::MIFARE_Key _key;\n' + + ' for(byte i = 0; i < 6; i++)\n' + + ' _key.keyByte[i] = 0xFF;\n' + + ' MFRC522::StatusCode _status;\n' + + ' _status = _name->PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, _block, &_key, &(_name->uid));\n' + + ' if(_status != MFRC522::STATUS_OK){\n' + + ' Serial.print(F("PCD_Authenticate() failed: "));\n' + + ' Serial.println(_name->GetStatusCodeName(_status));\n' + + ' return false;\n' + + ' }\n' + + ' else{\n' + + ' Serial.println(F("PCD_Authenticate() success;"));\n' + + ' }\n' + + ' if(_length < 18){\n' + + ' byte _Read_buffer[18];\n' + + ' byte _Read_buffer_length = 18;\n' + + ' _status = _name->MIFARE_Read(_block, _Read_buffer, &_Read_buffer_length);\n' + + ' if(_status != MFRC522::STATUS_OK){\n' + + ' Serial.print(F("MIFARE_Read() failed: "));\n' + + ' Serial.println(_name->GetStatusCodeName(_status));\n' + + ' return false;\n' + + ' }\n' + + ' else{\n' + + ' Serial.println(F("MIFARE_Read() success;"));\n' + + ' }\n' + + ' for(byte _i = 0; _i < _length; _i++)\n' + + ' _buffer[_i] = _Read_buffer[_i];\n' + + ' }\n' + + ' else{\n' + + ' _status = _name->MIFARE_Read(_block, _buffer, &_length);\n' + + ' if(_status != MFRC522::STATUS_OK){\n' + + ' Serial.print(F("MIFARE_Read() failed: "));\n' + + ' Serial.println(_name->GetStatusCodeName(_status));\n' + + ' return false;\n' + + ' }\n' + + ' else{\n' + + ' Serial.println(F("MIFARE_Read() success;"));\n' + + ' }\n' + + ' }\n' + + ' return true;\n' + + '}\n' + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = 'MFRC522_ReadCard(&' + text_rfid_name + ', ' + value_block + ', ' + value_buffer + ', ' + value_length + ');\n'; + return code; +}; + +// IIC主机初始化 +export const i2c_master_Init = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var code = ''; + return code; +}; + +// IIC从机初始化 +export const i2c_slave_Init = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + var value_i2c_address = generator.valueToCode(this, 'i2c_address', generator.ORDER_ATOMIC); + generator.setups_['setup_i2c'] = 'Wire.begin(' + value_i2c_address + ');'; + var code = ''; + return code; +}; + +// IIC发送数据 +export const i2c_begin_end_transmission = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + var value_i2c_address = generator.valueToCode(this, 'i2c_address', generator.ORDER_ATOMIC); + var statements_transmission_data = generator.statementToCode(this, 'transmission_data'); + var code = 'Wire.beginTransmission(' + value_i2c_address + ');\n' + + statements_transmission_data + + 'Wire.endTransmission();\n'; + return code; +}; + +// IIC写入数据 +export const i2c_write = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + var value_i2c_write_data = generator.valueToCode(this, 'i2c_write_data', generator.ORDER_ATOMIC); + var code = 'Wire.write(' + value_i2c_write_data + ');\n'; + return code; +}; + +export const i2c_slave_write_array = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var array = generator.valueToCode(this, 'array', generator.ORDER_ATOMIC); + var length = generator.valueToCode(this, 'length', generator.ORDER_ATOMIC) || '1'; + var code = "Wire.write(" + array + "," + length + ");\n"; + return code; +}; + +export const i2c_available = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + var workspace = this.workspace; + var blocks = workspace.getAllBlocks(); + var y = 0; + for (y = 0; y < blocks.length; y++) { + if (blocks[y].type == 'i2c_slave_Init') + break; + } + if (y == blocks.length) + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var code = "Wire.available()"; + return [code, generator.ORDER_ATOMIC]; +}; + +// 从机接收字节数 +export const i2c_howmany = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var code = "howMany"; + return [code, generator.ORDER_ATOMIC]; +}; + +// IIC读取数据 +export const i2c_read = function (_, generator) { + var code = "Wire.read()"; + return [code, generator.ORDER_ATOMIC]; +}; + +// SPI +export const spi_transfer = function (_, generator) { + generator.definitions_['include_SPI'] = '#include '; + generator.setups_['setup_spi'] = 'SPI.begin();'; + var pin = generator.valueToCode(this, 'pin', generator.ORDER_ATOMIC); + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC); + generator.setups_['setup_output_' + pin] = 'pinMode(' + pin + ', OUTPUT);'; + var code = "digitalWrite(" + pin + ", LOW);\n"; + code += "SPI.transfer(" + value + ");\n"; + code += "digitalWrite(" + pin + ", HIGH);\n"; + return code; +}; + +// SPI 初始化从机 +export const spi_begin_slave = function (_, generator) { + generator.definitions_['include_SPI'] = '#include '; + generator.setups_['setup_spi'] = 'pinMode(12, OUTPUT);' + + '\n SPCR |= _BV(SPE);'; + var code = ''; + return code; +}; + +// 寄存器读写 +export const i2c_master_writerReg = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var device = generator.valueToCode(this, 'device', generator.ORDER_ATOMIC) || '0'; + var regadd = generator.valueToCode(this, 'regadd', generator.ORDER_ATOMIC) || '0'; + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC) || '0'; + var code = "Wire.beginTransmission(" + device + ");\n"; + code += "Wire.write(" + regadd + ");\n"; + code += "Wire.write(" + value + ");\n"; + code += "Wire.endTransmission();\n"; + return code; +}; + +export const i2c_master_readerReg = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + var device = generator.valueToCode(this, 'device', generator.ORDER_ATOMIC) || '0'; + var regadd = generator.valueToCode(this, 'regadd', generator.ORDER_ATOMIC) || '0'; + var bytes = generator.valueToCode(this, 'bytes', generator.ORDER_ATOMIC) || '0'; + var code = "Wire.beginTransmission(" + device + ");\n"; + code += "Wire.write(" + regadd + ");\n"; + code += "Wire.requestFrom(" + device + ", " + bytes + ");\n"; + code += "Wire.endTransmission();\n"; + return code; +}; + +export const i2c_slave_onreceive = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + var value_onReceive_length = generator.valueToCode(this, 'onReceive_length', generator.ORDER_ATOMIC); + var statements_i2c_onReceive_data = generator.statementToCode(this, 'DO'); + generator.definitions_['function_receiveEvent'] = 'void receiveEvent(int ' + value_onReceive_length + ')' + + '\n{' + + ' ' + statements_i2c_onReceive_data + + '\n}\n' + generator.setups_['setup_i2c_receiveEvent'] = 'Wire.onReceive(receiveEvent);'; + var code = ''; + return code; +} + +export const i2c_slave_onrequest = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + generator.setups_['setup_i2c_slave'] = 'Wire.setClock(400000);'; + generator.setups_['setup_i2c_onRequest'] = 'Wire.onRequest(i2cRequestEvent);'; + var funcName = 'i2cRequestEvent'; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return ''; +} + +export const i2c_master_reader = function (_, generator) { + generator.definitions_['include_Wire'] = '#include \n'; + var device = generator.valueToCode(this, 'device', generator.ORDER_ATOMIC) || '0'; + var bytes = generator.valueToCode(this, 'bytes', generator.ORDER_ATOMIC) || '0'; + var code = "Wire.requestFrom(" + device + ", " + bytes + ");\n"; + return code; +}; + +export const spi_begin_master = function (_, generator) { + var value_spi_slave_pin = generator.valueToCode(this, 'spi_slave_pin', generator.ORDER_ATOMIC); + generator.definitions_['include_SPI'] = '#include '; + generator.setups_['setup_spi'] = 'SPI.begin();'; + generator.setups_['setup_spi_divider'] = 'SPI.setClockDivider(SPI_CLOCK_DIV8);'; + generator.setups_['setup_spi_pin_' + value_spi_slave_pin] = 'digitalWrite(' + value_spi_slave_pin + ', HIGH);'; + var code = ''; + return code; +}; + +export const spi_transfer_Init = function (_, generator) { + var value_slave_pin = generator.valueToCode(this, 'slave_pin', generator.ORDER_ATOMIC); + var statements_transfer_data = generator.statementToCode(this, 'transfer_data'); + var code = 'digitalWrite(' + value_slave_pin + ', LOW);\n' + + statements_transfer_data + + 'digitalWrite(' + value_slave_pin + ', HIGH);\n'; + return code; +}; + +export const spi_transfer_1 = function (_, generator) { + var value_transfer_data = generator.valueToCode(this, 'transfer_data', generator.ORDER_ATOMIC); + var code = 'SPI.transfer(' + value_transfer_data + ');\n'; + return code; +}; + +export const spi_transfer_2 = function (_, generator) { + var value_transfer_data = generator.valueToCode(this, 'transfer_data', generator.ORDER_ATOMIC); + var code = 'SPI.transfer(' + value_transfer_data + ')'; + return [code, generator.ORDER_ATOMIC]; +}; + +export const spi_slave_interrupt = function (_, generator) { + var statements_slave_interrupt_data = generator.statementToCode(this, 'slave_interrupt_data'); + generator.definitions_['function_ISR'] = 'ISR(SPI_STC_vect)' + + '\n{' + + '\n' + statements_slave_interrupt_data + + '\n}\n' + generator.setups_['setup_spi_interrupt'] = 'SPI.attachInterrupt();'; + var code = ''; + return code; +}; + +export const spi_slave_receive = function (_, generator) { + generator.definitions_['function_SPI_SlaveReceive'] = 'char SPI_SlaveReceive()' + + '\n{' + + '\n while(!(SPSR&(1<= ' : ' <= ') + argument1 + '; ' + + variable0 + ' = ' + variable0 + ' + (' + step + ')) {\n' + + branch + '}\n'; + } else { + //起止数有变量 + if (step.match(/^-?\d+(\.\d+)?$/)) { + //步长是常量 + down = step < 0; + code = 'for (int ' + variable0 + ' = (' + argument0 + '); ' + + variable0 + (down ? ' >= ' : ' <= ') + '(' + argument1 + '); ' + + variable0 + ' = ' + variable0 + ' + (' + step + ')) {\n' + + branch + '}\n'; + } else { + //步长是变量 + code = 'for (int ' + variable0 + ' = (' + argument0 + '); ' + + '(' + argument1 + '>=' + argument0 + ')?(' + variable0 + '<=' + argument1 + '):(' + variable0 + '>=' + argument1 + '); ' + + variable0 + ' = ' + variable0 + ' + (' + step + ')) {\n' + + branch + '}\n'; + } + + } + return code; +}; + +export const controls_whileUntil = function (_, generator) { + // Do while/until loop. + var argument0 = generator.valueToCode(this, 'BOOL', + generator.ORDER_NONE) || 'false'; + var branch = generator.statementToCode(this, 'DO'); + if (generator.INFINITE_LOOP_TRAP) { + branch = generator.INFINITE_LOOP_TRAP.replace(/%1/g, + '\'' + this.id + '\'') + branch; + } + if (this.getFieldValue('MODE') == 'UNTIL') { + if (!argument0.match(/^\w+$/)) { + argument0 = '(' + argument0 + ')'; + } + argument0 = '!' + argument0; + } + return 'while (' + argument0 + ') {\n' + branch + '}\n'; +}; + +export const controls_flow_statements = function () { + // Flow statements: continue, break. + switch (this.getFieldValue('FLOW')) { + case 'BREAK': + return 'break;\n'; + case 'CONTINUE': + return 'continue;\n'; + } + throw 'Unknown flow statement.'; +}; + +export const controls_delay = function (_, generator) { + var delay_time = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ATOMIC) || '1000' + var unit = this.getFieldValue('UNIT'); + var code = unit + '(' + delay_time + ');\n'; + return code; +}; + +export const controls_millis = function (_, generator) { + var unit = this.getFieldValue('UNIT'); + var code = unit + "()"; + return [code, generator.ORDER_ATOMIC]; +}; + +export const controls_mstimer2 = function (_, generator) { + generator.definitions_['include_MsTimer2'] = '#include '; + var time = generator.valueToCode(this, 'TIME', generator.ORDER_ATOMIC); + var funcName = 'msTimer2_func'; + var branch = generator.statementToCode(this, 'DO'); + var code = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code; + return 'MsTimer2::set(' + time + ', ' + funcName + ');\n'; +}; + +export const controls_mstimer2_start = function (_, generator) { + generator.definitions_['include_MsTimer2'] = '#include '; + return 'MsTimer2::start();\n'; +}; + +export const controls_mstimer2_stop = function (_, generator) { + generator.definitions_['include_MsTimer2'] = '#include '; + return 'MsTimer2::stop();\n'; +}; + +export const controls_end_program = function () { + var board_type = JSFuncs.getPlatform(); + if (board_type.match(RegExp(/ESP8266/))) + return 'while(true) delay(1000);\n'; + return 'while(true);\n'; +}; + +export const controls_soft_reset = function (_, generator) { + var funcName = 'resetFunc'; + var code = 'void(* resetFunc) (void) = 0;\n'; + generator.definitions_[funcName] = code; + return 'resetFunc();\n'; +}; + +export const controls_interrupts = function () { + return 'interrupts();\n'; +}; + +export const controls_nointerrupts = function () { + return 'noInterrupts();\n'; +}; + +export const base_delay = controls_delay; + +// 简单定时器 +export const simple_timer = function (_, generator) { + var NO = this.getFieldValue('NO'); + var timein = generator.valueToCode(this, 'timein', generator.ORDER_ATOMIC); + var funcName = 'Simple_timer_' + NO; + var branch = generator.statementToCode(this, 'zxhs'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var code = 'void' + ' ' + funcName + '() {\n ' + branch + '\n}\n'; + generator.definitions_[funcName] = code; + generator.definitions_['include_SimpleTimer'] = '#include \n'; + generator.definitions_['var_declare_SimpleTimer'] = 'SimpleTimer timer;'; + generator.setups_[funcName] = 'timer.setInterval(' + timein + 'L, ' + funcName + ');\n'; + return 'timer.run();\n'; +}; + +// do-while循环 +export const do_while = function (_, generator) { + var statements_input_data = generator.statementToCode(this, 'input_data'); + var value_select_data = generator.valueToCode(this, 'select_data', generator.ORDER_ATOMIC); + var dropdown_type = this.getFieldValue('type'); + if (dropdown_type == 'false') { + var code = 'do{\n' + + statements_input_data + + '}while(!(' + value_select_data + '));\n'; + } + else { + var code = 'do{\n' + + statements_input_data + + '}while(' + value_select_data + ');\n'; + } + return code; +}; + +// 注册超级延时函数 +export const super_delay_function1 = function (_, generator) { + var number = this.getFieldValue('number'); + var funcName = 'super_delay_function' + number; + var branch = generator.statementToCode(this, 'delay_function'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var code = 'void' + ' ' + funcName + '() {\n ' + branch + '\n}\n'; + generator.definitions_[funcName] = code; + generator.definitions_['include_SimpleTimer'] = '#include \n'; + generator.definitions_['var_declare_SimpleTimer'] = 'SimpleTimer timer;'; + return 'timer.run();\n'; +}; + +// 执行超级延时函数 +export const execute_super_delay_function1 = function (_, generator) { + var number = this.getFieldValue('number'); + var time_interval = generator.valueToCode(this, 'time_interval', generator.ORDER_ATOMIC); + var frequency = generator.valueToCode(this, 'frequency', generator.ORDER_ATOMIC); + var code = 'timer.setTimer(' + time_interval + ', super_delay_function' + number + ', ' + frequency + ');\n'; + return code; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/display.js b/mixly/boards/default_src/arduino_avr/generators/display.js new file mode 100644 index 00000000..f948bd08 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/display.js @@ -0,0 +1,1369 @@ +import { Profile, JSFuncs } from 'mixly'; +import { Variables } from 'blockly/core'; + +export const group_lcd_init2 = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var TYPE = this.getFieldValue('TYPE'); + var SCL = this.getFieldValue('SCL'); + var SDA = this.getFieldValue('SDA'); + var board_type = JSFuncs.getPlatform(); + var device = generator.valueToCode(this, 'device', generator.ORDER_ATOMIC) || '0x27'; + if (SDA == Profile.default.SDA[0][1] && SCL == Profile.default.SCL[0][1]) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_LiquidCrystal_I2C'] = '#include '; + generator.definitions_['var_declare_LiquidCrystal_I2C_' + varName] = 'LiquidCrystal_I2C ' + varName + '(' + device + ',' + TYPE + ');'; + } + else { + if (board_type.match(RegExp(/AVR/))) { + generator.definitions_['include_SoftI2CMaster'] = '#include '; + generator.definitions_['include_LiquidCrystal_SoftI2C'] = '#include '; + generator.definitions_['var_declare_LiquidCrystal_SoftI2C_' + varName] = 'LiquidCrystal_SoftI2C ' + varName + '(' + device + ',' + TYPE + ',' + SCL + ',' + SDA + ');'; + } + else { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_LiquidCrystal_SoftI2C'] = '#include '; + generator.definitions_['var_declare_LiquidCrystal_I2C_' + varName] = 'LiquidCrystal_I2C ' + varName + '(' + device + ',' + TYPE + ');'; + generator.setups_["setup_Wire"] = 'Wire.begin(' + SDA + ',' + SCL + ');'; + } + } + generator.setups_['setup_lcd_init_' + varName] = varName + '.init();'; + generator.setups_['setup_lcd_backlight_' + varName] = varName + '.backlight();'; + return ''; +}; + +export const group_lcd_init3 = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var TYPE = this.getFieldValue('TYPE'); + var RS = this.getFieldValue('RS'); + var EN = this.getFieldValue('EN'); + var D4 = this.getFieldValue('D4'); + var D5 = this.getFieldValue('D5'); + var D6 = this.getFieldValue('D6'); + var D7 = this.getFieldValue('D7'); + generator.definitions_['include_LiquidCrystal'] = '#include '; + generator.definitions_['var_declare_LiquidCrystal' + varName] = 'LiquidCrystal ' + varName + '(' + RS + ',' + EN + ',' + D4 + ',' + D5 + ',' + D6 + ',' + D7 + ');'; + generator.setups_['setup_lcd_begin_' + varName] = varName + '.begin(' + TYPE + ');'; + + return ''; +}; + +export const group_lcd_print = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var str1 = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || '""'; + var str2 = generator.valueToCode(this, 'TEXT2', generator.ORDER_ATOMIC) || '""'; + + var code = varName + '.setCursor(0, 0);\n' + code += varName + '.print(' + str1 + ');\n'; + code += varName + '.setCursor(0, 1);\n'; + code += varName + '.print(' + str2 + ');\n'; + //code+=varName+'.setCursor(0, 2);\n'; + //code+=varName+'.print('+str3+');\n'; + //code+=varName+'.setCursor(0, 3);\n'; + //code+=varName+'.print('+str4+');\n'; + return code; +}; + +export const group_lcd_print2 = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var str = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || 'String("")'; + var row = generator.valueToCode(this, 'row', generator.ORDER_ATOMIC) || '1'; + var column = generator.valueToCode(this, 'column', generator.ORDER_ATOMIC) || '1'; + var code = varName + '.setCursor(' + column + '-1, ' + row + '-1);\n' + code += varName + '.print(' + str + ');\n'; + return code; +}; + +export const group_lcd_power = function () { + var varName = this.getFieldValue('VAR'); + var dropdown_stat = this.getFieldValue('STAT'); + var code = varName + '.' + dropdown_stat + '();\n' + return code; +}; + +export const display_4digitdisplay_power = function (_, generator) { + var stat = this.getFieldValue("STAT"); + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_TM1650'] = '#include '; + generator.definitions_['var_declare_display_4display'] = 'TM1650 tm_4display;'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + generator.setups_['setup_display_4display_init'] = 'tm_4display.init();'; + return 'tm_4display.' + stat + '();\n'; +} + +export const display_4digitdisplay_displayString = function (_, generator) { + var value = generator.valueToCode(this, 'VALUE', generator.ORDER_ATOMIC); + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_TM1650'] = '#include '; + generator.definitions_['var_declare_display_4display'] = 'TM1650 tm_4display;'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + generator.setups_['setup_display_4display_init'] = 'tm_4display.init();'; + return 'tm_4display.displayString(' + value + ');\n'; +} + +export const display_4digitdisplay_showDot = function (_, generator) { + var no = this.getFieldValue("NO"); + var stat = this.getFieldValue("STAT"); + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_TM1650'] = '#include '; + generator.definitions_['var_declare_display_4display'] = 'TM1650 tm_4display;'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + generator.setups_['setup_display_4display_init'] = 'tm_4display.init();'; + return 'tm_4display.setDot(' + no + ',' + stat + ');\n'; +} + +var tm1637_DIO; +var tm1637_CLK; + +export const display_TM1637_init = function (_, generator) { + tm1637_CLK = this.getFieldValue('CLK'); + tm1637_DIO = this.getFieldValue('DIO'); + var NAME = this.getFieldValue('NAME') || 'display'; + generator.definitions_['include_SevenSegmentTM1637'] = '#include '; + generator.definitions_['var_declare_SevenSegmentTM1637' + NAME] = 'SevenSegmentTM1637 ' + NAME + '(' + tm1637_CLK + ',' + tm1637_DIO + ');'; + generator.setups_['setup_' + NAME + '.begin()'] = NAME + '.begin();'; + return ''; +}; + +export const display_TM1637_displyPrint = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + //var Speed = generator.valueToCode(this, 'Speed', generator.ORDER_ATOMIC); + var VALUE = generator.valueToCode(this, 'VALUE', generator.ORDER_ATOMIC); + var code = NAME + '.print(' + VALUE + ');' + '\n'; + return code; +}; + +export const display_TM1637_displayTime = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + generator.definitions_['include_SevenSegmentExtended'] = '#include '; + generator.definitions_['var_declare_SevenSegmentTM1637' + NAME] = 'SevenSegmentExtended ' + NAME + '(' + tm1637_CLK + ',' + tm1637_DIO + ');'; + var hour = generator.valueToCode(this, 'hour', generator.ORDER_ATOMIC); + var minute = generator.valueToCode(this, 'minute', generator.ORDER_ATOMIC); + var dropdown_stat = this.getFieldValue("STAT"); + var code = NAME + '.printTime(' + hour + ',' + minute + ',' + dropdown_stat + ');\n'; + return code; +}; + +export const display_TM1637_clearDisplay = function () { + var stat = this.getFieldValue("STAT"); + var NAME = this.getFieldValue('NAME') || 'display'; + return NAME + '.' + stat + '();\n'; +}; + +export const display_TM1637_Brightness = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + var BRIGHTNESS = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + var code = NAME + '.setBacklight(' + BRIGHTNESS + ');\n'; + return code; +}; + +// HT16K33点阵初始化 +export const HT16K33_Init = function (_, generator) { + var SDA = this.getFieldValue('SDA'); + var SCL = this.getFieldValue('SCL'); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + generator.definitions_['include_Matrix'] = '#include '; + generator.definitions_['var_declare' + matrixName] = 'Matrix ' + matrixName + '(' + SDA + ',' + SCL + ');'; + generator.setups_['setup_' + matrixName] = matrixName + '.begin(0x70);'; + var code = matrixName + '.clear();\n'; + return code; +}; + +// Max7219点阵初始化 +export const MAX7219_init = function (_, generator) { + var pin_cs = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var hDisplays = generator.valueToCode(this, 'hDisplays', generator.ORDER_ATOMIC); + var vDisplays = generator.valueToCode(this, 'vDisplays', generator.ORDER_ATOMIC); + generator.definitions_['include_SPI'] = '#include '; + generator.definitions_['include_Adafruit_GFX'] = '#include '; + generator.definitions_['include_Max72xxPanel'] = '#include '; + generator.definitions_['var_declare_Max72xxPanel'] = 'Max72xxPanel ' + matrixName + ' = Max72xxPanel(' + pin_cs + ',' + hDisplays + ',' + vDisplays + ');'; + var code = ''; + return code; +}; + +// 点阵屏画点 +export const display_Matrix_DrawPixel = function (_, generator) { + var matrixType = this.getFieldValue('TYPE'); + var write = this.getFieldValue('WRITE'); + var pos_x = generator.valueToCode(this, 'XVALUE', generator.ORDER_ASSIGNMENT); + var pos_y = generator.valueToCode(this, 'YVALUE', generator.ORDER_ASSIGNMENT); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var dropdown_type = generator.valueToCode(this, 'STAT', generator.ORDER_ATOMIC); + if (matrixType == "HT16K33") { + var code = matrixName + '.drawPixel(' + pos_x + ',7-' + pos_y + ',' + dropdown_type + ');\n' + } + else { + var code = matrixName + '.drawPixel(' + pos_x + ',' + pos_y + ',' + dropdown_type + ');\n' + } + if (write !== 'OFF') { + code += matrixName + '.write();\n'; + } + return code; +}; + +// 点阵屏滚动显示文本 +export const display_Matrix_TEXT = function (_, generator) { + var matrixName = "myMatrix"; + var textString = generator.valueToCode(this, 'TEXT', generator.ORDER_ASSIGNMENT); + var speed = generator.valueToCode(this, 'Speed', generator.ORDER_ATOMIC); + var code = matrixName + '.scrollMessage(' + textString + ',' + speed + ');\n' + return code; +}; + +// 点阵屏显示文本 +export const display_Matrix_print = function (_, generator) { + var matrixName = "myMatrix"; + var write = this.getFieldValue('WRITE'); + var textString = generator.valueToCode(this, 'TEXT', generator.ORDER_ASSIGNMENT); + var code = matrixName + '.setCursor(0, 0);\n'; + code += matrixName + '.print(' + textString + ');\n'; + if (write !== 'OFF') { + code += matrixName + '.write();\n'; + } + return code; +}; + +// 点阵屏显示_显示图案 +export const display_Matrix_DisplayChar = function (_, generator) { + var matrixType = this.getFieldValue('TYPE'); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var write = this.getFieldValue('WRITE'); + var NO = generator.valueToCode(this, 'NO', generator.ORDER_ATOMIC); + var dotMatrixArray = generator.valueToCode(this, 'LEDArray', generator.ORDER_ASSIGNMENT); + generator.definitions_['var_declare_LEDArray'] = 'uint8_t LEDArray[8];'; + var code = ''; + code += 'memcpy_P(&LEDArray, &' + dotMatrixArray + ', 8);\n'; + code += 'for(int index_i=0; index_i<8; index_i++)\n'; + code += '{\n' + //code+=' LEDArray[index_i]='+dotMatrixArray+'[index_i];\n'; + code += ' for(int index_j=' + (NO) + '*8; index_j<' + (NO) + '*8+8; index_j++)\n' + //code+=' for(int index_j=7; index_j>=0; index_j--)\n' + code += ' {\n' + code += ' if((LEDArray[index_i]&0x01)>0)\n'; + if (matrixType == "HT16K33") { + code += ' ' + matrixName + '.drawPixel(index_j, index_i,1);\n'; + code += ' else\n ' + matrixName + '.drawPixel(index_j, index_i,0);\n'; + } + else { + code += ' ' + matrixName + '.drawPixel(index_j, 7-index_i,1);\n'; + code += ' else\n ' + matrixName + '.drawPixel(index_j, 7-index_i,0);\n'; + } + code += ' LEDArray[index_i] = LEDArray[index_i]>>1;\n'; + code += ' } \n'; + code += '}\n'; + if (write !== 'OFF') { + code += matrixName + '.write();\n'; + } + return code; +}; + +// 点阵屏显示_点阵数组 +export const display_Matrix_LedArray = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var a = new Array(); + for (var i = 1; i < 9; i++) { + a[i] = new Array(); + for (var j = 1; j < 9; j++) { + a[i][9 - j] = (this.getFieldValue('a' + i + j) == "TRUE") ? 1 : 0; + } + } + var code = '{'; + for (var i = 1; i < 9; i++) { + var tmp = "" + for (var j = 1; j < 9; j++) { + tmp += a[i][j]; + } + tmp = (parseInt(tmp, 2)).toString(16) + if (tmp.length == 1) tmp = "0" + tmp; + code += '0x' + tmp + ((i != 8) ? ',' : ''); + } + code += '};'; + //generator.definitions_[varName] = "uint8_t " + varName + "[8]=" + code; + generator.definitions_[varName] = "const uint8_t " + varName + "[8] PROGMEM =" + code; + return [varName, generator.ORDER_ATOMIC]; +}; + +// 点阵位图数据 +export const display_matrix_bitmap = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var a = this.getFieldValue('BITMAP'); + var code = '{'; + for (var i = 7; i >= 0; i--) { + var tmp = ""; + for (var j = 7; j >= 0; j--) { + tmp += a[i][j]; + } + tmp = (parseInt(tmp, 2)).toString(16); + if (tmp.length == 1) tmp = "0" + tmp; + code += '0x' + tmp + ((i !== 0) ? ',' : ''); + } + code += '};'; + generator.definitions_[varName] = "const uint8_t " + varName + "[8] PROGMEM =" + code; + return [varName, generator.ORDER_ATOMIC]; +}; + +// 点阵设置亮度 +export const display_Matrix_Brightness = function (_, generator) { + var matrixType = this.getFieldValue('TYPE'); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var BRIGHTNESS = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + if (matrixType == "HT16K33") { + var code = matrixName + '.setBrightness(' + BRIGHTNESS + ');\n'; + } + else { + var code = matrixName + '.setIntensity(' + BRIGHTNESS + ');\n'; + } + return code; +}; + +// 点阵 全亮/全灭/关闭/开启 +export const display_Matrix_fillScreen = function () { + var write = this.getFieldValue('WRITE'); + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var FILLSCREEN_TYPE = this.getFieldValue('FILLSCREEN_TYPE'); + var code = matrixName + '.' + FILLSCREEN_TYPE + ';\n' + if (write !== 'OFF') { + code += matrixName + '.write();\n'; + } + return code; +}; + +// 点阵屏旋转 +export const display_Max7219_Rotation = function (_, generator) { + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var dropdown_type = this.getFieldValue('Rotation_TYPE'); + var NO = generator.valueToCode(this, 'NO', generator.ORDER_ATOMIC); + var code = matrixName + '.setRotation(' + NO + ',' + dropdown_type + ');\n' + return code; +}; + +// 点阵屏位置 +export const display_Max7219_setPosition = function (_, generator) { + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var NO = generator.valueToCode(this, 'NO', generator.ORDER_ATOMIC); + var X = generator.valueToCode(this, 'X', generator.ORDER_ATOMIC); + var Y = generator.valueToCode(this, 'Y', generator.ORDER_ATOMIC); + var code = matrixName + '.setPosition(' + NO + ',' + X + ',' + Y + ');\n' + return code; +}; + +// 点阵屏旋转 +export const display_HT16K33_Rotation = function () { + //var matrixName = this.getFieldValue('matrixName'); + var matrixName = "myMatrix"; + var dropdown_type = this.getFieldValue('Rotation_TYPE'); + var code = matrixName + '.setRotation(4-' + dropdown_type + ');\n' + return code; +}; + +// 点阵屏 图案数组 +export const LedArray = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var a = new Array(); + for (var i = 1; i < 9; i++) { + a[i] = new Array(); + for (var j = 1; j < 9; j++) { + a[i][j] = (this.getFieldValue('a' + i + j) == "TRUE") ? 1 : 0; + } + } + var code = '{'; + for (var i = 1; i < 9; i++) { + var tmp = "" + for (var j = 1; j < 9; j++) { + tmp += a[i][j]; + } + tmp = (parseInt(tmp, 2)).toString(16) + if (tmp.length == 1) tmp = "0" + tmp; + code += '0x' + tmp + ((i != 8) ? ',' : ''); + } + code += '};\n'; + generator.definitions_[varName] = "byte " + varName + "[]=" + code; + return [varName, generator.ORDER_ATOMIC]; +}; + +// 点阵屏预设图案 +export const Matrix_img = function (_, generator) { + var dropdown_img_ = this.getFieldValue('img_'); + var code = '"' + dropdown_img_ + '"'; + code = '{'; + for (var i = 0; i < 15; i += 2) { + code += '0x' + dropdown_img_.substr(i, 2) + ((i != 14) ? ',' : ''); + } + code += '};\n'; + generator.definitions_['matrix_img_' + dropdown_img_] = "const uint8_t " + 'matrix_img_' + dropdown_img_ + "[8] PROGMEM=" + code; + return ['matrix_img_' + dropdown_img_, generator.ORDER_ATOMIC]; +}; + +// 点阵屏 设置生效 +export const display_Matrix_write = function () { + return 'myMatrix.write();\n'; +}; + +export const oled_init = function (_, generator) { + var OLED_TYPE = this.getFieldValue('OLED_TYPE'); + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var ROTATION = this.getFieldValue('ROTATION'); + var SDA = this.getFieldValue('SDA'); + var SCL = this.getFieldValue('SCL'); + var ADDRESS = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0x3C'; + var board_type = JSFuncs.getPlatform(); + //var board_type ="ESP8266"; + generator.definitions_['include_U8g2lib'] = '#include '; + if (board_type.match(RegExp(/AVR/))) { + if (SDA == Profile.default.SDA[0][1] && SCL == Profile.default.SCL[0][1]) + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + OLED_TYPE + '_1_HW_I2C ' + NAME + '(' + ROTATION + ', U8X8_PIN_NONE);'; + else + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + OLED_TYPE + '_1_SW_I2C ' + NAME + '(' + ROTATION + ', ' + SCL + ', ' + SDA + ', U8X8_PIN_NONE);'; + } + else { + if (SDA == Profile.default.SDA[0][1] && SCL == Profile.default.SCL[0][1]) + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + OLED_TYPE + '_F_HW_I2C ' + NAME + '(' + ROTATION + ', U8X8_PIN_NONE);'; + else + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + OLED_TYPE + '_F_SW_I2C ' + NAME + '(' + ROTATION + ', ' + SCL + ', ' + SDA + ', U8X8_PIN_NONE);'; + } + generator.definitions_['include_Wire'] = '#include '; + generator.setups_["setup_u8g2" + NAME] = NAME + '.setI2CAddress(' + ADDRESS + '*2);\n' + + ' ' + NAME + '.begin();'; + var code = ''; + return code; +}; + +export const u8g2_spi_init = function (_, generator) { + var U8G2_TYPE_SPI = this.getFieldValue('U8G2_TYPE_SPI'); + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var ROTATION = this.getFieldValue('ROTATION'); + var CLK = this.getFieldValue('CLK'); + var MOSI = this.getFieldValue('MOSI'); + var CS = this.getFieldValue('CS'); + var DC = this.getFieldValue('DC'); + var RST = this.getFieldValue('RST'); + generator.definitions_['include_U8g2lib'] = '#include '; + generator.definitions_['include_SPI'] = '#include '; + generator.setups_["setup_u8g2" + NAME] = NAME + '.begin();'; + if (CLK == "SCK" && MOSI == "MOSI") + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + U8G2_TYPE_SPI + '_1_4W_HW_SPI ' + NAME + '(' + ROTATION + ', ' + CS + ', ' + DC + ', ' + RST + ');'; + else + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_' + U8G2_TYPE_SPI + '_1_4W_SW_SPI ' + NAME + '(' + ROTATION + ', ' + CLK + ',' + MOSI + ',' + CS + ', ' + DC + ', ' + RST + ');'; + var code = ''; + return code; +}; + +export const u8g2_LCD12864_spi_init = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var ROTATION = this.getFieldValue('ROTATION'); + var DC = this.getFieldValue('DC'); + //var RST = this.getFieldValue('RST'); + generator.definitions_['include_U8g2lib'] = '#include '; + generator.definitions_['include_SPI'] = '#include '; + generator.setups_["setup_u8g2" + NAME] = NAME + '.begin();'; + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_ST7920_128X64_1_HW_SPI ' + NAME + '(' + ROTATION + ', ' + DC + ', U8X8_PIN_NONE);'; + var code = ''; + return code; +}; + +export const u8g2_LCD12864_8080_init = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var ROTATION = this.getFieldValue('ROTATION'); + var DB0 = this.getFieldValue('DB0'); + var DB1 = this.getFieldValue('DB1'); + var DB2 = this.getFieldValue('DB2'); + var DB3 = this.getFieldValue('DB3'); + var DB4 = this.getFieldValue('DB4'); + var DB5 = this.getFieldValue('DB5'); + var DB6 = this.getFieldValue('DB6'); + var DB7 = this.getFieldValue('DB7'); + var ENABLE = this.getFieldValue('ENABLE'); + var DC = this.getFieldValue('DC'); + //var RST = this.getFieldValue('RST'); + generator.definitions_['include_U8g2lib'] = '#include '; + generator.setups_["setup_u8g2" + NAME] = NAME + '.begin();'; + generator.definitions_['var_declare_U8G2' + NAME] = 'U8G2_ST7920_128X64_1_8080 ' + NAME + '(' + ROTATION + ', ' + DB0 + ', ' + DB1 + ', ' + DB2 + ', ' + DB3 + ', ' + DB4 + ', ' + DB5 + ', ' + DB6 + ', ' + DB7 + ', ' + ENABLE + ', U8X8_PIN_NONE, ' + DC + ');'; + var code = ''; + return code; +}; + +export const oled_clear = function () { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var code = NAME + ".clearDisplay();\n"; + return code; +}; + +export const oled_face = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var POS_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var POS_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var FACE_IMAGE = this.getFieldValue('FACE_IMAGE'); + var pos = FACE_IMAGE.indexOf(','); + var varName = "FACE_" + FACE_IMAGE.substring(0, pos); + FACE_IMAGE = FACE_IMAGE.substring(pos + 1, FACE_IMAGE.length); + // YANG use PROGMEM to save the RAM space + //generator.definitions_['var_declare' + varName] = 'static unsigned char ' + varName + '[]={' + FACE_IMAGE + ' };\n'; + //var code="u8g2.drawXBM("+POS_x+","+POS_y+",89,64,"+varName+");\n"; + generator.libs_[varName] = 'const static unsigned char ' + varName + '[] PROGMEM ={' + FACE_IMAGE + ' };'; + var code = NAME + ".drawXBMP(" + POS_x + "," + POS_y + ",89,64," + varName + ");\n"; + return code; +}; + +export const oled_icons = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var POS_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var POS_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var ICON_SIZE = this.getFieldValue('ICON_SIZE'); + var ICON_IMAGE = this.getFieldValue('ICON_IMAGE'); + var code = NAME + ".setFontPosBottom();\n" + NAME + ".setFont(u8g2_font_open_iconic_all_" + ICON_SIZE + "x_t);\n" + + NAME + ".drawGlyph(" + POS_x + "," + POS_y + "+" + ICON_SIZE + "*8," + ICON_IMAGE + ");\n"; + return code; +}; + +export const oled_drawPixel = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var pos_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var pos_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + code = code + NAME + '.drawPixel(' + pos_x + ','; + code += pos_y + ');\n'; + return code; +}; + +export const oled_page = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var branch = generator.statementToCode(this, 'DO'); + //branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var code = ''; + if (branch) { + code = NAME + ".firstPage();" + + "\ndo" + + "\n{" + + "\n" + branch + + "}while(" + NAME + ".nextPage());\n"; + } + return code; +}; + +export const oled_showBitmap = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var width = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var data_name = generator.valueToCode(this, 'bitmap_name', generator.ORDER_ATOMIC); + data_name = data_name.replace(/"/g, ""); + var code = ""; + //YANG use PROGMEM to save the RAM space + //code = 'u8g2.drawXBM(' + start_x + ', '; + code = NAME + '.drawXBMP(' + start_x + ', '; + code += start_y + ', '; + code += width + ', '; + code += height + ', ' + data_name + ');\n'; + return code; +}; + +export const oled_define_bitmap_data = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var text = this.getFieldValue('TEXT'); + //YANG use PROGMEM to save the RAM space + //generator.definitions_['var_declare' + varName] = 'static unsigned char ' + varName + '[]={' + text + ' };\n'; + generator.libs_[varName] = 'const static unsigned char ' + varName + '[] PROGMEM ={' + text + ' };'; + return ''; +}; + +export const oled_drawLine = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var end_x = generator.valueToCode(this, 'END_X', generator.ORDER_ATOMIC) || '0'; + var end_y = generator.valueToCode(this, 'END_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + code = NAME + '.drawLine(' + start_x + ','; + code += start_y + ','; + code += end_x + ','; + code += end_y + ');\n'; + return code; +}; + +export const oled_draw_Str_Line = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var length = generator.valueToCode(this, 'LENGTH', generator.ORDER_ATOMIC) || '0'; + var TYPE = this.getFieldValue('TYPE'); + var code = ""; + code = NAME + ".draw" + TYPE + "Line(" + start_x + ','; + code += start_y + ','; + code += length + ');\n'; + return code; +}; + +export const oled_drawTriangle = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var D1_x = generator.valueToCode(this, 'D1_X', generator.ORDER_ATOMIC) || '0'; + var D1_y = generator.valueToCode(this, 'D1_Y', generator.ORDER_ATOMIC) || '0'; + var D2_x = generator.valueToCode(this, 'D2_X', generator.ORDER_ATOMIC) || '0'; + var D2_y = generator.valueToCode(this, 'D2_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + code = NAME + '.drawTriangle(' + D0_x + ','; + code += D0_y + ','; + code += D1_x + ','; + code += D1_y + ','; + code += D2_x + ','; + code += D2_y + ');\n'; + return code; +}; + +export const oled_drawFrame = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Width = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var Height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = ""; + code = NAME + '.' + type + '(' + D0_x + ','; + code += D0_y + ','; + code += Width + ','; + code += Height + ');\n'; + return code; +}; + +export const oled_drawRFrame = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Width = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var Height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var Rauius = generator.valueToCode(this, 'RADIUS', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = ""; + code = NAME + '.' + type + '(' + D0_x + ','; + code += D0_y + ','; + code += Width + ','; + code += Height + ','; + code += Rauius + ');\n'; + return code; +}; + +export const oled_drawCircle = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Rauius = generator.valueToCode(this, 'RADIUS', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var opt = this.getFieldValue('OPT'); + var code = ""; + code = NAME + '.' + type + '(' + D0_x + ','; + code += D0_y + ','; + code += Rauius + "," + opt + "); \n"; + return code; +}; + +export const oled_drawEllipse = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Rauius_X = generator.valueToCode(this, 'RADIUS_X', generator.ORDER_ATOMIC) || '0'; + var Rauius_Y = generator.valueToCode(this, 'RADIUS_Y', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var opt = this.getFieldValue('OPT'); + var code = ""; + code = NAME + '.' + type + '(' + D0_x + ','; + code += D0_y + ','; + code += Rauius_X + ","; + code += Rauius_Y + "," + opt + "); \n"; + return code; +}; + +export const oled_print = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var POS_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var POS_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var TEXT = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || '0'; + generator.setups_["setup_enableUTF8Print" + NAME] = NAME + '.enableUTF8Print();\n'; + var code = ""; + code = NAME + '.setCursor(' + POS_x + ','; + code += POS_y + "); \n"; + code += NAME + ".print(" + TEXT + "); \n"; + return code; +}; + +export const oled_set_EN_Font = function () { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var FONT_NAME = this.getFieldValue('FONT_NAME'); + var FONT_SIZE = this.getFieldValue('FONT_SIZE'); + var FONT_STYLE = this.getFieldValue('FONT_STYLE'); + var code = NAME + ".setFont(u8g2_font_" + FONT_NAME + FONT_STYLE + FONT_SIZE + "_tf);\n" + NAME + ".setFontPosTop();\n"; + return code; +}; + +export const oled_set_CN_Font = function () { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var FONT_NAME = this.getFieldValue('FONT_NAME'); + var FONT_SIZE = this.getFieldValue('FONT_SIZE'); + var code = NAME + ".setFont(u8g2_font_" + FONT_SIZE + FONT_NAME + ");\n" + NAME + ".setFontPosTop();\n"; + return code; +}; + +export const oled_set_ZH_TW_Font = function () { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + + var code = NAME + ".setFont(u8g2_font_unifont_t_chinese1);\n" + NAME + ".setFontPosTop();\n"; + return code; +}; + +// OLED背光亮度 +export const u8g2_setContrast = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var Contrast = generator.valueToCode(this, 'Contrast', generator.ORDER_ATOMIC); + var code = NAME + '.setContrast(' + Contrast + ');\n'; + return code; +}; + +// 返回UTF8字符串宽度 +export const get_utf8_width = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'u8g2'; + var str = generator.valueToCode(this, 'str', generator.ORDER_ATOMIC); + generator.definitions_['getutf8width' + NAME] = 'int ' + NAME + '_getUTF8Width(String str) {\n const char *string_variable = str.c_str();\n return ' + NAME + '.getUTF8Width(string_variable);\n}'; + var code = NAME + '_getUTF8Width(String(' + str + '))'; + return [code, generator.ORDER_ATOMIC]; +}; + +// LCD自定义图案显示 +export const lcd_display_pattern = function (_, generator) { + var name = this.getFieldValue('name'); + var number = this.getFieldValue('number'); + var row = generator.valueToCode(this, 'row', generator.ORDER_ATOMIC); + var column = generator.valueToCode(this, 'column', generator.ORDER_ATOMIC); + var pattern = generator.valueToCode(this, 'pattern', generator.ORDER_ATOMIC); + generator.setups_["setup_lcd_display_pattern" + number] = '' + name + '.createChar(' + number + ', ' + pattern + ');'; + var code = '' + name + '.setCursor(' + column + '-1, ' + row + '-1);\n' + name + '.write(' + number + ');\n'; + return code; +}; + +export const lcd_pattern = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var a = new Array(); + for (var i = 1; i < 9; i++) { + a[i] = new Array(); + for (var j = 1; j < 6; j++) { + a[i][6 - j] = (this.getFieldValue('a' + i + j) == "TRUE") ? 1 : 0; + } + } + var code = '{0B' + a[8][5] + '' + a[8][4] + '' + a[8][3] + '' + a[8][2] + '' + a[8][1] + ',0B' + a[7][5] + '' + a[7][4] + '' + a[7][3] + '' + a[7][2] + '' + a[7][1] + ',0B' + a[6][5] + '' + a[6][4] + '' + a[6][3] + '' + a[6][2] + '' + a[6][1] + ',0B' + a[5][5] + '' + a[5][4] + '' + a[5][3] + '' + a[5][2] + '' + a[5][1] + ',0B' + a[4][5] + '' + a[4][4] + '' + a[4][3] + '' + a[4][2] + '' + a[4][1] + ',0B' + a[3][5] + '' + a[3][4] + '' + a[3][3] + '' + a[3][2] + '' + a[3][1] + ',0B' + a[2][5] + '' + a[2][4] + '' + a[2][3] + '' + a[2][2] + '' + a[2][1] + ',0B' + a[1][5] + '' + a[1][4] + '' + a[1][3] + '' + a[1][2] + '' + a[1][1] + '};'; + generator.definitions_[varName] = "byte " + varName + "[]=" + code; + return [varName, generator.ORDER_ATOMIC]; +}; + +export const display_lcd_bitmap = function (_, generator) { + var varName = this.getFieldValue('VAR'); + var bitmap = this.getFieldValue('BITMAP'); + var code = '{'; + var i = 0; + for (; i < bitmap.length - 1; i++) { + code += '0B' + bitmap[i].join('') + ','; + } + code += '0B' + bitmap[i].join('') + '};'; + generator.definitions_[varName] = "byte " + varName + "[]=" + code; + return [varName, generator.ORDER_ATOMIC]; +}; + +function rgb565(colour) { + colour = colour.substr(1); + var R, G, B; + R = colour.substr(0, 2); + G = colour.substr(2, 2); + B = colour.substr(4, 2); + colour = R + G + B; + colour = "0x" + colour; + var RGB565_red = (colour & 0xf80000) >> 8; + var RGB565_green = (colour & 0xfc00) >> 5; + var RGB565_blue = (colour & 0xf8) >> 3; + var n565Color = RGB565_red + RGB565_green + RGB565_blue; + return n565Color; +} + +// 初始化TFT +export const TFT_init_with_pin = function (_, generator) { + const PIN_CS = this.getFieldValue('CS'); + const PIN_DC = this.getFieldValue('DC'); + const PIN_RST = this.getFieldValue('RST'); + const TYPE = this.getFieldValue('TYPE'); + let icType = TYPE.split('_')[0]; + let initParam = ''; + if (TYPE === 'ST7735_INITR_GREENTAB') { + initParam = 'INITR_GREENTAB'; + } else if (TYPE === 'ST7735_INITR_REDTAB') { + initParam = 'INITR_REDTAB'; + } else if (TYPE === 'ST7735_INITR_BLACKTAB') { + initParam = 'INITR_BLACKTAB'; + } else if (TYPE === 'ST7735_160×80') { + initParam = 'INITR_MINI160x80'; + } else if (TYPE === 'ST7735_160×128') { + initParam = '128, 160'; + } else if (TYPE === 'ST7789_240×135') { + initParam = '135, 240'; + } else if (TYPE === 'ST7789_240×240') { + initParam = '240, 240'; + } else if (TYPE === 'ST7789_320×240') { + initParam = '240, 320'; + } else if (TYPE === 'ST7796_480×320') { + initParam = ''; + } + generator.definitions_["include_Adafruit_GFX"] = '#include '; + generator.definitions_["include_Adafruit_tft"] = '#include '; + generator.definitions_["include_SPI"] = '#include '; + generator.definitions_['var_declare_Adafruit_tft'] = 'Adafruit_' + icType + ' tft = Adafruit_' + icType + '(' + PIN_CS + ', ' + PIN_DC + ', ' + PIN_RST + ');'; + generator.setups_["setup_tft_init"] = 'tft.' + (icType === 'ST7735' ? 'initR' : 'init') + '(' + initParam + ');'; + generator.setups_["setup_tft_fillScreen"] = 'tft.fillScreen(0x0000);'; + generator.definitions_["include_U8g2_for_Adafruit_GFX"] = '#include '; + generator.definitions_['var_declare_U8G2_FOR_ADAFRUIT_GFX'] = 'U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;'; + generator.setups_["setup_u8g2_for_adafruit_gfx"] = 'u8g2_for_adafruit_gfx.begin(tft);'; + var code = ''; + return code; +}; + +//将字符串转整数 +function myAtoi(str) { + str = str.replace(/(^\s*)|(\s*$)/g, "");//去掉字符串最前面的空格,中间的不用管 + var str1 = ""; + for (let i = 0; i < str.length; i++) { + if ((str.charAt(i) == "-" || str.charAt(i) == "+") && i == 0) { + str1 = str1.concat(str.charAt(i)) + }//如果“+”“-”号在最前面 + else if (/^\d+$/.test(str.charAt(i))) { + str1 = str1.concat(str.charAt(i)) + }//用字符串存储值 + else { + break//直接跳出for循环 + } + } + if (str1 - 0 > 2147483647) { + return 2147483647 + } //str-0 字符串化为数组最简单也是最常用的方法 + else if (str1 - 0 < -2147483648) { + return -2147483648 + } + if (isNaN(str1 - 0)) return 0//"+"/"-"这种情况,返回0 + return str1 - 0 +} + +//将一个数字转化成16进制字符串形式 +function toHex(num) { + return num < 16 ? "0x0" + num.toString(16).toUpperCase() : "0x" + num.toString(16).toUpperCase(); +} + +//将文本或符号编码 +function encodeUnicode(str) { + let res = []; + for (let i = 0; i < str.length; i++) { + res[i] = ("00" + str.charCodeAt(i).toString(16)).slice(-4); + } + return "_u" + res.join("_u"); +} + +var canvas = document.createElement("canvas");//创建canvas +var ctx = canvas.getContext("2d");//获得内容描述句柄 +var bitArr = new Array(); + +//显示汉字(使用位图显示) +export const TFT_st7735_show_hz = function (_, generator) { + var text_st7735_name = 'tft'; + var checkbox_st7735_show_hz = 'TRUE'; + var checkbox_st7735_show_hz_message = 'TRUE'; + var checkbox_st7735_show_hz_save = this.getFieldValue('st7735_show_hz_save') == 'TRUE'; + var dropdown_st7735_hz_sharp = this.getFieldValue('st7735_hz_sharp'); + var text_st7735_hz_line_height = this.getFieldValue('st7735_hz_line_height'); + var dropdown_hz_up_down = this.getFieldValue('hz_up_down'); + var text_hz_up_down_data = this.getFieldValue('hz_up_down_data'); + var dropdown_hz_left_right = this.getFieldValue('hz_left_right'); + var text_hz_left_right_data = this.getFieldValue('hz_left_right_data'); + var value_st7735_hz_data = generator.valueToCode(this, 'st7735_hz_data', generator.ORDER_ATOMIC); + var value_st7735_hz_x = generator.valueToCode(this, 'st7735_hz_x', generator.ORDER_ATOMIC); + var value_st7735_hz_y = generator.valueToCode(this, 'st7735_hz_y', generator.ORDER_ATOMIC); + var value_st7735_hz_height = generator.valueToCode(this, 'st7735_hz_height', generator.ORDER_ATOMIC); + var value_st7735_hz_width = generator.valueToCode(this, 'st7735_hz_width', generator.ORDER_ATOMIC); + var value_st7735_hz_color = generator.valueToCode(this, 'st7735_hz_color', generator.ORDER_ATOMIC); + var dropdown_st7735_hz_variant = 'normal'; + var dropdown_st7735_hz_style = 'normal'; + var dropdown_st7735_hz_thickness = 'normal'; + var fontSize_width = myAtoi(value_st7735_hz_width); + var fontSize_height = myAtoi(value_st7735_hz_height); + var bs = Math.ceil(fontSize_width / 8);//每行占字节数 + + var move_x = 0; + var move_y = 0; + if (dropdown_hz_up_down == "hz_down") { + move_y = myAtoi(text_hz_up_down_data); + } + else { + move_y = myAtoi("-" + text_hz_up_down_data); + } + + if (dropdown_hz_left_right == "hz_right") { + move_x = myAtoi(text_hz_left_right_data); + } + else { + move_x = myAtoi("-" + text_hz_left_right_data); + } + canvas.width = fontSize_width; + canvas.height = fontSize_height; + ctx.font = dropdown_st7735_hz_style + ' ' + dropdown_st7735_hz_variant + ' ' + dropdown_st7735_hz_thickness + ' ' + text_st7735_hz_line_height + 'px ' + dropdown_st7735_hz_sharp; + ctx.textAlign = "left"; + ctx.textBaseline = "top"; + + var c = value_st7735_hz_data; + ctx.fillStyle = "#000000"; + ctx.fillRect(0, 0, fontSize_width, fontSize_height);//涂背景 + ctx.fillStyle = "#ffffff"; + ctx.fillText(c, move_x, move_y);//写字 + var data = ctx.getImageData(0, 0, fontSize_width, fontSize_height).data;//获取图像 + var zm = new Array(bs * fontSize_height); + for (var i = 0; i < zm.length; i++)zm[i] = 0;//初始化字模数组 + for (var i = 0; i < fontSize_height; i++)//读像素值组成字模数组 + for (var j = 0; j < fontSize_width; j++) + if (data[i * fontSize_width * 4 + j * 4]) zm[parseInt(j / 8) + i * bs] += bitArr[j % 8]; + var outStr = "";//将字模数组转化为十六进制形式 + for (var i = 0; i < zm.length - 1; i++)outStr += toHex(zm[i]) + ","; + outStr += toHex(zm[i]); + + var zm1 = new Array(bs * fontSize_height); + var outstr1 = ""; + for (var i in zm) zm1[i] = zm[i].toString(2); + for (var i in zm1) { + var str = ""; + for (var j = 0; j < 8 - zm1[i].length; j++)str += "0"; + zm1[i] = str + zm1[i]; + } + for (var i in zm1) outstr1 += zm1[i]; + + var HZ_image = ""; + var num_hz = 0; + for (var i = 0; i < fontSize_width; i++) { + HZ_image += "--"; + if (i == (fontSize_width - 1)) HZ_image += "\n|"; + } + + for (var data_hz of outstr1) { + num_hz++; + if (num_hz == outstr1.length) { + HZ_image += "|\n"; + } + else if (num_hz % (bs * 8) < fontSize_width && num_hz % (bs * 8) > 0) { + if (data_hz == "0") HZ_image += " "; + else if (data_hz == "1") HZ_image += "0 "; + } + else if (num_hz % (bs * 8) == 0) { + HZ_image += "|\n|"; + } + } + for (var i = 0; i < fontSize_width; i++) { + HZ_image += "--"; + } + HZ_image = "/*" + "\n" + HZ_image + "\n" + "*/"; + + var hz_sharp = ""; + switch (dropdown_st7735_hz_sharp) { + case "STHeiti": + hz_sharp = "华文黑体"; + break; + case "STKaiti": + hz_sharp = "华文楷体"; + break; + case "STXihei": + hz_sharp = "华文细黑"; + break; + case "STSong": + hz_sharp = "华文宋体"; + break; + case "STZhongsong": + hz_sharp = "华文中宋"; + break; + case "STFangsong": + hz_sharp = "华文仿宋"; + break; + case "STCaiyun": + hz_sharp = "华文彩云"; + break; + case "STHupo": + hz_sharp = "华文琥珀"; + break; + case "STLiti": + hz_sharp = "华文隶书"; + break; + case "STXingkai": + hz_sharp = "华文行楷"; + break; + case "STXinwei": + hz_sharp = "华文新魏"; + break; + case "simHei": + hz_sharp = "黑体"; + break; + case "simSun": + hz_sharp = "宋体"; + break; + case "NSimSun": + hz_sharp = "新宋体"; + break; + case "FangSong": + hz_sharp = "仿宋"; + break; + case "KaiTi": + hz_sharp = "楷体"; + break; + case "FangSong_GB2312": + hz_sharp = "仿宋_GB2312"; + break; + case "KaiTi_GB2312": + hz_sharp = "楷体_GB2312"; + break; + case "LiSu": + hz_sharp = "隶书"; + break; + case "YouYuan": + hz_sharp = "幼圆"; + break; + case "PMingLiU": + hz_sharp = "新细明体"; + break; + case "MingLiU": + hz_sharp = "细明体"; + break; + case "DFKai-SB": + hz_sharp = "标楷体"; + break; + case "Microsoft JhengHei": + hz_sharp = "微软正黑体"; + break; + case "Microsoft YaHei": + hz_sharp = "微软雅黑体"; + break; + default: + hz_sharp = dropdown_st7735_hz_sharp; + break; + } + hz_sharp = "字体:" + hz_sharp + " 字号:" + text_st7735_hz_line_height + "px" + " 显示文字:" + value_st7735_hz_data; + + if (checkbox_st7735_show_hz) { + generator.definitions_['var_declare_oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = HZ_image + "\n//" + hz_sharp; + if (checkbox_st7735_show_hz_save) { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = HZ_image + "\n//" + hz_sharp + "\nstatic const unsigned char PROGMEM oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + else { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = HZ_image + "\n//" + hz_sharp + "\nunsigned char oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + } + else { + if (checkbox_st7735_show_hz_message) { + generator.definitions_['var_declare_oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = "//" + hz_sharp; + if (checkbox_st7735_show_hz_save) { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = "//" + hz_sharp + "\nstatic const unsigned char PROGMEM oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + else { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = "//" + hz_sharp + "\nunsigned char oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + } + else { + if (checkbox_st7735_show_hz_save) { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = "static const unsigned char PROGMEM oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + else { + generator.libs_['oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data)] = "unsigned char oled_st7735_" + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + "[" + (bs * fontSize_height) + "]={" + outStr + "};"; + } + } + } + if (checkbox_st7735_show_hz_message) { + var code = '//绘制位图 ' + hz_sharp + ' X坐标:' + value_st7735_hz_x + ' Y坐标:' + value_st7735_hz_y + ' 位图宽度:' + value_st7735_hz_width + ' 位图高度:' + value_st7735_hz_height + '\n' + text_st7735_name + '.drawBitmap(' + value_st7735_hz_x + ', ' + value_st7735_hz_y + ', oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + ', ' + value_st7735_hz_width + ', ' + value_st7735_hz_height + ', ' + value_st7735_hz_color + ');\n'; + } + else { + var code = text_st7735_name + '.drawBitmap(' + value_st7735_hz_x + ', ' + value_st7735_hz_y + ', oled_st7735_' + dropdown_st7735_hz_sharp + '_' + text_st7735_hz_line_height + 'px' + encodeUnicode(value_st7735_hz_data) + ', ' + value_st7735_hz_width + ', ' + value_st7735_hz_height + ', ' + value_st7735_hz_color + ');\n'; + } + return code; +}; + +export const TFT_Brightness = function (_, generator) { + var Brightness = generator.valueToCode(this, 'BRIGHTNESS', generator.ORDER_ASSIGNMENT); + //generator.setups_['ledcSetup_tft_brightness'] = 'ledcSetup(0,5000,8);\n'; + //generator.setups_['ledcAttachPin_tft_brightness'] = 'ledcAttachPin(26,0);\n '; + var code = 'dacWrite(26, ' + Brightness + '*4+30);\n'; + return code; +}; + +export const tft_icons = function (_, generator) { + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + var POS_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var POS_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var ICON_SIZE = this.getFieldValue('ICON_SIZE'); + var ICON_IMAGE = this.getFieldValue('ICON_IMAGE'); + var code = "u8g2_for_adafruit_gfx.setFont(u8g2_font_open_iconic_all_" + ICON_SIZE + "x_t);\n" + + "u8g2_for_adafruit_gfx.setForegroundColor(" + colour + ");\n" + + "u8g2_for_adafruit_gfx.setFontMode(1);\n" + + "u8g2_for_adafruit_gfx.drawGlyph(" + POS_x + "," + POS_y + "+" + ICON_SIZE + "*8," + ICON_IMAGE + ");\n"; + return code; +}; + +export const TFT_Rotation = function () { + var dropdown_type = this.getFieldValue('Rotation_TYPE'); + var code = 'tft.setRotation(' + dropdown_type + ');\n' + return code; +}; + +export const tft_setFont = function () { + var type = this.getFieldValue('TYPE'); + var code = "u8g2_for_adafruit_gfx.setFont(u8g2_font_" + type + ");\nu8g2_for_adafruit_gfx.setFontMode(1);\n"; + return code; +}; + +export const tft_print = function (_, generator) { + var POS_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var POS_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var TEXT = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || '0'; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + var code = `u8g2_for_adafruit_gfx.setCursor(${POS_x}, ${POS_y});\n`; + // code +='u8g2_for_adafruit_gfx.setFontMode(0);' + code += `u8g2_for_adafruit_gfx.setForegroundColor(${colour});\n`; + code += `u8g2_for_adafruit_gfx.print(${TEXT});\n`; + return code; +}; + +export const TFT_color_seclet = function (_, generator) { + var colour = this.getFieldValue('COLOR'); + colour = rgb565(colour); + return [colour, generator.ORDER_NONE]; +}; + +export const TFT_color_rgb = function (_, generator) { + var R = generator.valueToCode(this, 'R', generator.ORDER_ATOMIC); + var G = generator.valueToCode(this, 'G', generator.ORDER_ATOMIC); + var B = generator.valueToCode(this, 'B', generator.ORDER_ATOMIC); + var colour = R + "*256" + "+" + G + "*8" + "+" + B + "/8"; + return [colour, generator.ORDER_NONE]; +}; + +export const TFT_init = function (_, generator) { + generator.definitions_["include_Adafruit_GFX"] = '#include '; + generator.definitions_["include_Adafruit_ST7735"] = '#include '; + generator.definitions_["include_SPI"] = '#include '; + generator.definitions_['var_declare_Adafruit_ST7735'] = 'Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC,-1);'; + generator.setups_["setup_tft.initR"] = 'tft.initR(INITR_18GREENTAB);'; + generator.setups_["setup_tft.fillScreen(ST7735_BLACK)"] = 'tft.fillScreen(ST7735_BLACK);'; + generator.setups_['ledcSetup_tft_brightness'] = 'dacWrite(26, 255);'; + generator.definitions_["include_U8g2_for_Adafruit_GFX"] = '#include '; + generator.definitions_['var_declare_U8G2_FOR_ADAFRUIT_GFX'] = 'U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;'; + generator.setups_["setup_u8g2_for_adafruit_gfx"] = 'u8g2_for_adafruit_gfx.begin(tft);'; + return ''; +}; + +export const TFT_fillScreen = function (_, generator) { + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + var code = 'tft.fillScreen' + '(' + colour + ');\n'; + return code; +}; + +export const tft_drawPixel = function (_, generator) { + var pos_x = generator.valueToCode(this, 'POS_X', generator.ORDER_ATOMIC) || '0'; + var pos_y = generator.valueToCode(this, 'POS_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + var COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + COLOR = rgb565(COLOR); + code += 'tft.drawPixel(' + pos_x + ','; + code += pos_y; + code += ',' + COLOR + ');\n'; + return code; +}; + +export const tft_drawLine = function (_, generator) { + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var end_x = generator.valueToCode(this, 'END_X', generator.ORDER_ATOMIC) || '0'; + var end_y = generator.valueToCode(this, 'END_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = 'tft.drawLine(' + start_x + ','; + code += start_y + ','; + code += end_x + ','; + code += end_y; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_drawFastLine = function (_, generator) { + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var length = generator.valueToCode(this, 'LENGTH', generator.ORDER_ATOMIC) || '0'; + var TYPE = this.getFieldValue('TYPE'); + var code = ""; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = "tft.drawFast" + TYPE + "Line(" + start_x + ','; + code += start_y + ','; + code += length; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_Triangle = function (_, generator) { + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var D1_x = generator.valueToCode(this, 'D1_X', generator.ORDER_ATOMIC) || '0'; + var D1_y = generator.valueToCode(this, 'D1_Y', generator.ORDER_ATOMIC) || '0'; + var D2_x = generator.valueToCode(this, 'D2_X', generator.ORDER_ATOMIC) || '0'; + var D2_y = generator.valueToCode(this, 'D2_Y', generator.ORDER_ATOMIC) || '0'; + var code = ""; + var type = this.getFieldValue('TYPE'); + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = 'tft.' + type + 'Triangle(' + D0_x + ','; + code += D0_y + ','; + code += D1_x + ','; + code += D1_y + ','; + code += D2_x + ','; + code += D2_y; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_Rect = function (_, generator) { + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Width = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var Height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = ""; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = 'tft.' + type + 'Rect(' + D0_x + ','; + code += D0_y + ','; + code += Width + ','; + code += Height; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_RoundRect = function (_, generator) { + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Width = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var Height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var Rauius = generator.valueToCode(this, 'RADIUS', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = ""; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = 'tft.' + type + 'RoundRect(' + D0_x + ','; + code += D0_y + ','; + code += Width + ','; + code += Height + ','; + code += Rauius; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_Circle = function (_, generator) { + var D0_x = generator.valueToCode(this, 'D0_X', generator.ORDER_ATOMIC) || '0'; + var D0_y = generator.valueToCode(this, 'D0_Y', generator.ORDER_ATOMIC) || '0'; + var Rauius = generator.valueToCode(this, 'RADIUS', generator.ORDER_ATOMIC) || '0'; + var type = this.getFieldValue('TYPE'); + var code = ""; + var colour = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + + code = 'tft.' + type + 'Circle(' + D0_x + ','; + code += D0_y + ','; + code += Rauius; + code += ',' + colour + ');\n'; + return code; +}; + +export const tft_define_bitmap_data = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var text = this.getFieldValue('TEXT'); + generator.libs_[varName] = 'const uint16_t ' + varName + '[] PROGMEM = {\n' + text + '\n};\n'; + return ''; +}; + +export const tft_generate_bitmap_data = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var text = this.getFieldValue('TEXT'); + generator.libs_[varName] = 'const uint16_t ' + varName + '[] PROGMEM = {\n ' + text + '\n};\n'; + return ''; +}; + +export const tft_showBitmap = function (_, generator) { + var start_x = generator.valueToCode(this, 'START_X', generator.ORDER_ATOMIC) || '0'; + var start_y = generator.valueToCode(this, 'START_Y', generator.ORDER_ATOMIC) || '0'; + var Height = generator.valueToCode(this, 'HEIGHT', generator.ORDER_ATOMIC) || '0'; + var WIDTH = generator.valueToCode(this, 'WIDTH', generator.ORDER_ATOMIC) || '0'; + var data_name = generator.valueToCode(this, 'bitmap_name', generator.ORDER_ATOMIC); + data_name = data_name.replace(/"/g, ""); + var code = "tft.drawRGBBitmap(" + start_x + ", " + start_y + ", " + data_name + ", " + WIDTH + ", " + Height + ");"; + return code; +}; + +export const tft_set_EN_Font = function () { + var FONT_NAME = this.getFieldValue('FONT_NAME'); + var FONT_SIZE = this.getFieldValue('FONT_SIZE'); + var FONT_STYLE = this.getFieldValue('FONT_STYLE'); + var code = "u8g2_for_adafruit_gfx.setFont(u8g2_font_" + FONT_NAME + FONT_STYLE + FONT_SIZE + "_tf);\n"; + return code; +}; + +export const tft_set_CN_Font = function () { + var FONT_NAME = this.getFieldValue('FONT_NAME'); + var FONT_SIZE = this.getFieldValue('FONT_SIZE'); + var code = "u8g2_for_adafruit_gfx.setFont(u8g2_font_" + FONT_SIZE + FONT_NAME + ");\n"; + return code; +}; + +export const display_TM1637_init_32 = function (_, generator) { + tm1637_CLK = this.getFieldValue('CLK'); + tm1637_DIO = this.getFieldValue('DIO'); + var NAME = this.getFieldValue('NAME') || 'display'; + generator.definitions_['include_TM1637Display'] = '#include '; + generator.definitions_['var_declare_SevenSegmentTM1637' + NAME] = 'TM1637Display ' + NAME + '(' + tm1637_CLK + ',' + tm1637_DIO + ');'; + generator.setups_['setup_' + NAME + '.begin()'] = NAME + '.setBrightness(7);'; + return ''; +}; + +export const display_TM1637_displyPrint_32 = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + //var Speed = generator.valueToCode(this, 'Speed', generator.ORDER_ATOMIC); + var VALUE = generator.valueToCode(this, 'VALUE', generator.ORDER_ATOMIC); + var code = NAME + '.showNumberDec(String(' + VALUE + ').toInt(), false);' + '\n'; + return code; +}; + +export const display_TM1637_displayTime_32 = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + var hour = generator.valueToCode(this, 'hour', generator.ORDER_ATOMIC); + var minute = generator.valueToCode(this, 'minute', generator.ORDER_ATOMIC); + var dropdown_stat = this.getFieldValue("STAT"); + var code = NAME + '.showNumberDecEx(((' + hour + ' * 100)+' + minute + '),' + dropdown_stat + ',1);\n'; + return code; +}; + +export const display_TM1637_clearDisplay_32 = function () { + var stat = this.getFieldValue("STAT"); + var NAME = this.getFieldValue('NAME') || 'display'; + return NAME + '.' + stat + '();\n'; +}; + +export const display_TM1637_Brightness_32 = function (_, generator) { + var NAME = this.getFieldValue('NAME') || 'display'; + var BRIGHTNESS = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + var code = NAME + '.setBrightness(' + BRIGHTNESS + ');\n'; + return code; +}; + +export const group_lcd_init = group_lcd_init2; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/ethernet.js b/mixly/boards/default_src/arduino_avr/generators/ethernet.js new file mode 100644 index 00000000..ea9d494e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/ethernet.js @@ -0,0 +1,3166 @@ +import { JSFuncs } from 'mixly'; + +export const ethernet_init_begin = function (_, generator) { + var Ethernet = this.getFieldValue('Ethernet'); + generator.definitions_['include_spi'] = '#include '; + generator.definitions_['include_' + Ethernet] = '#include <' + Ethernet + '.h>'; + generator.definitions_['var_declare_EthernetClient'] = 'EthernetClient client;'; + var mac = generator.valueToCode(this, 'MAC', generator.ORDER_ATOMIC); + var code = "Ethernet.begin(" + mac + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_mac_address = function (_, generator) { + var VAR1 = this.getFieldValue('VAR1'); + var VAR2 = this.getFieldValue('VAR2'); + var VAR3 = this.getFieldValue('VAR3'); + var VAR4 = this.getFieldValue('VAR4'); + var VAR5 = this.getFieldValue('VAR5'); + var VAR6 = this.getFieldValue('VAR6'); + generator.definitions_['var_declare_byte_mac'] = 'byte mac[] = {0x' + VAR1 + ', 0x' + VAR2 + ', 0x' + VAR3 + ', 0x' + VAR4 + ', 0x' + VAR5 + ', 0x' + VAR6 + '};'; + var code = "mac"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_init_local_ip = function (_, generator) { + var code = "Ethernet.localIP()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_client_connect_server = function (_, generator) { + var PORT = generator.valueToCode(this, 'PORT', generator.ORDER_ATOMIC); + var SERVER = generator.quote_(this.getFieldValue('SERVER')); + var code = 'client.connect(' + SERVER + ',' + PORT + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_client_stop = function () { + var code = "client.stop();\n"; + return code; +} + +export const ethernet_client_connected = function (_, generator) { + var code = "client.connected()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_client_available = function (_, generator) { + var code = "client.available()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_client_print = function (_, generator) { + var TEXT = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || '""'; + var code = 'client.print(' + TEXT + ');\n'; + return code; +} + +export const ethernet_client_println = function (_, generator) { + var TEXT = generator.valueToCode(this, 'TEXT', generator.ORDER_ATOMIC) || '""'; + var code = 'client.println(' + TEXT + ');\n'; + return code; +} + +export const ethernet_client_read = function (_, generator) { + var code = "(char)client.read()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const ethernet_client_get_request = function () { + var URL = this.getFieldValue('URL'); + var SERVER = this.getFieldValue('SERVER'); + var code = 'client.println("GET ' + URL + ' HTTP/1.1");\n' + + 'client.println(F("Host: ' + SERVER + '"));\n' + + 'client.println(F("Connection: close"));\n' + + 'client.println();\n'; + return code; +} + +export const WIFI_info = function (_, generator) { + var SSID = generator.valueToCode(this, 'SSID', generator.ORDER_ATOMIC); + var PWD = generator.valueToCode(this, 'PWD', generator.ORDER_ATOMIC); + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.setups_['setup_WiFi_begin'] = 'WiFi.begin(' + SSID + ', ' + PWD + ');\n' + + ' while (WiFi.status() != WL_CONNECTED) {\n' + + ' delay(500);\n' + + ' Serial.print(".");\n' + + ' }\n' + + ' Serial.println("Local IP:");\n' + + ' Serial.print(WiFi.localIP());\n' + return ""; +} + +export const network_wifi_connect = function (_, generator) { + return ["WiFi.status()", generator.ORDER_ATOMIC]; +} + +export const network_get_connect = function (_, generator) { + var board_type = JSFuncs.getPlatform(); + var mode = this.getFieldValue('mode'); + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + } + else if (board_type.match(RegExp(/ESP32/))) { + generator.definitions_['include_WiFi'] = '#include '; + } + if (mode == 'IP') { + return ["WiFi.localIP()", generator.ORDER_ATOMIC]; + } + return ["WiFi.macAddress()", generator.ORDER_ATOMIC]; +} + +export const NTP_server = function (_, generator) { + var server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + var timeZone = generator.valueToCode(this, 'timeZone', generator.ORDER_ATOMIC); + var Interval = generator.valueToCode(this, 'Interval', generator.ORDER_ATOMIC); + generator.definitions_['include_TimeLib'] = '#include '; + generator.definitions_['include_NtpClientLib'] = '#include '; + generator.definitions_['var_declare_timeZone'] = 'int8_t timeZone = ' + timeZone + ';'; + generator.definitions_['var_declare_ntpServer'] = 'const PROGMEM char *ntpServer = ' + server_add + ';'; + generator.setups_['setup_NTP.setInterval'] = 'NTP.setInterval (' + Interval + ');'; + generator.setups_['setup_NTP.setNTPTimeout'] = 'NTP.setNTPTimeout (1500);'; + generator.setups_['setup_NTP.begin'] = 'NTP.begin (ntpServer, timeZone, false);'; + return ""; +} + +export const NTP_server_get_time = function (_, generator) { + var timeType = this.getFieldValue('TIME_TYPE'); + var code = timeType; + return [code, generator.ORDER_ATOMIC]; +} + +var Client_ID; + +export const MQTT_server = function (_, generator) { + var server_add = generator.valueToCode(this, 'server_add', generator.ORDER_ATOMIC); + var server_port = generator.valueToCode(this, 'server_port', generator.ORDER_ATOMIC); + var IOT_ID = generator.valueToCode(this, 'IOT_ID', generator.ORDER_ATOMIC); + var IOT_PWD = generator.valueToCode(this, 'IOT_PWD', generator.ORDER_ATOMIC); + Client_ID = generator.valueToCode(this, 'Client_ID', generator.ORDER_ATOMIC); + if (Client_ID.length > 2) { + Client_ID += '/'; + } + Client_ID = Client_ID.replace(/"/g, ""); + generator.definitions_['include_Adafruit_MQTT'] = '#include "Adafruit_MQTT.h"'; + generator.definitions_['include_Adafruit_MQTT_Client'] = '#include "Adafruit_MQTT_Client.h"'; + generator.definitions_['include__WiFiClient'] = 'WiFiClient client;'; + generator.definitions_['var_declare_Adafruit_MQTT_Client'] = 'Adafruit_MQTT_Client mqtt(&client, ' + server_add + ', ' + server_port + ', ' + IOT_ID + ', ' + IOT_PWD + ');'; + var board_type = JSFuncs.getPlatform(); + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['var_declare_ MQTT_connect();'] = 'void MQTT_connect();'; + } + var funcName = 'MQTT_connect'; + var code = 'void' + ' ' + funcName + '() {\n' + + ' int8_t ret;\n' + + ' if (mqtt.connected()) {\n' + + ' return;\n' + + ' }\n' + + ' Serial.print("Connecting to MQTT... ");\n' + + ' uint8_t retries = 3;\n' + + ' while ((ret = mqtt.connect()) != 0) {\n' + + ' Serial.println(mqtt.connectErrorString(ret));\n' + + ' Serial.println("Retrying MQTT connection in 5 seconds...");\n' + + ' mqtt.disconnect();\n' + + ' delay(5000);\n' + + ' retries--;\n' + + ' if (retries == 0) {\n' + + ' while (1);\n' + + ' }\n' + + ' }\n' + + ' Serial.println("MQTT Connected!");\n' + + '}\n'; + generator.definitions_['var_declare_' + funcName] = code; + return funcName + '();\n'; +} + +export const MQTT_connect = function () { + var funcName = 'MQTT_connect'; + // var code = 'void' + ' ' + funcName + '() {\n' + // + ' int8_t ret;\n' + // + ' if (mqtt.connected()) {\n' + // + ' return;\n' + // + ' }\n' + // + ' Serial.print("Connecting to MQTT... ");\n' + // + ' uint8_t retries = 3;\n' + // + ' while ((ret = mqtt.connect()) != 0) {\n' + // + ' Serial.println(mqtt.connectErrorString(ret));\n' + // + ' Serial.println("Retrying MQTT connection in 5 seconds...");\n' + // + ' mqtt.disconnect();\n' + // + ' delay(5000);\n' + // + ' retries--;\n' + // + ' if (retries == 0) {\n' + // + ' while (1);\n' + // + ' }\n' + // + ' }\n' + // + ' Serial.println("MQTT Connected!");\n' + // + '}\n'; + return funcName + '();\n'; +} + +// 物联网-发送数据到app +export const MQTT_publish = function (_, generator) { + var Topic = this.getFieldValue('Topic'); + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var Topic_var = "MQTT_Topic_" + Topic; + generator.definitions_['var_declare_Adafruit_MQTT_Publish' + Topic_var] = 'Adafruit_MQTT_Publish ' + Topic_var + ' = Adafruit_MQTT_Publish(&mqtt, "' + Client_ID + Topic + '");'; + var code = Topic_var + '.publish(' + data + ');\n '; + return code; +} + +export const MQTT_subscribe_value = function (_, generator) { + var Topic = this.getFieldValue('Topic_0'); + if (Topic) + Topic = Topic.replace(/"/g, ""); + var Topic_var = "MQTT_Topic_" + Topic; + var code = '(char *)' + Topic_var + '.lastread'; + return [code, generator.ORDER_ATOMIC]; +} + +export const MQTT_subscribe = function (_, generator) { + var n = 0; + var Topic = this.getFieldValue('Topic_0'); + if (Topic) + Topic = Topic.replace(/"/g, ""); + var Topic_var = "MQTT_Topic_" + Topic; + var branch = generator.statementToCode(this, 'DO' + n); + var code = 'if (subscription ==&' + Topic_var + ') {\n ' + branch.replace(new RegExp(/\n/g), "\n ") + '\n }'; + generator.definitions_['var_declare_Adafruit_MQTT_Subscribe' + Client_ID + '/' + Topic] = 'Adafruit_MQTT_Subscribe ' + Topic_var + ' = Adafruit_MQTT_Subscribe(&mqtt,"' + Client_ID + Topic + '");'; + generator.setups_['setup_mqtt.subscribe' + Topic] = 'mqtt.subscribe(&' + Topic_var + ');'; + for (n = 1; n <= this.elseifCount_; n++) { + var Topic = this.getFieldValue('Topic_' + n); + if (Topic) + Topic = Topic.replace(/"/g, ""); + Topic_var = "MQTT_Topic_" + Topic; + branch = generator.statementToCode(this, 'DO' + n); + generator.definitions_['var_declare_Adafruit_MQTT_Subscribe' + Client_ID + Topic] = 'Adafruit_MQTT_Subscribe ' + Topic_var + ' = Adafruit_MQTT_Subscribe(&mqtt,"' + Client_ID + Topic + '");'; + generator.setups_['setup_mqtt.subscribe' + Topic] = 'mqtt.subscribe(&' + Topic_var + ');'; + code += ' else if (subscription == &' + Topic_var + ') {\n ' + branch.replace(new RegExp(/\n/g), "\n ") + '\n }'; + } + if (this.elseCount_) { + branch = generator.statementToCode(this, 'ELSE'); + code += ' else {\n ' + branch + '\n }'; + } + return 'Adafruit_MQTT_Subscribe *subscription;\nwhile ((subscription = mqtt.readSubscription(5000))) {\n ' + code + '\n}\n'; +} + +export const WIFI_smartConfig = function (_, generator) { + var MODE = this.getFieldValue('MODE'); + // var board_type = JSFuncs.getPlatform(); + if (MODE == 'SmartConfig') { + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_ESP8266WiFiMulti'] = '#include '; + generator.definitions_['var_declare_ESP8266WiFiMulti'] = ' ESP8266WiFiMulti wifiMulti;'; + generator.setups_['setup_WiFi_Smartconfig'] = 'Serial.println("Wait for Smartconfig");\n' + + 'wifiMulti.run();\n' + + 'WiFi.setAutoConnect(true);\n' + + 'if (WiFi.status() == WL_CONNECTED) {\n' + + 'Serial.println("WiFi connected");\n' + + 'Serial.println("IP address: ");\n' + + 'Serial.println(WiFi.localIP());\n' + + ' }\n' + + 'else{\n' + + ' WiFi.mode(WIFI_STA);\n' + + ' WiFi.beginSmartConfig();\n' + + ' while(!WiFi.smartConfigDone()){\n' + + 'Serial.print(".");\n' + + 'delay(500);\n' + + '}\n' + + 'Serial.println("SmartConfig Success");\n' + + 'Serial.printf("SSID:%s", WiFi.SSID().c_str());\n' + + 'Serial.printf("PSW:%s", WiFi.psk().c_str());\n' + + 'wifiMulti.addAP(WiFi.SSID().c_str(),WiFi.psk().c_str());\n' + + + '}\n' + return ""; + } + generator.definitions_['include_WiFiManager'] = '#include '; + generator.definitions_['var_declare_WiFiServer'] = 'WiFiServer server(80);'; + generator.setups_['setup_WiFi_mode'] = 'WiFi.mode(WIFI_STA);'; + generator.setups_['setup_WiFiManager'] = 'WiFiManager wm;'; + generator.setups_['setup_bool_res'] = 'bool res;'; + generator.setups_['setup_wifiManagerautoConnect'] = 'res=wm.autoConnect();'; + return ""; +} + +export const WIFI_ap_or_sta = function (_, generator) { + var dropdown_mode = this.getFieldValue('mode'); + var value_SSID = generator.valueToCode(this, 'SSID', generator.ORDER_ATOMIC); + var value_PSK = generator.valueToCode(this, 'PSK', generator.ORDER_ATOMIC); + var value_IP1 = generator.valueToCode(this, 'IP1', generator.ORDER_ATOMIC); + var value_IP2 = generator.valueToCode(this, 'IP2', generator.ORDER_ATOMIC); + var value_IP = generator.valueToCode(this, 'IP', generator.ORDER_ATOMIC); + var value_duankou = generator.valueToCode(this, 'duankou', generator.ORDER_ATOMIC); + value_IP1 = value_IP1.replace(new RegExp(/\./g), ","); + value_IP2 = value_IP2.replace(new RegExp(/\./g), ","); + value_IP = value_IP.replace(new RegExp(/\./g), ","); + var board_type = JSFuncs.getPlatform(); + if (board_type.match(RegExp(/ESP8266/)) != null) + generator.definitions_['include_ESP8266WiFi'] = '#include '; + else + generator.definitions_['include_WiFi'] = '#include '; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + if (dropdown_mode == 'STA') { + generator.definitions_['include_WiFiUdp'] = '#include '; + generator.definitions_['define_STASSID'] = '#define STASSID ' + value_SSID + ''; + generator.definitions_['define_STAPSK'] = '#define STAPSK ' + value_PSK + ''; + generator.definitions_['var_declare_ESP8266ip1'] = 'IPAddress ESP8266ip1(' + value_IP1 + ');'; + generator.definitions_['var_declare_ESP8266ip2'] = 'IPAddress ESP8266ip2(' + value_IP2 + ');'; + generator.definitions_['var_declare_ESP8266ip'] = 'IPAddress ESP8266ip(' + value_IP + ');'; + generator.definitions_['var_declare_localPort'] = 'unsigned int localPort = ' + value_duankou + ';'; + generator.definitions_['var_declare_remotePort'] = 'unsigned int remotePort = ' + value_duankou + ';'; + generator.definitions_['var_declare_incomingPacket'] = 'char incomingPacket[537];'; + generator.definitions_['var_declare_A'] = 'char A;'; + generator.definitions_['var_declare_Udp'] = 'WiFiUDP Udp;'; + generator.setups_['setup_wifi_sta'] = 'WiFi.mode(WIFI_STA);\n' + + ' WiFi.begin(STASSID, STAPSK);\n' + + ' while(WiFi.status() != WL_CONNECTED){\n' + + ' Serial.print(".");\n' + + ' delay(500);\n' + + ' }\n' + + ' delay(500);\n' + + ' Serial.print("Connected! IP address: ");\n' + + ' Serial.println(WiFi.localIP());\n' + + ' Serial.printf("UDP server on port ", localPort);\n' + + ' Udp.begin(localPort);'; + } + else { + generator.definitions_['include_WiFiUDP'] = '#include '; + generator.definitions_['var_declare_AP_NameChar'] = 'const char AP_NameChar[] = ' + value_SSID + ';'; + generator.definitions_['var_declare_WiFiAPPSK'] = 'const char WiFiAPPSK[] = ' + value_PSK + ';'; + generator.definitions_['var_declare_ESP8266ip1'] = 'IPAddress ESP8266ip1(' + value_IP1 + ');'; + generator.definitions_['var_declare_ESP8266ip2'] = 'IPAddress ESP8266ip2(' + value_IP2 + ');'; + generator.definitions_['var_declare_ESP8266ip'] = 'IPAddress ESP8266ip(' + value_IP + ');'; + generator.definitions_['var_declare_localPort'] = 'unsigned int localPort = ' + value_duankou + ';'; + generator.definitions_['var_declare_remotePort'] = 'unsigned int remotePort = ' + value_duankou + ';'; + generator.definitions_['var_declare_incomingPacket'] = 'char incomingPacket[537];'; + generator.definitions_['var_declare_A'] = 'char A;'; + generator.definitions_['var_declare_Udp'] = 'WiFiUDP Udp;'; + generator.setups_['setup_wifi_ap'] = 'WiFi.mode(WIFI_AP);\n' + + ' WiFi.softAP(AP_NameChar, WiFiAPPSK);\n' + + ' Udp.begin(localPort);\n' + + ' Serial.println();\n' + + ' Serial.println("Started ap. Local ip: " + WiFi.localIP().toString());'; + } + var code = ''; + return code; +} + +export const WIFI_ap_and_sta = function (_, generator) { + var value_SSID1 = generator.valueToCode(this, 'SSID1', generator.ORDER_ATOMIC); + var value_SSID2 = generator.valueToCode(this, 'SSID2', generator.ORDER_ATOMIC); + var value_PSK1 = generator.valueToCode(this, 'PSK1', generator.ORDER_ATOMIC); + var value_PSK2 = generator.valueToCode(this, 'PSK2', generator.ORDER_ATOMIC); + var value_IP1 = generator.valueToCode(this, 'IP1', generator.ORDER_ATOMIC); + var value_IP2 = generator.valueToCode(this, 'IP2', generator.ORDER_ATOMIC); + var value_IP = generator.valueToCode(this, 'IP', generator.ORDER_ATOMIC); + var value_duankou = generator.valueToCode(this, 'duankou', generator.ORDER_ATOMIC); + value_IP1 = value_IP1.replace(new RegExp(/\./g), ","); + value_IP2 = value_IP2.replace(new RegExp(/\./g), ","); + value_IP = value_IP.replace(new RegExp(/\./g), ","); + generator.definitions_['define_STASSID'] = '#define STASSID ' + value_SSID1; + generator.definitions_['define_STAPSK'] = '#define STAPSK ' + value_PSK1; + var board_type = JSFuncs.getPlatform(); + if (board_type.match(RegExp(/ESP8266/)) != null) + generator.definitions_['include_ESP8266WiFi'] = '#include '; + else + generator.definitions_['include_WiFi'] = '#include '; + generator.definitions_['include_WiFiUDP'] = '#include '; + generator.definitions_['var_declare_AP_NameChar'] = 'const char AP_NameChar[] = ' + value_SSID2 + ';'; + generator.definitions_['var_declare_WiFiAPPSK'] = 'const char WiFiAPPSK[] = ' + value_PSK2 + ';'; + generator.definitions_['var_declare_ESP8266ip1'] = 'IPAddress ESP8266ip1(' + value_IP1 + ');'; + generator.definitions_['var_declare_ESP8266ip2'] = 'IPAddress ESP8266ip2(' + value_IP2 + ');'; + generator.definitions_['var_declare_ESP8266ip'] = 'IPAddress ESP8266ip(' + value_IP + ');'; + generator.definitions_['var_declare_localPort'] = 'unsigned int localPort = ' + value_duankou + ';'; + generator.definitions_['var_declare_remotePort'] = 'unsigned int remotePort = ' + value_duankou + ';'; + generator.definitions_['var_declare_incomingPacket'] = 'char incomingPacket[537];'; + generator.definitions_['var_declare_A'] = 'char A;'; + generator.definitions_['var_declare_Udp'] = 'WiFiUDP Udp;'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_wifi_ap_and_sta'] = 'WiFi.mode(WIFI_AP_STA);\n' + + ' WiFi.softAP(AP_NameChar, WiFiAPPSK);\n' + + ' WiFi.begin(STASSID, STAPSK);\n' + + ' Udp.begin(localPort);\n' + + ' Serial.println();\n' + + ' Serial.println("Started ap. Local ip: " + WiFi.localIP().toString());'; + var code = ''; + return code; +} + +export const WIFI_incomingPacket = function (_, generator) { + var value_input_data = generator.valueToCode(this, 'input_data', generator.ORDER_ATOMIC) || 'COM'; + var statements_do = generator.statementToCode(this, 'do'); + statements_do = statements_do.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + var code = 'int packetSize = Udp.parsePacket();\n' + + 'if (packetSize) {\n' + + ' Serial.printf("Received %d bytes from %s, port %d\\n", packetSize, Udp.remoteIP().toString().c_str(), Udp.remotePort());\n' + + ' int len = Udp.read(incomingPacket, 536);\n' + + ' if (len > 0) {\n' + + ' incomingPacket[len] = 0;\n' + + ' Serial.printf("UDP packet contents: %s\\n", incomingPacket);\n' + + ' String ' + value_input_data + ' = incomingPacket;\n' + + (statements_do != '' ? (' ' + statements_do.replace(new RegExp(/\n/g), "\n ") + '\n') : '') + + ' }\n' + + '}\n'; + return code; +} + +export const WIFI_send_data = function (_, generator) { + var value_data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var code = 'Udp.beginPacket(Udp.remoteIP(),Udp.remotePort());\n' + + 'Udp.write(' + value_data + ');\n' + + 'Udp.endPacket();\n'; + return code; +} + +var WeatherCity = { + "北京": "101010100", + "海淀": "101010200", + "朝阳": "101010300", + "顺义": "101010400", + "怀柔": "101010500", + "通州": "101010600", + "昌平": "101010700", + "延庆": "101010800", + "丰台": "101010900", + "石景山": "101011000", + "大兴": "101011100", + "房山": "101011200", + "密云": "101011300", + "门头沟": "101011400", + "平谷": "101011500", + "八达岭": "101011600", + "佛爷顶": "101011700", + "汤河口": "101011800", + "密云上甸子": "101011900", + "斋堂": "101012000", + "霞云岭": "101012100", + "上海": "101020100", + "闵行": "101020200", + "宝山": "101020300", + "川沙": "101020400", + "嘉定": "101020500", + "南汇": "101020600", + "金山": "101020700", + "青浦": "101020800", + "松江": "101020900", + "奉贤": "101021000", + "崇明": "101021100", + "陈家镇": "101021101", + "引水船": "101021102", + "徐家汇": "101021200", + "浦东": "101021300", + "天津": "101030100", + "武清": "101030200", + "宝坻": "101030300", + "东丽": "101030400", + "西青": "101030500", + "北辰": "101030600", + "宁河": "101030700", + "汉沽": "101030800", + "静海": "101030900", + "津南": "101031000", + "塘沽": "101031100", + "大港": "101031200", + "平台": "101031300", + "蓟县": "101031400", + "重庆": "101040100", + "永川": "101040200", + "合川": "101040300", + "南川": "101040400", + "江津": "101040500", + "万盛": "101040600", + "渝北": "101040700", + "北碚": "101040800", + "巴南": "101040900", + "长寿": "101041000", + "黔江": "101041100", + "万州天城": "101041200", + "万州龙宝": "101041300", + "涪陵": "101041400", + "开县": "101041500", + "城口": "101041600", + "云阳": "101041700", + "巫溪": "101041800", + "奉节": "101041900", + "巫山": "101042000", + "潼南": "101042100", + "垫江": "101042200", + "梁平": "101042300", + "忠县": "101042400", + "石柱": "101042500", + "大足": "101042600", + "荣昌": "101042700", + "铜梁": "101042800", + "璧山": "101042900", + "丰都": "101043000", + "武隆": "101043100", + "彭水": "101043200", + "綦江": "101043300", + "酉阳": "101043400", + "金佛山": "101043500", + "秀山": "101043600", + "沙坪坝": "101043700", + "哈尔滨": "101050101", + "双城": "101050102", + "呼兰": "101050103", + "阿城": "101050104", + "宾县": "101050105", + "依兰": "101050106", + "巴彦": "101050107", + "通河": "101050108", + "方正": "101050109", + "延寿": "101050110", + "尚志": "101050111", + "五常": "101050112", + "木兰": "101050113", + "齐齐哈尔": "101050201", + "讷河": "101050202", + "龙江": "101050203", + "甘南": "101050204", + "富裕": "101050205", + "依安": "101050206", + "拜泉": "101050207", + "克山": "101050208", + "克东": "101050209", + "泰来": "101050210", + "牡丹江": "101050301", + "海林": "101050302", + "穆棱": "101050303", + "林口": "101050304", + "绥芬河": "101050305", + "宁安": "101050306", + "东宁": "101050307", + "佳木斯": "101050401", + "汤原": "101050402", + "抚远": "101050403", + "桦川": "101050404", + "桦南": "101050405", + "同江": "101050406", + "富锦": "101050407", + "绥化": "101050501", + "肇东": "101050502", + "安达": "101050503", + "海伦": "101050504", + "明水": "101050505", + "望奎": "101050506", + "兰西": "101050507", + "青冈": "101050508", + "庆安": "101050509", + "绥棱": "101050510", + "黑河": "101050601", + "嫩江": "101050602", + "孙吴": "101050603", + "逊克": "101050604", + "五大连池": "101050605", + "北安": "101050606", + "大兴安岭": "101050701", + "塔河": "101050702", + "漠河": "101050703", + "呼玛": "101050704", + "呼中": "101050705", + "新林": "101050706", + "阿木尔": "101050707", + "加格达奇": "101050708", + "伊春": "101050801", + "乌伊岭": "101050802", + "五营": "101050803", + "铁力": "101050804", + "嘉荫": "101050805", + "大庆": "101050901", + "林甸": "101050902", + "肇州": "101050903", + "肇源": "101050904", + "杜蒙": "101050905", + "七台河": "101051002", + "勃利": "101051003", + "鸡西": "101051101", + "虎林": "101051102", + "密山": "101051103", + "鸡东": "101051104", + "鹤岗": "101051201", + "绥滨": "101051202", + "萝北": "101051203", + "双鸭山": "101051301", + "集贤": "101051302", + "宝清": "101051303", + "饶河": "101051304", + "长春": "101060101", + "农安": "101060102", + "德惠": "101060103", + "九台": "101060104", + "榆树": "101060105", + "双阳": "101060106", + "吉林": "101060201", + "舒兰": "101060202", + "永吉": "101060203", + "蛟河": "101060204", + "磐石": "101060205", + "桦甸": "101060206", + "烟筒山": "101060207", + "延吉": "101060301", + "敦化": "101060302", + "安图": "101060303", + "汪清": "101060304", + "和龙": "101060305", + "天池": "101060306", + "龙井": "101060307", + "珲春": "101060308", + "图们": "101060309", + "罗子沟": "101060311", + "延边": "101060312", + "四平": "101060401", + "双辽": "101060402", + "梨树": "101060403", + "公主岭": "101060404", + "伊通": "101060405", + "孤家子": "101060406", + "通化": "101060501", + "梅河口": "101060502", + "柳河": "101060503", + "辉南": "101060504", + "集安": "101060505", + "通化县": "101060506", + "白城": "101060601", + "洮南": "101060602", + "大安": "101060603", + "镇赉": "101060604", + "通榆": "101060605", + "辽源": "101060701", + "东丰": "101060702", + "松原": "101060801", + "乾安": "101060802", + "前郭": "101060803", + "长岭": "101060804", + "扶余": "101060805", + "白山": "101060901", + "靖宇": "101060902", + "临江": "101060903", + "东岗": "101060904", + "长白": "101060905", + "沈阳": "101070101", + "苏家屯": "101070102", + "辽中": "101070103", + "康平": "101070104", + "法库": "101070105", + "新民": "101070106", + "于洪": "101070107", + "新城子": "101070108", + "大连": "101070201", + "瓦房店": "101070202", + "金州": "101070203", + "普兰店": "101070204", + "旅顺": "101070205", + "长海": "101070206", + "庄河": "101070207", + "皮口": "101070208", + "海洋岛": "101070209", + "鞍山": "101070301", + "台安": "101070302", + "岫岩": "101070303", + "海城": "101070304", + "抚顺": "101070401", + "清原": "101070403", + "章党": "101070404", + "本溪": "101070501", + "本溪县": "101070502", + "草河口": "101070503", + "桓仁": "101070504", + "丹东": "101070601", + "凤城": "101070602", + "宽甸": "101070603", + "东港": "101070604", + "东沟": "101070605", + "锦州": "101070701", + "凌海": "101070702", + "北宁": "101070703", + "义县": "101070704", + "黑山": "101070705", + "北镇": "101070706", + "营口": "101070801", + "大石桥": "101070802", + "盖州": "101070803", + "阜新": "101070901", + "彰武": "101070902", + "辽阳": "101071001", + "辽阳县": "101071002", + "灯塔": "101071003", + "铁岭": "101071101", + "开原": "101071102", + "昌图": "101071103", + "西丰": "101071104", + "建平": "101071202", + "凌源": "101071203", + "喀左": "101071204", + "北票": "101071205", + "羊山": "101071206", + "建平县": "101071207", + "盘锦": "101071301", + "大洼": "101071302", + "盘山": "101071303", + "葫芦岛": "101071401", + "建昌": "101071402", + "绥中": "101071403", + "兴城": "101071404", + "呼和浩特": "101080101", + "土默特左旗": "101080102", + "托克托": "101080103", + "和林格尔": "101080104", + "清水河": "101080105", + "呼和浩特市郊区": "101080106", + "武川": "101080107", + "包头": "101080201", + "白云鄂博": "101080202", + "满都拉": "101080203", + "土默特右旗": "101080204", + "固阳": "101080205", + "达尔罕茂明安联合旗": "101080206", + "石拐": "101080207", + "乌海": "101080301", + "集宁": "101080401", + "卓资": "101080402", + "化德": "101080403", + "商都": "101080404", + "希拉穆仁": "101080405", + "兴和": "101080406", + "凉城": "101080407", + "察哈尔右翼前旗": "101080408", + "察哈尔右翼中旗": "101080409", + "察哈尔右翼后旗": "101080410", + "四子王旗": "101080411", + "丰镇": "101080412", + "通辽": "101080501", + "舍伯吐": "101080502", + "科尔沁左翼中旗": "101080503", + "科尔沁左翼后旗": "101080504", + "青龙山": "101080505", + "开鲁": "101080506", + "库伦旗": "101080507", + "奈曼旗": "101080508", + "扎鲁特旗": "101080509", + "高力板": "101080510", + "巴雅尔吐胡硕": "101080511", + "通辽钱家店": "101080512", + "赤峰": "101080601", + "赤峰郊区站": "101080602", + "阿鲁科尔沁旗": "101080603", + "浩尔吐": "101080604", + "巴林左旗": "101080605", + "巴林右旗": "101080606", + "林西": "101080607", + "克什克腾旗": "101080608", + "翁牛特旗": "101080609", + "岗子": "101080610", + "喀喇沁旗": "101080611", + "八里罕": "101080612", + "宁城": "101080613", + "敖汉旗": "101080614", + "宝过图": "101080615", + "鄂尔多斯": "101080701", + "达拉特旗": "101080703", + "准格尔旗": "101080704", + "鄂托克前旗": "101080705", + "河南": "101080706", + "伊克乌素": "101080707", + "鄂托克旗": "101080708", + "杭锦旗": "101080709", + "乌审旗": "101080710", + "伊金霍洛旗": "101080711", + "乌审召": "101080712", + "东胜": "101080713", + "临河": "101080801", + "五原": "101080802", + "磴口": "101080803", + "乌拉特前旗": "101080804", + "大佘太": "101080805", + "乌拉特中旗": "101080806", + "乌拉特后旗": "101080807", + "海力素": "101080808", + "那仁宝力格": "101080809", + "杭锦后旗": "101080810", + "巴盟农试站": "101080811", + "锡林浩特": "101080901", + "朝克乌拉": "101080902", + "二连浩特": "101080903", + "阿巴嘎旗": "101080904", + "伊和郭勒": "101080905", + "苏尼特左旗": "101080906", + "苏尼特右旗": "101080907", + "朱日和": "101080908", + "东乌珠穆沁旗": "101080909", + "西乌珠穆沁旗": "101080910", + "太仆寺旗": "101080911", + "镶黄旗": "101080912", + "正镶白旗": "101080913", + "正兰旗": "101080914", + "多伦": "101080915", + "博克图": "101080916", + "乌拉盖": "101080917", + "白日乌拉": "101080918", + "那日图": "101080919", + "呼伦贝尔": "101081000", + "海拉尔": "101081001", + "小二沟": "101081002", + "阿荣旗": "101081003", + "莫力达瓦旗": "101081004", + "鄂伦春旗": "101081005", + "鄂温克旗": "101081006", + "陈巴尔虎旗": "101081007", + "新巴尔虎左旗": "101081008", + "新巴尔虎右旗": "101081009", + "满洲里": "101081010", + "牙克石": "101081011", + "扎兰屯": "101081012", + "额尔古纳": "101081014", + "根河": "101081015", + "图里河": "101081016", + "乌兰浩特": "101081101", + "阿尔山": "101081102", + "科尔沁右翼中旗": "101081103", + "胡尔勒": "101081104", + "扎赉特旗": "101081105", + "索伦": "101081106", + "突泉": "101081107", + "霍林郭勒": "101081108", + "阿拉善左旗": "101081201", + "阿拉善右旗": "101081202", + "额济纳旗": "101081203", + "拐子湖": "101081204", + "吉兰太": "101081205", + "锡林高勒": "101081206", + "头道湖": "101081207", + "中泉子": "101081208", + "巴彦诺尔贡": "101081209", + "雅布赖": "101081210", + "乌斯太": "101081211", + "孪井滩": "101081212", + "石家庄": "101090101", + "井陉": "101090102", + "正定": "101090103", + "栾城": "101090104", + "行唐": "101090105", + "灵寿": "101090106", + "高邑": "101090107", + "深泽": "101090108", + "赞皇": "101090109", + "无极": "101090110", + "平山": "101090111", + "元氏": "101090112", + "赵县": "101090113", + "辛集": "101090114", + "藁城": "101090115", + "晋洲": "101090116", + "新乐": "101090117", + "保定": "101090201", + "满城": "101090202", + "阜平": "101090203", + "徐水": "101090204", + "唐县": "101090205", + "高阳": "101090206", + "容城": "101090207", + "紫荆关": "101090208", + "涞源": "101090209", + "望都": "101090210", + "安新": "101090211", + "易县": "101090212", + "涞水": "101090213", + "曲阳": "101090214", + "蠡县": "101090215", + "顺平": "101090216", + "雄县": "101090217", + "涿州": "101090218", + "定州": "101090219", + "安国": "101090220", + "高碑店": "101090221", + "张家口": "101090301", + "宣化": "101090302", + "张北": "101090303", + "康保": "101090304", + "沽源": "101090305", + "尚义": "101090306", + "蔚县": "101090307", + "阳原": "101090308", + "怀安": "101090309", + "万全": "101090310", + "怀来": "101090311", + "涿鹿": "101090312", + "赤城": "101090313", + "崇礼": "101090314", + "承德": "101090402", + "承德县": "101090403", + "兴隆": "101090404", + "平泉": "101090405", + "滦平": "101090406", + "隆化": "101090407", + "丰宁": "101090408", + "宽城": "101090409", + "围场": "101090410", + "塞罕坎": "101090411", + "唐山": "101090501", + "丰南": "101090502", + "丰润": "101090503", + "滦县": "101090504", + "滦南": "101090505", + "乐亭": "101090506", + "迁西": "101090507", + "玉田": "101090508", + "唐海": "101090509", + "遵化": "101090510", + "迁安": "101090511", + "廊坊": "101090601", + "固安": "101090602", + "永清": "101090603", + "香河": "101090604", + "大城": "101090605", + "文安": "101090606", + "大厂": "101090607", + "霸州": "101090608", + "三河": "101090609", + "沧州": "101090701", + "青县": "101090702", + "东光": "101090703", + "海兴": "101090704", + "盐山": "101090705", + "肃宁": "101090706", + "南皮": "101090707", + "吴桥": "101090708", + "献县": "101090709", + "孟村": "101090710", + "泊头": "101090711", + "任丘": "101090712", + "黄骅": "101090713", + "河间": "101090714", + "曹妃甸": "101090715", + "衡水": "101090801", + "枣强": "101090802", + "武邑": "101090803", + "武强": "101090804", + "饶阳": "101090805", + "安平": "101090806", + "故城": "101090807", + "景县": "101090808", + "阜城": "101090809", + "冀州": "101090810", + "深州": "101090811", + "邢台": "101090901", + "临城": "101090902", + "邢台县浆水": "101090903", + "内邱": "101090904", + "柏乡": "101090905", + "隆尧": "101090906", + "南和": "101090907", + "宁晋": "101090908", + "巨鹿": "101090909", + "新河": "101090910", + "广宗": "101090911", + "平乡": "101090912", + "威县": "101090913", + "清河": "101090914", + "临西": "101090915", + "南宫": "101090916", + "沙河": "101090917", + "任县": "101090918", + "邯郸": "101091001", + "峰峰": "101091002", + "临漳": "101091003", + "成安": "101091004", + "大名": "101091005", + "涉县": "101091006", + "磁县": "101091007", + "肥乡": "101091008", + "永年": "101091009", + "邱县": "101091010", + "鸡泽": "101091011", + "广平": "101091012", + "馆陶": "101091013", + "魏县": "101091014", + "曲周": "101091015", + "武安": "101091016", + "秦皇岛": "101091101", + "青龙": "101091102", + "昌黎": "101091103", + "抚宁": "101091104", + "卢龙": "101091105", + "北戴河": "101091106", + "太原": "101100101", + "清徐": "101100102", + "阳曲": "101100103", + "娄烦": "101100104", + "太原古交区": "101100105", + "太原北郊": "101100106", + "太原南郊": "101100107", + "大同": "101100201", + "阳高": "101100202", + "大同县": "101100203", + "天镇": "101100204", + "广灵": "101100205", + "灵邱": "101100206", + "浑源": "101100207", + "左云": "101100208", + "阳泉": "101100301", + "盂县": "101100302", + "平定": "101100303", + "晋中": "101100401", + "榆次": "101100402", + "榆社": "101100403", + "左权": "101100404", + "和顺": "101100405", + "昔阳": "101100406", + "寿阳": "101100407", + "太谷": "101100408", + "祁县": "101100409", + "平遥": "101100410", + "灵石": "101100411", + "介休": "101100412", + "长治": "101100501", + "黎城": "101100502", + "屯留": "101100503", + "潞城": "101100504", + "襄垣": "101100505", + "平顺": "101100506", + "武乡": "101100507", + "沁县": "101100508", + "长子": "101100509", + "沁源": "101100510", + "壶关": "101100511", + "晋城": "101100601", + "沁水": "101100602", + "阳城": "101100603", + "陵川": "101100604", + "高平": "101100605", + "临汾": "101100701", + "曲沃": "101100702", + "永和": "101100703", + "隰县": "101100704", + "大宁": "101100705", + "吉县": "101100706", + "襄汾": "101100707", + "蒲县": "101100708", + "汾西": "101100709", + "洪洞": "101100710", + "霍州": "101100711", + "乡宁": "101100712", + "翼城": "101100713", + "侯马": "101100714", + "浮山": "101100715", + "安泽": "101100716", + "古县": "101100717", + "运城": "101100801", + "临猗": "101100802", + "稷山": "101100803", + "万荣": "101100804", + "河津": "101100805", + "新绛": "101100806", + "绛县": "101100807", + "闻喜": "101100808", + "垣曲": "101100809", + "永济": "101100810", + "芮城": "101100811", + "夏县": "101100812", + "平陆": "101100813", + "朔州": "101100901", + "平鲁": "101100902", + "山阴": "101100903", + "右玉": "101100904", + "应县": "101100905", + "怀仁": "101100906", + "忻州": "101101001", + "定襄": "101101002", + "五台县豆村": "101101003", + "河曲": "101101004", + "偏关": "101101005", + "神池": "101101006", + "宁武": "101101007", + "代县": "101101008", + "繁峙": "101101009", + "五台山": "101101010", + "保德": "101101011", + "静乐": "101101012", + "岢岚": "101101013", + "五寨": "101101014", + "原平": "101101015", + "吕梁": "101101100", + "离石": "101101101", + "临县": "101101102", + "兴县": "101101103", + "岚县": "101101104", + "柳林": "101101105", + "石楼": "101101106", + "方山": "101101107", + "交口": "101101108", + "中阳": "101101109", + "孝义": "101101110", + "汾阳": "101101111", + "文水": "101101112", + "交城": "101101113", + "西安": "101110101", + "长安": "101110102", + "临潼": "101110103", + "蓝田": "101110104", + "周至": "101110105", + "户县": "101110106", + "高陵": "101110107", + "杨凌": "101110108", + "咸阳": "101110200", + "三原": "101110201", + "礼泉": "101110202", + "永寿": "101110203", + "淳化": "101110204", + "泾阳": "101110205", + "武功": "101110206", + "乾县": "101110207", + "彬县": "101110208", + "长武": "101110209", + "旬邑": "101110210", + "兴平": "101110211", + "延安": "101110300", + "延长": "101110301", + "延川": "101110302", + "子长": "101110303", + "宜川": "101110304", + "富县": "101110305", + "志丹": "101110306", + "安塞": "101110307", + "甘泉": "101110308", + "洛川": "101110309", + "黄陵": "101110310", + "黄龙": "101110311", + "吴起": "101110312", + "榆林": "101110401", + "府谷": "101110402", + "神木": "101110403", + "佳县": "101110404", + "定边": "101110405", + "靖边": "101110406", + "横山": "101110407", + "米脂": "101110408", + "子洲": "101110409", + "绥德": "101110410", + "吴堡": "101110411", + "清涧": "101110412", + "渭南": "101110501", + "华县": "101110502", + "潼关": "101110503", + "大荔": "101110504", + "白水": "101110505", + "富平": "101110506", + "蒲城": "101110507", + "澄城": "101110508", + "合阳": "101110509", + "韩城": "101110510", + "华阴": "101110511", + "华山": "101110512", + "商洛": "101110601", + "洛南": "101110602", + "柞水": "101110603", + "镇安": "101110605", + "丹凤": "101110606", + "商南": "101110607", + "山阳": "101110608", + "安康": "101110701", + "紫阳": "101110702", + "石泉": "101110703", + "汉阴": "101110704", + "旬阳": "101110705", + "岚皋": "101110706", + "平利": "101110707", + "白河": "101110708", + "镇坪": "101110709", + "宁陕": "101110710", + "汉中": "101110801", + "略阳": "101110802", + "勉县": "101110803", + "留坝": "101110804", + "洋县": "101110805", + "城固": "101110806", + "西乡": "101110807", + "佛坪": "101110808", + "宁强": "101110809", + "南郑": "101110810", + "镇巴": "101110811", + "宝鸡": "101110901", + "宝鸡县": "101110902", + "千阳": "101110903", + "麟游": "101110904", + "岐山": "101110905", + "凤翔": "101110906", + "扶风": "101110907", + "眉县": "101110908", + "太白": "101110909", + "凤县": "101110910", + "陇县": "101110911", + "铜川": "101111001", + "耀县": "101111002", + "宜君": "101111003", + "济南": "101120101", + "长清": "101120102", + "商河": "101120103", + "章丘": "101120104", + "平阴": "101120105", + "济阳": "101120106", + "青岛": "101120201", + "崂山": "101120202", + "潮连岛": "101120203", + "即墨": "101120204", + "胶州": "101120205", + "胶南": "101120206", + "莱西": "101120207", + "平度": "101120208", + "淄博": "101120301", + "淄川": "101120302", + "博山": "101120303", + "高青": "101120304", + "周村": "101120305", + "沂源": "101120306", + "桓台": "101120307", + "临淄": "101120308", + "德州": "101120401", + "武城": "101120402", + "临邑": "101120403", + "陵县": "101120404", + "齐河": "101120405", + "乐陵": "101120406", + "庆云": "101120407", + "平原": "101120408", + "宁津": "101120409", + "夏津": "101120410", + "禹城": "101120411", + "烟台": "101120501", + "莱州": "101120502", + "长岛": "101120503", + "蓬莱": "101120504", + "龙口": "101120505", + "招远": "101120506", + "栖霞": "101120507", + "福山": "101120508", + "牟平": "101120509", + "莱阳": "101120510", + "海阳": "101120511", + "千里岩": "101120512", + "潍坊": "101120601", + "青州": "101120602", + "寿光": "101120603", + "临朐": "101120604", + "昌乐": "101120605", + "昌邑": "101120606", + "安丘": "101120607", + "高密": "101120608", + "诸城": "101120609", + "济宁": "101120701", + "嘉祥": "101120702", + "微山": "101120703", + "鱼台": "101120704", + "兖州": "101120705", + "金乡": "101120706", + "汶上": "101120707", + "泗水": "101120708", + "梁山": "101120709", + "曲阜": "101120710", + "邹城": "101120711", + "泰安": "101120801", + "新泰": "101120802", + "泰山": "101120803", + "肥城": "101120804", + "东平": "101120805", + "宁阳": "101120806", + "临沂": "101120901", + "莒南": "101120902", + "沂南": "101120903", + "苍山": "101120904", + "临沭": "101120905", + "郯城": "101120906", + "蒙阴": "101120907", + "平邑": "101120908", + "费县": "101120909", + "沂水": "101120910", + "马站": "101120911", + "菏泽": "101121001", + "鄄城": "101121002", + "郓城": "101121003", + "东明": "101121004", + "定陶": "101121005", + "巨野": "101121006", + "曹县": "101121007", + "成武": "101121008", + "单县": "101121009", + "滨州": "101121101", + "博兴": "101121102", + "无棣": "101121103", + "阳信": "101121104", + "惠民": "101121105", + "沾化": "101121106", + "邹平": "101121107", + "东营": "101121201", + "河口": "101121202", + "垦利": "101121203", + "利津": "101121204", + "广饶": "101121205", + "威海": "101121301", + "文登": "101121302", + "荣成": "101121303", + "乳山": "101121304", + "成山头": "101121305", + "石岛": "101121306", + "枣庄": "101121401", + "薛城": "101121402", + "峄城": "101121403", + "台儿庄": "101121404", + "滕州": "101121405", + "日照": "101121501", + "五莲": "101121502", + "莒县": "101121503", + "莱芜": "101121601", + "聊城": "101121701", + "冠县": "101121702", + "阳谷": "101121703", + "高唐": "101121704", + "茌平": "101121705", + "东阿": "101121706", + "临清": "101121707", + "朝城": "101121708", + "莘县": "101121709", + "乌鲁木齐": "101130101", + "蔡家湖": "101130102", + "小渠子": "101130103", + "巴仑台": "101130104", + "达坂城": "101130105", + "十三间房气象站": "101130106", + "天山大西沟": "101130107", + "乌鲁木齐牧试站": "101130108", + "白杨沟": "101130110", + "克拉玛依": "101130201", + "石河子": "101130301", + "炮台": "101130302", + "莫索湾": "101130303", + "乌兰乌苏": "101130304", + "昌吉": "101130401", + "呼图壁": "101130402", + "米泉": "101130403", + "阜康": "101130404", + "吉木萨尔": "101130405", + "奇台": "101130406", + "玛纳斯": "101130407", + "木垒": "101130408", + "北塔山": "101130409", + "吐鲁番": "101130501", + "托克逊": "101130502", + "吐鲁番东坎": "101130503", + "鄯善": "101130504", + "红柳河": "101130505", + "库尔勒": "101130601", + "轮台": "101130602", + "尉犁": "101130603", + "若羌": "101130604", + "且末": "101130605", + "和静": "101130606", + "焉耆": "101130607", + "和硕": "101130608", + "库米什": "101130609", + "巴音布鲁克": "101130610", + "铁干里克": "101130611", + "博湖": "101130612", + "塔中": "101130613", + "阿拉尔": "101130701", + "阿克苏": "101130801", + "乌什": "101130802", + "温宿": "101130803", + "拜城": "101130804", + "新和": "101130805", + "沙雅": "101130806", + "库车": "101130807", + "柯坪": "101130808", + "阿瓦提": "101130809", + "喀什": "101130901", + "英吉沙": "101130902", + "塔什库尔干": "101130903", + "麦盖提": "101130904", + "莎车": "101130905", + "叶城": "101130906", + "泽普": "101130907", + "巴楚": "101130908", + "岳普湖": "101130909", + "伽师": "101130910", + "伊宁": "101131001", + "察布查尔": "101131002", + "尼勒克": "101131003", + "伊宁县": "101131004", + "巩留": "101131005", + "新源": "101131006", + "昭苏": "101131007", + "特克斯": "101131008", + "霍城": "101131009", + "霍尔果斯": "101131010", + "塔城": "101131101", + "裕民": "101131102", + "额敏": "101131103", + "和布克赛尔": "101131104", + "托里": "101131105", + "乌苏": "101131106", + "沙湾": "101131107", + "和丰": "101131108", + "哈密": "101131201", + "沁城": "101131202", + "巴里坤": "101131203", + "伊吾": "101131204", + "淖毛湖": "101131205", + "和田": "101131301", + "皮山": "101131302", + "策勒": "101131303", + "墨玉": "101131304", + "洛浦": "101131305", + "民丰": "101131306", + "于田": "101131307", + "阿勒泰": "101131401", + "哈巴河": "101131402", + "一八五团": "101131403", + "黑山头": "101131404", + "吉木乃": "101131405", + "布尔津": "101131406", + "福海": "101131407", + "富蕴": "101131408", + "青河": "101131409", + "安德河": "101131410", + "阿图什": "101131501", + "乌恰": "101131502", + "阿克陶": "101131503", + "阿合奇": "101131504", + "吐尔尕特": "101131505", + "博乐": "101131601", + "温泉": "101131602", + "精河": "101131603", + "阿拉山口": "101131606", + "拉萨": "101140101", + "当雄": "101140102", + "尼木": "101140103", + "墨竹贡卡": "101140104", + "日喀则": "101140201", + "拉孜": "101140202", + "南木林": "101140203", + "聂拉木": "101140204", + "定日": "101140205", + "江孜": "101140206", + "帕里": "101140207", + "山南": "101140301", + "贡嘎": "101140302", + "琼结": "101140303", + "加查": "101140304", + "浪卡子": "101140305", + "错那": "101140306", + "隆子": "101140307", + "泽当": "101140308", + "林芝": "101140401", + "波密": "101140402", + "米林": "101140403", + "察隅": "101140404", + "昌都": "101140501", + "丁青": "101140502", + "类乌齐": "101140503", + "洛隆": "101140504", + "左贡": "101140505", + "芒康": "101140506", + "八宿": "101140507", + "那曲": "101140601", + "嘉黎": "101140603", + "班戈": "101140604", + "安多": "101140605", + "索县": "101140606", + "比如": "101140607", + "阿里": "101140701", + "改则": "101140702", + "申扎": "101140703", + "狮泉河": "101140704", + "普兰": "101140705", + "西宁": "101150101", + "大通": "101150102", + "湟源": "101150103", + "湟中": "101150104", + "铁卜加": "101150105", + "铁卜加寺": "101150106", + "中心站": "101150107", + "海东": "101150201", + "乐都": "101150202", + "民和": "101150203", + "互助": "101150204", + "化隆": "101150205", + "循化": "101150206", + "冷湖": "101150207", + "平安": "101150208", + "黄南": "101150301", + "尖扎": "101150302", + "泽库": "101150303", + "海南": "101150401", + "江西沟": "101150402", + "贵德": "101150404", + "河卡": "101150405", + "兴海": "101150406", + "贵南": "101150407", + "同德": "101150408", + "共和": "101150409", + "果洛": "101150501", + "班玛": "101150502", + "甘德": "101150503", + "达日": "101150504", + "久治": "101150505", + "玛多": "101150506", + "玛沁": "101150508", + "玉树": "101150601", + "托托河": "101150602", + "治多": "101150603", + "杂多": "101150604", + "囊谦": "101150605", + "曲麻莱": "101150606", + "海西": "101150701", + "格尔木": "101150702", + "察尔汉": "101150703", + "野牛沟": "101150704", + "五道梁": "101150705", + "小灶火": "101150706", + "天峻": "101150708", + "乌兰": "101150709", + "都兰": "101150710", + "诺木洪": "101150711", + "茫崖": "101150712", + "大柴旦": "101150713", + "茶卡": "101150714", + "香日德": "101150715", + "德令哈": "101150716", + "海北": "101150801", + "门源": "101150802", + "祁连": "101150803", + "海晏": "101150804", + "托勒": "101150805", + "刚察": "101150806", + "兰州": "101160101", + "皋兰": "101160102", + "永登": "101160103", + "榆中": "101160104", + "定西": "101160201", + "通渭": "101160202", + "陇西": "101160203", + "渭源": "101160204", + "临洮": "101160205", + "漳县": "101160206", + "岷县": "101160207", + "安定": "101160208", + "平凉": "101160301", + "泾川": "101160302", + "灵台": "101160303", + "崇信": "101160304", + "华亭": "101160305", + "庄浪": "101160306", + "静宁": "101160307", + "崆峒": "101160308", + "庆阳": "101160401", + "西峰": "101160402", + "环县": "101160403", + "华池": "101160404", + "合水": "101160405", + "正宁": "101160406", + "宁县": "101160407", + "镇原": "101160408", + "庆城": "101160409", + "武威": "101160501", + "民勤": "101160502", + "古浪": "101160503", + "乌鞘岭": "101160504", + "天祝": "101160505", + "金昌": "101160601", + "永昌": "101160602", + "张掖": "101160701", + "肃南": "101160702", + "民乐": "101160703", + "临泽": "101160704", + "高台": "101160705", + "山丹": "101160706", + "酒泉": "101160801", + "鼎新": "101160802", + "金塔": "101160803", + "马鬃山": "101160804", + "瓜州": "101160805", + "肃北": "101160806", + "玉门镇": "101160807", + "敦煌": "101160808", + "天水": "101160901", + "北道区": "101160902", + "清水": "101160903", + "秦安": "101160904", + "甘谷": "101160905", + "武山": "101160906", + "张家川": "101160907", + "麦积": "101160908", + "武都": "101161001", + "成县": "101161002", + "文县": "101161003", + "宕昌": "101161004", + "康县": "101161005", + "西和": "101161006", + "礼县": "101161007", + "徽县": "101161008", + "两当": "101161009", + "临夏": "101161101", + "康乐": "101161102", + "永靖": "101161103", + "广河": "101161104", + "和政": "101161105", + "东乡": "101161106", + "合作": "101161201", + "临潭": "101161202", + "卓尼": "101161203", + "舟曲": "101161204", + "迭部": "101161205", + "玛曲": "101161206", + "碌曲": "101161207", + "夏河": "101161208", + "白银": "101161301", + "靖远": "101161302", + "会宁": "101161303", + "华家岭": "101161304", + "景泰": "101161305", + "银川": "101170101", + "永宁": "101170102", + "灵武": "101170103", + "贺兰": "101170104", + "石嘴山": "101170201", + "惠农": "101170202", + "平罗": "101170203", + "陶乐": "101170204", + "石炭井": "101170205", + "大武口": "101170206", + "吴忠": "101170301", + "同心": "101170302", + "盐池": "101170303", + "韦州": "101170304", + "麻黄山": "101170305", + "青铜峡": "101170306", + "固原": "101170401", + "西吉": "101170402", + "隆德": "101170403", + "泾源": "101170404", + "六盘山": "101170405", + "彭阳": "101170406", + "中卫": "101170501", + "中宁": "101170502", + "兴仁堡": "101170503", + "海原": "101170504", + "郑州": "101180101", + "巩义": "101180102", + "荥阳": "101180103", + "登封": "101180104", + "新密": "101180105", + "新郑": "101180106", + "中牟": "101180107", + "郑州农试站": "101180108", + "安阳": "101180201", + "汤阴": "101180202", + "滑县": "101180203", + "内黄": "101180204", + "林州": "101180205", + "新乡": "101180301", + "获嘉": "101180302", + "原阳": "101180303", + "辉县": "101180304", + "卫辉": "101180305", + "延津": "101180306", + "封丘": "101180307", + "长垣": "101180308", + "许昌": "101180401", + "鄢陵": "101180402", + "襄城": "101180403", + "长葛": "101180404", + "禹州": "101180405", + "平顶山": "101180501", + "郏县": "101180502", + "宝丰": "101180503", + "汝州": "101180504", + "叶县": "101180505", + "舞钢": "101180506", + "鲁山": "101180507", + "信阳": "101180601", + "息县": "101180602", + "罗山": "101180603", + "光山": "101180604", + "新县": "101180605", + "淮滨": "101180606", + "潢川": "101180607", + "固始": "101180608", + "商城": "101180609", + "鸡公山": "101180610", + "信阳地区农试站": "101180611", + "南阳": "101180701", + "南召": "101180702", + "方城": "101180703", + "社旗": "101180704", + "西峡": "101180705", + "内乡": "101180706", + "镇平": "101180707", + "淅川": "101180708", + "新野": "101180709", + "唐河": "101180710", + "邓州": "101180711", + "桐柏": "101180712", + "开封": "101180801", + "杞县": "101180802", + "尉氏": "101180803", + "通许": "101180804", + "兰考": "101180805", + "洛阳": "101180901", + "新安": "101180902", + "孟津": "101180903", + "宜阳": "101180904", + "洛宁": "101180905", + "伊川": "101180906", + "嵩县": "101180907", + "偃师": "101180908", + "栾川": "101180909", + "汝阳": "101180910", + "商丘": "101181001", + "睢阳区": "101181002", + "睢县": "101181003", + "民权": "101181004", + "虞城": "101181005", + "柘城": "101181006", + "宁陵": "101181007", + "夏邑": "101181008", + "永城": "101181009", + "焦作": "101181101", + "修武": "101181102", + "武陟": "101181103", + "沁阳": "101181104", + "博爱": "101181106", + "温县": "101181107", + "孟州": "101181108", + "鹤壁": "101181201", + "浚县": "101181202", + "淇县": "101181203", + "濮阳": "101181301", + "台前": "101181302", + "南乐": "101181303", + "清丰": "101181304", + "范县": "101181305", + "周口": "101181401", + "扶沟": "101181402", + "太康": "101181403", + "淮阳": "101181404", + "西华": "101181405", + "商水": "101181406", + "项城": "101181407", + "郸城": "101181408", + "鹿邑": "101181409", + "沈丘": "101181410", + "黄泛区": "101181411", + "漯河": "101181501", + "临颍": "101181502", + "舞阳": "101181503", + "驻马店": "101181601", + "西平": "101181602", + "遂平": "101181603", + "上蔡": "101181604", + "汝南": "101181605", + "泌阳": "101181606", + "平舆": "101181607", + "新蔡": "101181608", + "确山": "101181609", + "正阳": "101181610", + "三门峡": "101181701", + "灵宝": "101181702", + "渑池": "101181703", + "卢氏": "101181704", + "济源": "101181801", + "南京": "101190101", + "溧水": "101190102", + "高淳": "101190103", + "江宁": "101190104", + "六合": "101190105", + "江浦": "101190106", + "浦口": "101190107", + "无锡": "101190201", + "江阴": "101190202", + "宜兴": "101190203", + "镇江": "101190301", + "丹阳": "101190302", + "扬中": "101190303", + "句容": "101190304", + "丹徒": "101190305", + "苏州": "101190401", + "常熟": "101190402", + "张家港": "101190403", + "昆山": "101190404", + "吴县东山": "101190405", + "吴县": "101190406", + "吴江": "101190407", + "太仓": "101190408", + "南通": "101190501", + "海安": "101190502", + "如皋": "101190503", + "如东": "101190504", + "吕泗": "101190505", + "吕泗渔场": "101190506", + "启东": "101190507", + "海门": "101190508", + "扬州": "101190601", + "宝应": "101190602", + "仪征": "101190603", + "高邮": "101190604", + "江都": "101190605", + "邗江": "101190606", + "盐城": "101190701", + "响水": "101190702", + "滨海": "101190703", + "阜宁": "101190704", + "射阳": "101190705", + "建湖": "101190706", + "东台": "101190707", + "大丰": "101190708", + "盐都": "101190709", + "徐州": "101190801", + "徐州农试站": "101190802", + "丰县": "101190803", + "沛县": "101190804", + "邳州": "101190805", + "睢宁": "101190806", + "新沂": "101190807", + "淮安": "101190901", + "金湖": "101190902", + "盱眙": "101190903", + "洪泽": "101190904", + "涟水": "101190905", + "淮阴县": "101190906", + "淮阴": "101190907", + "楚州": "101190908", + "连云港": "101191001", + "东海": "101191002", + "赣榆": "101191003", + "灌云": "101191004", + "灌南": "101191005", + "西连岛": "101191006", + "燕尾港": "101191007", + "常州": "101191101", + "溧阳": "101191102", + "金坛": "101191103", + "泰州": "101191201", + "兴化": "101191202", + "泰兴": "101191203", + "姜堰": "101191204", + "靖江": "101191205", + "宿迁": "101191301", + "沭阳": "101191302", + "泗阳": "101191303", + "泗洪": "101191304", + "武汉": "101200101", + "蔡甸": "101200102", + "黄陂": "101200103", + "新洲": "101200104", + "江夏": "101200105", + "襄樊": "101200201", + "襄阳": "101200202", + "保康": "101200203", + "南漳": "101200204", + "宜城": "101200205", + "老河口": "101200206", + "谷城": "101200207", + "枣阳": "101200208", + "鄂州": "101200301", + "孝感": "101200401", + "安陆": "101200402", + "云梦": "101200403", + "大悟": "101200404", + "应城": "101200405", + "汉川": "101200406", + "黄冈": "101200501", + "红安": "101200502", + "麻城": "101200503", + "罗田": "101200504", + "英山": "101200505", + "浠水": "101200506", + "蕲春": "101200507", + "黄梅": "101200508", + "武穴": "101200509", + "黄石": "101200601", + "大冶": "101200602", + "阳新": "101200603", + "咸宁": "101200701", + "赤壁": "101200702", + "嘉鱼": "101200703", + "崇阳": "101200704", + "通城": "101200705", + "通山": "101200706", + "荆州": "101200801", + "江陵": "101200802", + "公安": "101200803", + "石首": "101200804", + "监利": "101200805", + "洪湖": "101200806", + "松滋": "101200807", + "宜昌": "101200901", + "远安": "101200902", + "秭归": "101200903", + "兴山": "101200904", + "宜昌县": "101200905", + "五峰": "101200906", + "当阳": "101200907", + "长阳": "101200908", + "宜都": "101200909", + "枝江": "101200910", + "三峡": "101200911", + "夷陵": "101200912", + "恩施": "101201001", + "利川": "101201002", + "建始": "101201003", + "咸丰": "101201004", + "宣恩": "101201005", + "鹤峰": "101201006", + "来凤": "101201007", + "巴东": "101201008", + "绿葱坡": "101201009", + "十堰": "101201101", + "竹溪": "101201102", + "郧西": "101201103", + "郧县": "101201104", + "竹山": "101201105", + "房县": "101201106", + "丹江口": "101201107", + "神农架": "101201201", + "随州": "101201301", + "广水": "101201302", + "荆门": "101201401", + "钟祥": "101201402", + "京山": "101201403", + "天门": "101201501", + "仙桃": "101201601", + "潜江": "101201701", + "杭州": "101210101", + "萧山": "101210102", + "桐庐": "101210103", + "淳安": "101210104", + "建德": "101210105", + "余杭": "101210106", + "临安": "101210107", + "富阳": "101210108", + "湖州": "101210201", + "长兴": "101210202", + "安吉": "101210203", + "德清": "101210204", + "嘉兴": "101210301", + "嘉善": "101210302", + "海宁": "101210303", + "桐乡": "101210304", + "平湖": "101210305", + "海盐": "101210306", + "宁波": "101210401", + "慈溪": "101210403", + "余姚": "101210404", + "奉化": "101210405", + "象山": "101210406", + "石浦": "101210407", + "宁海": "101210408", + "鄞县": "101210409", + "北仑": "101210410", + "鄞州": "101210411", + "镇海": "101210412", + "绍兴": "101210501", + "诸暨": "101210502", + "上虞": "101210503", + "新昌": "101210504", + "嵊州": "101210505", + "台州": "101210601", + "括苍山": "101210602", + "玉环": "101210603", + "三门": "101210604", + "天台": "101210605", + "仙居": "101210606", + "温岭": "101210607", + "大陈": "101210608", + "洪家": "101210609", + "温州": "101210701", + "泰顺": "101210702", + "文成": "101210703", + "平阳": "101210704", + "瑞安": "101210705", + "洞头": "101210706", + "乐清": "101210707", + "永嘉": "101210708", + "苍南": "101210709", + "丽水": "101210801", + "遂昌": "101210802", + "龙泉": "101210803", + "缙云": "101210804", + "青田": "101210805", + "云和": "101210806", + "庆元": "101210807", + "金华": "101210901", + "浦江": "101210902", + "兰溪": "101210903", + "义乌": "101210904", + "东阳": "101210905", + "武义": "101210906", + "永康": "101210907", + "磐安": "101210908", + "衢州": "101211001", + "常山": "101211002", + "开化": "101211003", + "龙游": "101211004", + "江山": "101211005", + "舟山": "101211101", + "嵊泗": "101211102", + "嵊山": "101211103", + "岱山": "101211104", + "普陀": "101211105", + "定海": "101211106", + "合肥": "101220101", + "长丰": "101220102", + "肥东": "101220103", + "肥西": "101220104", + "蚌埠": "101220201", + "怀远": "101220202", + "固镇": "101220203", + "五河": "101220204", + "芜湖": "101220301", + "繁昌": "101220302", + "芜湖县": "101220303", + "南陵": "101220304", + "淮南": "101220401", + "凤台": "101220402", + "马鞍山": "101220501", + "当涂": "101220502", + "安庆": "101220601", + "枞阳": "101220602", + "太湖": "101220603", + "潜山": "101220604", + "怀宁": "101220605", + "宿松": "101220606", + "望江": "101220607", + "岳西": "101220608", + "桐城": "101220609", + "宿州": "101220701", + "砀山": "101220702", + "灵璧": "101220703", + "泗县": "101220704", + "萧县": "101220705", + "阜阳": "101220801", + "阜南": "101220802", + "颍上": "101220803", + "临泉": "101220804", + "界首": "101220805", + "太和": "101220806", + "亳州": "101220901", + "涡阳": "101220902", + "利辛": "101220903", + "蒙城": "101220904", + "黄山站": "101221001", + "黄山区": "101221002", + "屯溪": "101221003", + "祁门": "101221004", + "黟县": "101221005", + "歙县": "101221006", + "休宁": "101221007", + "黄山市": "101221008", + "滁州": "101221101", + "凤阳": "101221102", + "明光": "101221103", + "定远": "101221104", + "全椒": "101221105", + "来安": "101221106", + "天长": "101221107", + "淮北": "101221201", + "濉溪": "101221202", + "铜陵": "101221301", + "宣城": "101221401", + "泾县": "101221402", + "旌德": "101221403", + "宁国": "101221404", + "绩溪": "101221405", + "广德": "101221406", + "郎溪": "101221407", + "六安": "101221501", + "霍邱": "101221502", + "寿县": "101221503", + "南溪": "101221504", + "金寨": "101221505", + "霍山": "101221506", + "舒城": "101221507", + "巢湖": "101221601", + "庐江": "101221602", + "无为": "101221603", + "含山": "101221604", + "和县": "101221605", + "池州": "101221701", + "东至": "101221702", + "青阳": "101221703", + "九华山": "101221704", + "石台": "101221705", + "福州": "101230101", + "闽清": "101230102", + "闽侯": "101230103", + "罗源": "101230104", + "连江": "101230105", + "马祖": "101230106", + "永泰": "101230107", + "平潭": "101230108", + "福州郊区": "101230109", + "长乐": "101230110", + "福清": "101230111", + "平潭海峡大桥": "101230112", + "厦门": "101230201", + "同安": "101230202", + "宁德": "101230301", + "古田": "101230302", + "霞浦": "101230303", + "寿宁": "101230304", + "周宁": "101230305", + "福安": "101230306", + "柘荣": "101230307", + "福鼎": "101230308", + "屏南": "101230309", + "莆田": "101230401", + "仙游": "101230402", + "秀屿港": "101230403", + "泉州": "101230501", + "安溪": "101230502", + "九仙山": "101230503", + "永春": "101230504", + "德化": "101230505", + "南安": "101230506", + "崇武": "101230507", + "晋江": "101230509", + "漳州": "101230601", + "长泰": "101230602", + "南靖": "101230603", + "平和": "101230604", + "龙海": "101230605", + "漳浦": "101230606", + "诏安": "101230607", + "东山": "101230608", + "云霄": "101230609", + "华安": "101230610", + "龙岩": "101230701", + "长汀": "101230702", + "连城": "101230703", + "武平": "101230704", + "上杭": "101230705", + "永定": "101230706", + "漳平": "101230707", + "三明": "101230801", + "宁化": "101230802", + "清流": "101230803", + "泰宁": "101230804", + "将乐": "101230805", + "建宁": "101230806", + "明溪": "101230807", + "沙县": "101230808", + "尤溪": "101230809", + "永安": "101230810", + "大田": "101230811", + "南平": "101230901", + "顺昌": "101230902", + "光泽": "101230903", + "邵武": "101230904", + "武夷山": "101230905", + "浦城": "101230906", + "建阳": "101230907", + "松溪": "101230908", + "政和": "101230909", + "建瓯": "101230910", + "南昌": "101240101", + "新建": "101240102", + "南昌县": "101240103", + "安义": "101240104", + "进贤": "101240105", + "莲塘": "101240106", + "九江": "101240201", + "瑞昌": "101240202", + "庐山": "101240203", + "武宁": "101240204", + "德安": "101240205", + "永修": "101240206", + "湖口": "101240207", + "彭泽": "101240208", + "星子": "101240209", + "都昌": "101240210", + "棠荫": "101240211", + "修水": "101240212", + "上饶": "101240301", + "鄱阳": "101240302", + "婺源": "101240303", + "康山": "101240304", + "余干": "101240305", + "万年": "101240306", + "德兴": "101240307", + "上饶县": "101240308", + "弋阳": "101240309", + "横峰": "101240310", + "铅山": "101240311", + "玉山": "101240312", + "广丰": "101240313", + "波阳": "101240314", + "抚州": "101240401", + "广昌": "101240402", + "乐安": "101240403", + "崇仁": "101240404", + "金溪": "101240405", + "资溪": "101240406", + "宜黄": "101240407", + "南城": "101240408", + "南丰": "101240409", + "黎川": "101240410", + "宜春": "101240501", + "铜鼓": "101240502", + "宜丰": "101240503", + "万载": "101240504", + "上高": "101240505", + "靖安": "101240506", + "奉新": "101240507", + "高安": "101240508", + "樟树": "101240509", + "丰城": "101240510", + "吉安": "101240601", + "吉安县": "101240602", + "吉水": "101240603", + "新干": "101240604", + "峡江": "101240605", + "永丰": "101240606", + "永新": "101240607", + "井冈山": "101240608", + "万安": "101240609", + "遂川": "101240610", + "泰和": "101240611", + "安福": "101240612", + "宁冈": "101240613", + "赣州": "101240701", + "崇义": "101240702", + "上犹": "101240703", + "南康": "101240704", + "大余": "101240705", + "信丰": "101240706", + "宁都": "101240707", + "石城": "101240708", + "瑞金": "101240709", + "于都": "101240710", + "会昌": "101240711", + "安远": "101240712", + "全南": "101240713", + "龙南": "101240714", + "定南": "101240715", + "寻乌": "101240716", + "兴国": "101240717", + "景德镇": "101240801", + "乐平": "101240802", + "萍乡": "101240901", + "莲花": "101240902", + "新余": "101241001", + "分宜": "101241002", + "鹰潭": "101241101", + "余江": "101241102", + "贵溪": "101241103", + "长沙": "101250101", + "宁乡": "101250102", + "浏阳": "101250103", + "马坡岭": "101250104", + "湘潭": "101250201", + "韶山": "101250202", + "湘乡": "101250203", + "株洲": "101250301", + "攸县": "101250302", + "醴陵": "101250303", + "株洲县": "101250304", + "茶陵": "101250305", + "炎陵": "101250306", + "衡阳": "101250401", + "衡山": "101250402", + "衡东": "101250403", + "祁东": "101250404", + "衡阳县": "101250405", + "常宁": "101250406", + "衡南": "101250407", + "耒阳": "101250408", + "南岳": "101250409", + "郴州": "101250501", + "桂阳": "101250502", + "嘉禾": "101250503", + "宜章": "101250504", + "临武": "101250505", + "桥口": "101250506", + "资兴": "101250507", + "汝城": "101250508", + "安仁": "101250509", + "永兴": "101250510", + "桂东": "101250511", + "常德": "101250601", + "安乡": "101250602", + "桃源": "101250603", + "汉寿": "101250604", + "澧县": "101250605", + "临澧": "101250606", + "石门": "101250607", + "益阳": "101250700", + "赫山区": "101250701", + "南县": "101250702", + "桃江": "101250703", + "安化": "101250704", + "沅江": "101250705", + "娄底": "101250801", + "双峰": "101250802", + "冷水江": "101250803", + "冷水滩": "101250804", + "新化": "101250805", + "涟源": "101250806", + "邵阳": "101250901", + "隆回": "101250902", + "洞口": "101250903", + "新邵": "101250904", + "邵东": "101250905", + "绥宁": "101250906", + "新宁": "101250907", + "武冈": "101250908", + "城步": "101250909", + "邵阳县": "101250910", + "岳阳": "101251001", + "华容": "101251002", + "湘阴": "101251003", + "汨罗": "101251004", + "平江": "101251005", + "临湘": "101251006", + "张家界": "101251101", + "桑植": "101251102", + "慈利": "101251103", + "怀化": "101251201", + "鹤城区": "101251202", + "沅陵": "101251203", + "辰溪": "101251204", + "靖州": "101251205", + "会同": "101251206", + "通道": "101251207", + "麻阳": "101251208", + "新晃": "101251209", + "芷江": "101251210", + "溆浦": "101251211", + "黔阳": "101251301", + "洪江": "101251302", + "永州": "101251401", + "祁阳": "101251402", + "东安": "101251403", + "双牌": "101251404", + "道县": "101251405", + "宁远": "101251406", + "江永": "101251407", + "蓝山": "101251408", + "新田": "101251409", + "江华": "101251410", + "吉首": "101251501", + "保靖": "101251502", + "永顺": "101251503", + "古丈": "101251504", + "凤凰": "101251505", + "泸溪": "101251506", + "龙山": "101251507", + "花垣": "101251508", + "贵阳": "101260101", + "白云": "101260102", + "花溪": "101260103", + "乌当": "101260104", + "息烽": "101260105", + "开阳": "101260106", + "修文": "101260107", + "清镇": "101260108", + "遵义": "101260201", + "遵义县": "101260202", + "仁怀": "101260203", + "绥阳": "101260204", + "湄潭": "101260205", + "凤冈": "101260206", + "桐梓": "101260207", + "赤水": "101260208", + "习水": "101260209", + "道真": "101260210", + "正安": "101260211", + "务川": "101260212", + "余庆": "101260213", + "汇川": "101260214", + "安顺": "101260301", + "普定": "101260302", + "镇宁": "101260303", + "平坝": "101260304", + "紫云": "101260305", + "关岭": "101260306", + "都匀": "101260401", + "贵定": "101260402", + "瓮安": "101260403", + "长顺": "101260404", + "福泉": "101260405", + "惠水": "101260406", + "龙里": "101260407", + "罗甸": "101260408", + "平塘": "101260409", + "独山": "101260410", + "三都": "101260411", + "荔波": "101260412", + "凯里": "101260501", + "岑巩": "101260502", + "施秉": "101260503", + "镇远": "101260504", + "黄平": "101260505", + "黄平旧洲": "101260506", + "麻江": "101260507", + "丹寨": "101260508", + "三穗": "101260509", + "台江": "101260510", + "剑河": "101260511", + "雷山": "101260512", + "黎平": "101260513", + "天柱": "101260514", + "锦屏": "101260515", + "榕江": "101260516", + "从江": "101260517", + "炉山": "101260518", + "铜仁": "101260601", + "江口": "101260602", + "玉屏": "101260603", + "万山": "101260604", + "思南": "101260605", + "塘头": "101260606", + "印江": "101260607", + "石阡": "101260608", + "沿河": "101260609", + "德江": "101260610", + "松桃": "101260611", + "毕节": "101260701", + "赫章": "101260702", + "金沙": "101260703", + "威宁": "101260704", + "大方": "101260705", + "纳雍": "101260706", + "织金": "101260707", + "六盘水": "101260801", + "六枝": "101260802", + "水城": "101260803", + "盘县": "101260804", + "黔西": "101260901", + "晴隆": "101260902", + "兴仁": "101260903", + "贞丰": "101260904", + "望谟": "101260905", + "兴义": "101260906", + "安龙": "101260907", + "册亨": "101260908", + "普安": "101260909", + "成都": "101270101", + "龙泉驿": "101270102", + "新都": "101270103", + "温江": "101270104", + "金堂": "101270105", + "双流": "101270106", + "郫县": "101270107", + "大邑": "101270108", + "蒲江": "101270109", + "新津": "101270110", + "都江堰": "101270111", + "彭州": "101270112", + "邛崃": "101270113", + "崇州": "101270114", + "崇庆": "101270115", + "彭县": "101270116", + "攀枝花": "101270201", + "仁和": "101270202", + "米易": "101270203", + "盐边": "101270204", + "自贡": "101270301", + "富顺": "101270302", + "荣县": "101270303", + "绵阳": "101270401", + "三台": "101270402", + "盐亭": "101270403", + "安县": "101270404", + "梓潼": "101270405", + "北川": "101270406", + "平武": "101270407", + "江油": "101270408", + "南充": "101270501", + "南部": "101270502", + "营山": "101270503", + "蓬安": "101270504", + "仪陇": "101270505", + "西充": "101270506", + "阆中": "101270507", + "达州": "101270601", + "宣汉": "101270602", + "开江": "101270603", + "大竹": "101270604", + "渠县": "101270605", + "万源": "101270606", + "达川": "101270607", + "遂宁": "101270701", + "蓬溪": "101270702", + "射洪": "101270703", + "广安": "101270801", + "岳池": "101270802", + "武胜": "101270803", + "邻水": "101270804", + "华蓥山": "101270805", + "巴中": "101270901", + "通江": "101270902", + "南江": "101270903", + "平昌": "101270904", + "泸州": "101271001", + "泸县": "101271003", + "合江": "101271004", + "叙永": "101271005", + "古蔺": "101271006", + "纳溪": "101271007", + "宜宾": "101271101", + "宜宾农试站": "101271102", + "宜宾县": "101271103", + "江安": "101271105", + "长宁": "101271106", + "高县": "101271107", + "珙县": "101271108", + "筠连": "101271109", + "兴文": "101271110", + "屏山": "101271111", + "内江": "101271201", + "东兴": "101271202", + "威远": "101271203", + "资中": "101271204", + "隆昌": "101271205", + "资阳": "101271301", + "安岳": "101271302", + "乐至": "101271303", + "简阳": "101271304", + "乐山": "101271401", + "犍为": "101271402", + "井研": "101271403", + "夹江": "101271404", + "沐川": "101271405", + "峨边": "101271406", + "马边": "101271407", + "峨眉": "101271408", + "峨眉山": "101271409", + "眉山": "101271501", + "仁寿": "101271502", + "彭山": "101271503", + "洪雅": "101271504", + "丹棱": "101271505", + "青神": "101271506", + "凉山": "101271601", + "木里": "101271603", + "盐源": "101271604", + "德昌": "101271605", + "会理": "101271606", + "会东": "101271607", + "宁南": "101271608", + "普格": "101271609", + "西昌": "101271610", + "金阳": "101271611", + "昭觉": "101271612", + "喜德": "101271613", + "冕宁": "101271614", + "越西": "101271615", + "甘洛": "101271616", + "雷波": "101271617", + "美姑": "101271618", + "布拖": "101271619", + "雅安": "101271701", + "名山": "101271702", + "荣经": "101271703", + "汉源": "101271704", + "石棉": "101271705", + "天全": "101271706", + "芦山": "101271707", + "宝兴": "101271708", + "甘孜": "101271801", + "康定": "101271802", + "泸定": "101271803", + "丹巴": "101271804", + "九龙": "101271805", + "雅江": "101271806", + "道孚": "101271807", + "炉霍": "101271808", + "新龙": "101271809", + "德格": "101271810", + "白玉": "101271811", + "石渠": "101271812", + "色达": "101271813", + "理塘": "101271814", + "巴塘": "101271815", + "乡城": "101271816", + "稻城": "101271817", + "得荣": "101271818", + "阿坝": "101271901", + "汶川": "101271902", + "理县": "101271903", + "茂县": "101271904", + "松潘": "101271905", + "九寨沟": "101271906", + "金川": "101271907", + "小金": "101271908", + "黑水": "101271909", + "马尔康": "101271910", + "壤塘": "101271911", + "若尔盖": "101271912", + "红原": "101271913", + "南坪": "101271914", + "德阳": "101272001", + "中江": "101272002", + "广汉": "101272003", + "什邡": "101272004", + "绵竹": "101272005", + "罗江": "101272006", + "广元": "101272101", + "旺苍": "101272102", + "青川": "101272103", + "剑阁": "101272104", + "苍溪": "101272105", + "广州": "101280101", + "番禺": "101280102", + "从化": "101280103", + "增城": "101280104", + "花都": "101280105", + "天河": "101280106", + "韶关": "101280201", + "乳源": "101280202", + "始兴": "101280203", + "翁源": "101280204", + "乐昌": "101280205", + "仁化": "101280206", + "南雄": "101280207", + "新丰": "101280208", + "曲江": "101280209", + "惠州": "101280301", + "博罗": "101280302", + "惠阳": "101280303", + "惠东": "101280304", + "龙门": "101280305", + "梅州": "101280401", + "兴宁": "101280402", + "蕉岭": "101280403", + "大埔": "101280404", + "丰顺": "101280406", + "平远": "101280407", + "五华": "101280408", + "梅县": "101280409", + "汕头": "101280501", + "潮阳": "101280502", + "澄海": "101280503", + "南澳": "101280504", + "云澳": "101280505", + "南澎岛": "101280506", + "深圳": "101280601", + "珠海": "101280701", + "斗门": "101280702", + "黄茅洲": "101280703", + "佛山": "101280800", + "顺德": "101280801", + "三水": "101280802", + "南海": "101280803", + "肇庆": "101280901", + "广宁": "101280902", + "四会": "101280903", + "德庆": "101280905", + "怀集": "101280906", + "封开": "101280907", + "高要": "101280908", + "湛江": "101281001", + "吴川": "101281002", + "雷州": "101281003", + "徐闻": "101281004", + "廉江": "101281005", + "硇洲": "101281006", + "遂溪": "101281007", + "江门": "101281101", + "开平": "101281103", + "新会": "101281104", + "恩平": "101281105", + "台山": "101281106", + "上川岛": "101281107", + "鹤山": "101281108", + "河源": "101281201", + "紫金": "101281202", + "连平": "101281203", + "和平": "101281204", + "龙川": "101281205", + "清远": "101281301", + "连南": "101281302", + "连州": "101281303", + "连山": "101281304", + "阳山": "101281305", + "佛冈": "101281306", + "英德": "101281307", + "云浮": "101281401", + "罗定": "101281402", + "新兴": "101281403", + "郁南": "101281404", + "潮州": "101281501", + "饶平": "101281502", + "东莞": "101281601", + "中山": "101281701", + "阳江": "101281801", + "阳春": "101281802", + "揭阳": "101281901", + "揭西": "101281902", + "普宁": "101281903", + "惠来": "101281904", + "茂名": "101282001", + "高州": "101282002", + "化州": "101282003", + "电白": "101282004", + "信宜": "101282005", + "汕尾": "101282101", + "海丰": "101282102", + "陆丰": "101282103", + "遮浪": "101282104", + "东沙岛": "101282105", + "昆明": "101290101", + "昆明农试站": "101290102", + "东川": "101290103", + "寻甸": "101290104", + "晋宁": "101290105", + "宜良": "101290106", + "石林": "101290107", + "呈贡": "101290108", + "富民": "101290109", + "嵩明": "101290110", + "禄劝": "101290111", + "安宁": "101290112", + "太华山": "101290113", + "大理": "101290201", + "云龙": "101290202", + "漾鼻": "101290203", + "永平": "101290204", + "宾川": "101290205", + "弥渡": "101290206", + "祥云": "101290207", + "魏山": "101290208", + "剑川": "101290209", + "洱源": "101290210", + "鹤庆": "101290211", + "南涧": "101290212", + "红河": "101290301", + "石屏": "101290302", + "建水": "101290303", + "弥勒": "101290304", + "元阳": "101290305", + "绿春": "101290306", + "开远": "101290307", + "个旧": "101290308", + "蒙自": "101290309", + "屏边": "101290310", + "泸西": "101290311", + "金平": "101290312", + "曲靖": "101290401", + "沾益": "101290402", + "陆良": "101290403", + "富源": "101290404", + "马龙": "101290405", + "师宗": "101290406", + "罗平": "101290407", + "会泽": "101290408", + "宣威": "101290409", + "保山": "101290501", + "富宁": "101290502", + "龙陵": "101290503", + "施甸": "101290504", + "昌宁": "101290505", + "腾冲": "101290506", + "文山": "101290601", + "西畴": "101290602", + "马关": "101290603", + "麻栗坡": "101290604", + "砚山": "101290605", + "邱北": "101290606", + "广南": "101290607", + "玉溪": "101290701", + "澄江": "101290702", + "江川": "101290703", + "通海": "101290704", + "华宁": "101290705", + "新平": "101290706", + "易门": "101290707", + "峨山": "101290708", + "元江": "101290709", + "楚雄": "101290801", + "大姚": "101290802", + "元谋": "101290803", + "姚安": "101290804", + "牟定": "101290805", + "南华": "101290806", + "武定": "101290807", + "禄丰": "101290808", + "双柏": "101290809", + "永仁": "101290810", + "普洱": "101290901", + "景谷": "101290902", + "景东": "101290903", + "澜沧": "101290904", + "墨江": "101290906", + "江城": "101290907", + "孟连": "101290908", + "西盟": "101290909", + "镇源": "101290910", + "镇沅": "101290911", + "宁洱": "101290912", + "昭通": "101291001", + "鲁甸": "101291002", + "彝良": "101291003", + "镇雄": "101291004", + "威信": "101291005", + "巧家": "101291006", + "绥江": "101291007", + "永善": "101291008", + "盐津": "101291009", + "大关": "101291010", + "临沧": "101291101", + "沧源": "101291102", + "耿马": "101291103", + "双江": "101291104", + "凤庆": "101291105", + "永德": "101291106", + "云县": "101291107", + "镇康": "101291108", + "怒江": "101291201", + "福贡": "101291203", + "兰坪": "101291204", + "泸水": "101291205", + "六库": "101291206", + "贡山": "101291207", + "香格里拉": "101291301", + "德钦": "101291302", + "维西": "101291303", + "中甸": "101291304", + "丽江": "101291401", + "永胜": "101291402", + "华坪": "101291403", + "宁蒗": "101291404", + "德宏": "101291501", + "潞江坝": "101291502", + "陇川": "101291503", + "盈江": "101291504", + "畹町镇": "101291505", + "瑞丽": "101291506", + "梁河": "101291507", + "潞西": "101291508", + "景洪": "101291601", + "大勐龙": "101291602", + "勐海": "101291603", + "景洪电站": "101291604", + "勐腊": "101291605", + "南宁": "101300101", + "南宁城区": "101300102", + "邕宁": "101300103", + "横县": "101300104", + "隆安": "101300105", + "马山": "101300106", + "上林": "101300107", + "武鸣": "101300108", + "宾阳": "101300109", + "硕龙": "101300110", + "崇左": "101300201", + "天等": "101300202", + "龙州": "101300203", + "凭祥": "101300204", + "大新": "101300205", + "扶绥": "101300206", + "宁明": "101300207", + "海渊": "101300208", + "柳州": "101300301", + "柳城": "101300302", + "沙塘": "101300303", + "鹿寨": "101300304", + "柳江": "101300305", + "融安": "101300306", + "融水": "101300307", + "三江": "101300308", + "来宾": "101300401", + "忻城": "101300402", + "金秀": "101300403", + "象州": "101300404", + "武宣": "101300405", + "桂林": "101300501", + "桂林农试站": "101300502", + "龙胜": "101300503", + "永福": "101300504", + "临桂": "101300505", + "兴安": "101300506", + "灵川": "101300507", + "全州": "101300508", + "灌阳": "101300509", + "阳朔": "101300510", + "恭城": "101300511", + "平乐": "101300512", + "荔浦": "101300513", + "资源": "101300514", + "梧州": "101300601", + "藤县": "101300602", + "太平": "101300603", + "苍梧": "101300604", + "蒙山": "101300605", + "岑溪": "101300606", + "贺州": "101300701", + "昭平": "101300702", + "富川": "101300703", + "钟山": "101300704", + "信都": "101300705", + "贵港": "101300801", + "桂平": "101300802", + "平南": "101300803", + "玉林": "101300901", + "博白": "101300902", + "北流": "101300903", + "容县": "101300904", + "陆川": "101300905", + "百色": "101301001", + "那坡": "101301002", + "田阳": "101301003", + "德保": "101301004", + "靖西": "101301005", + "田东": "101301006", + "平果": "101301007", + "隆林": "101301008", + "西林": "101301009", + "乐业": "101301010", + "凌云": "101301011", + "田林": "101301012", + "钦州": "101301101", + "浦北": "101301102", + "灵山": "101301103", + "河池": "101301201", + "天峨": "101301202", + "东兰": "101301203", + "巴马": "101301204", + "环江": "101301205", + "罗城": "101301206", + "宜州": "101301207", + "凤山": "101301208", + "南丹": "101301209", + "都安": "101301210", + "北海": "101301301", + "合浦": "101301302", + "涠洲岛": "101301303", + "防城港": "101301401", + "上思": "101301402", + "板栏": "101301404", + "防城": "101301405", + "海口": "101310101", + "琼山": "101310102", + "三亚": "101310201", + "东方": "101310202", + "临高": "101310203", + "澄迈": "101310204", + "儋州": "101310205", + "昌江": "101310206", + "白沙": "101310207", + "琼中": "101310208", + "定安": "101310209", + "屯昌": "101310210", + "琼海": "101310211", + "文昌": "101310212", + "清兰": "101310213", + "保亭": "101310214", + "万宁": "101310215", + "陵水": "101310216", + "西沙": "101310217", + "珊瑚岛": "101310218", + "永署礁": "101310219", + "南沙岛": "101310220", + "乐东": "101310221", + "五指山": "101310222", + "通什": "101310223", + "香港": "101320101", + "新界": "101320103", + "中环": "101320104", + "铜锣湾": "101320105", + "澳门": "101330101", + "台北县": "101340101", + "台北市": "101340102", + "高雄": "101340201", + "大武": "101340203", + "恒春": "101340204", + "兰屿": "101340205", + "台南": "101340301", + "台中": "101340401", + "桃园": "101340501", + "新竹县": "101340601", + "新竹市": "101340602", + "公馆": "101340603", + "宜兰": "101340701", + "马公": "101340801", + "东吉屿": "101340802", + "嘉义": "101340901", + "阿里山": "101340902", + "新港": "101340904" +}; + +// 天气GET +export const WeatherGet = function (_, generator) { + var data = this.getFieldValue('data'); + var CityCode = WeatherCity[data]; + generator.definitions_['include_Weather_Forcast'] = '#include '; + generator.definitions_['var_declare_Weather_Forcast'] = 'Weather_Forcast Weather;'; + if (CityCode) { + this.setFieldValue('ok', "check"); + } else { + CityCode = 'error'; + this.setFieldValue('error', "check"); + } + + var code = "Weather.RefreshData(\"" + CityCode + "\")"; + return [code, generator.ORDER_ATOMIC]; +} + +//获取当天天气 +export const WeatherGetToday = function (_, generator) { + var type = this.getFieldValue('type'); + var code = "Weather.getToday(" + type + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +//获取预报天气 +export const WeatherGetForecast = function (_, generator) { + var type = this.getFieldValue('type'); + var date = generator.valueToCode(this, 'date', generator.ORDER_ATOMIC); + var code = "Weather.get" + type + "(" + date + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +export const mixio_mqtt_subscribe = function (_, generator) { + var server = generator.valueToCode(this, 'server', generator.ORDER_ATOMIC); + var port = generator.valueToCode(this, 'port', generator.ORDER_ATOMIC); + var mqtt_username = generator.valueToCode(this, 'mqtt_username', generator.ORDER_ATOMIC); + var mqtt_password = generator.valueToCode(this, 'mqtt_password', generator.ORDER_ATOMIC); + var project = generator.valueToCode(this, 'project', generator.ORDER_ATOMIC); + port = port.replace(/"/g, "") + generator.definitions_['include_PubSubClient'] = '#include \n'; + generator.definitions_['var_declare_PubSubClient'] = 'const char *mqtt_broker = ' + server + ';\n' + + 'const char *mqtt_username = ' + mqtt_username + ';\n' + + 'const char *mqtt_password = ' + mqtt_password + ';\n' + + 'const int mqtt_port = ' + port + ';\n' + + 'String mqtt_topic = "";\n' + + 'String mqtt_data = "";\n' + + 'boolean mqtt_status = false;\n' + + 'String project = ' + project + ';\n\n' + + + 'WiFiClient espClient;\n' + + 'PubSubClient client(espClient);\n' + + + 'void callback(char *topic, byte *payload, unsigned int length) {\n' + + ' String data = "";\n' + + ' for (int i = 0; i < length; i++) {\n' + + ' data = String(data) + String((char) payload[i]);\n' + + ' }\n' + + ' mqtt_topic = String(topic);\n' + + ' mqtt_data = data;\n' + + ' mqtt_status = true;\n' + + '}\n'; + generator.setups_['setups_PubSubClient'] = 'client.setServer(mqtt_broker, mqtt_port);\n' + + 'client.setCallback(callback);\n' + + 'while (!client.connected()) {\n' + + ' String client_id = "esp-client-";\n' + + ' client_id += String(WiFi.macAddress());\n' + + ' Serial.printf("The client %s connects to the public mqtt broker\\n", client_id.c_str());\n' + + ' if (client.connect(client_id.c_str(), mqtt_username, mqtt_password)) {\n' + + ' Serial.println("Public emqx mqtt broker connected");\n' + + ' client.publish(String(String(mqtt_username) +"/"+ String(project) +"/"+ String("b640a0ce465fa2a4150c36b305c1c11b")).c_str(),String(client_id).c_str());\n' + + ' } else {\n' + + ' Serial.print("failed with state ");\n' + + ' Serial.print(client.state());\n' + + ' delay(2000);\n' + + ' }\n' + + '}\n'; + var code = 'client.loop();\n'; + return code; +} + +export const mixio_mqtt_subscribe_key = function (_, generator) { + var key = this.getFieldValue('key'); + var server = this.getFieldValue('server'); + generator.definitions_['include_PubSubClient'] = '#include \n'; + generator.definitions_['var_declare_PubSubClient'] = 'const char *mqtt_broker = "' + server + '";\n' + + 'const char *mqtt_username = "MixIO_public";\n' + + 'const char *mqtt_password = "MixIO_public";\n' + + 'const int mqtt_port = 1883;\n' + + 'String mqtt_topic = "";\n' + + 'String mqtt_data = "";\n' + + 'boolean mqtt_status = false;\n' + + 'String project = "' + key + '";\n\n' + + + 'WiFiClient espClient;\n' + + 'PubSubClient client(espClient);\n' + + + 'void callback(char *topic, byte *payload, unsigned int length) {\n' + + ' String data = "";\n' + + ' for (int i = 0; i < length; i++) {\n' + + ' data = String(data) + String((char) payload[i]);\n' + + ' }\n' + + ' mqtt_topic = String(topic);\n' + + ' mqtt_data = data;\n' + + ' mqtt_status = true;\n' + + '}\n'; + generator.setups_['setups_PubSubClient'] = 'client.setServer(mqtt_broker, mqtt_port);\n' + + 'client.setCallback(callback);\n' + + 'while (!client.connected()) {\n' + + ' String client_id = "esp-client-";\n' + + ' client_id += String(WiFi.macAddress());\n' + + ' Serial.printf("The client %s connects to the public mqtt broker\\n", client_id.c_str());\n' + + ' if (client.connect(client_id.c_str(), mqtt_username, mqtt_password)) {\n' + + ' Serial.println("Public emqx mqtt broker connected");\n' + + ' client.publish(String(String(mqtt_username) +"/"+ String(project) +"/"+ String("b640a0ce465fa2a4150c36b305c1c11b")).c_str(),String(client_id).c_str());\n' + + ' } else {\n' + + ' Serial.print("failed with state ");\n' + + ' Serial.print(client.state());\n' + + ' delay(2000);\n' + + ' }\n' + + '}\n'; + var code = 'client.loop();\n'; + return code; +} + +export const mixio_mqtt_publish = function (_, generator) { + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var topic = generator.valueToCode(this, 'topic', generator.ORDER_ATOMIC); + var mode = this.getFieldValue('mode'); + if (mode == 1) { + var code = 'client.publish(String(String(mqtt_username) +"/"+ String(project) +"/"+ String(' + topic + ')).c_str(),String(' + data + ').c_str());\n'; + } + if (mode == 2) { + var code = 'client.publish(String("MixIO/"+ String(project) +"/default/"+ String(' + topic + ')).c_str(),String(' + data + ').c_str());\n'; + } + return code; +} + +export const mixio_mqtt_received_the_news = function (_, generator) { + var mode = this.getFieldValue('mode'); + var topic = generator.valueToCode(this, 'topic', generator.ORDER_ATOMIC); + var branch = generator.statementToCode(this, 'function'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + if (mode == 1) { + generator.setups_['setups_topic_' + topic + ''] = 'client.subscribe(String(String(mqtt_username) +"/"+ String(project) +"/"+ String(' + topic + ')).c_str());' + var code = 'if (mqtt_status) {\n' + + ' if (String(mqtt_topic).equals(String(String(mqtt_username) +"/"+ String(project) +"/"+ String(' + topic + ')))) {\n' + + ' ' + branch + '\n' + + ' mqtt_status = false;\n' + + ' }\n' + + '}\n' + } + if (mode == 2) { + generator.setups_['setups_topic_' + topic + ''] = 'client.subscribe(String("MixIO/"+ String(project) +"/default/"+ String(' + topic + ')).c_str());' + var code = 'if (mqtt_status) {\n' + + ' if (String(mqtt_topic).equals(String("MixIO/"+ String(project) +"/default/"+ String(' + topic + ')).c_str())) {\n' + + ' ' + branch + '\n' + + ' mqtt_status = false;\n' + + ' }\n' + + '}\n' + } + return code; +} + +export const asyncelegantota = function (_, generator) { + var board_type = JSFuncs.getPlatform(); + if (board_type.match(RegExp(/ESP8266/))) { + generator.definitions_['include_ESPAsyncTCP'] = '#include '; + } else { + generator.definitions_['include_AsyncTCP'] = '#include '; + } + generator.definitions_['include_ESPAsyncWebServer'] = '#include '; + generator.definitions_['include_AsyncElegantOTA'] = '#include \n'; + generator.definitions_['var_AsyncWebServer'] = 'AsyncWebServer server(80);\n'; + generator.setups_['setups_AsyncWebServer'] = 'AsyncElegantOTA.begin(&server);\n' + + 'server.begin();\n'; + var code = ''; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/factory.js b/mixly/boards/default_src/arduino_avr/generators/factory.js new file mode 100644 index 00000000..7dedd472 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/factory.js @@ -0,0 +1,117 @@ +export const factory_include = function (_, generator) { + var INCLUDE = this.getFieldValue('INCLUDE'); + generator.definitions_['include_' + INCLUDE] = '#include <' + INCLUDE + '.h>'; + return ''; +} + +export const factory_function_noreturn = function (_, generator) { + var NAME = this.getFieldValue('NAME'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return NAME + '(' + code.join(', ') + ');\n'; +} + +export const factory_function_return = function (_, generator) { + var NAME = this.getFieldValue('NAME'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return [NAME + '(' + code.join(', ') + ')', generator.ORDER_ATOMIC]; +} + +export const factory_declare = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + var NAME = this.getFieldValue('NAME'); + generator.definitions_['var_' + TYPE + '_' + NAME] = TYPE + ' ' + NAME + ';'; + return ''; +} + +export const factory_declare2 = function (_, generator) { + var VALUE = this.getFieldValue('VALUE'); + generator.definitions_['var_' + VALUE] = VALUE; + return ''; +} + +export const factory_define = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + if (TYPE.substr(0, 1) == '#') + TYPE = TYPE.substr(1); + var NAME = this.getFieldValue('NAME'); + generator.definitions_["define_" + TYPE + '_' + NAME] = '#' + TYPE + ' ' + NAME; + return ''; +} + +export const factory_static_method_noreturn = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + var NAME = this.getFieldValue('NAME'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return TYPE + '::' + NAME + '(' + code.join(', ') + ');\n'; +} + +export const factory_static_method_return = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + var NAME = this.getFieldValue('NAME'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return [TYPE + '::' + NAME + '(' + code.join(', ') + ')', generator.ORDER_ATOMIC]; +} + +export const factory_callMethod_noreturn = function (_, generator) { + var NAME = this.getFieldValue('NAME'); + var METHOD = this.getFieldValue('METHOD'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return NAME + '.' + METHOD + '(' + code.join(', ') + ');\n'; +} + +export const factory_callMethod_return = function (_, generator) { + var NAME = this.getFieldValue('NAME'); + var METHOD = this.getFieldValue('METHOD'); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || 'NULL'; + } + return [NAME + '.' + METHOD + '(' + code.join(', ') + ')', generator.ORDER_ATOMIC]; +} + +export const factory_block = function () { + var VALUE = this.getFieldValue('VALUE'); + //if(!(VALUE.charAt(VALUE.length-1)==";")){ + //VALUE=VALUE+';'; + //} + return VALUE + '\n'; +} + +export const factory_block_return = function (_, generator) { + var VALUE = this.getFieldValue('VALUE'); + return [VALUE, generator.ORDER_ATOMIC]; +} + +export const factory_block_with_textarea = function () { + var VALUE = this.getFieldValue('VALUE'); + //if(!(VALUE.charAt(VALUE.length-1)==";")){ + //VALUE=VALUE+';'; + //} + return VALUE + '\n'; +} + +export const factory_block_return_with_textarea = function (_, generator) { + var VALUE = this.getFieldValue('VALUE'); + return [VALUE, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/inout.js b/mixly/boards/default_src/arduino_avr/generators/inout.js new file mode 100644 index 00000000..5b9c19e5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/inout.js @@ -0,0 +1,259 @@ +import { Profile } from 'mixly'; + +export const inout_highlow = function (_, generator) { + // Boolean values HIGH and LOW. + var code = (this.getFieldValue('BOOL') == 'HIGH') ? 'HIGH' : 'LOW'; + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_pinMode = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('MODE'); + // + var code = 'pinMode(' + dropdown_pin + ', ' + dropdown_mode + ');\n'; + return code; +} + +export const inout_digital_write2 = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_stat = generator.valueToCode(this, 'STAT', generator.ORDER_ATOMIC); + var code = ""; + var isVar = true; + for (var pin of Profile.default.digital) { + if (pin[1] === dropdown_pin) { + isVar = false; + break; + } + } + if (isVar) { + code = code + 'pinMode(' + dropdown_pin + ', OUTPUT);\n'; + } else { + if (generator.setups_['setup_input_' + dropdown_pin]) { + delete generator.setups_['setup_input_' + dropdown_pin]; + } + generator.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + } + code += 'digitalWrite(' + dropdown_pin + ', ' + dropdown_stat + ');\n' + return code; +} + +export const inout_digital_read = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + var code = 'digitalRead(' + dropdown_pin + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_digital_read2 = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = 'digitalRead(' + dropdown_pin + ')'; + var isVar = true; + for (var pin of Profile.default.digital) { + if (pin[1] === dropdown_pin) { + isVar = false; + break; + } + } + if (!isVar) { + if (!generator.setups_['setup_output_' + dropdown_pin]) { + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + } + if (generator.setups_['setup_setup']) { //解决pullup重复问题 + if (generator.setups_['setup_setup'].indexOf('pinMode(' + dropdown_pin) > -1) { + delete generator.setups_['setup_input_' + dropdown_pin]; + } + } + } + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_analog_write = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + //var dropdown_stat = this.getFieldValue('STAT'); + var value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + const { pwm } = Profile.default; + if (typeof pwm === 'object') { + for (let i of pwm) + if (dropdown_pin === i[1]) { + generator.setups_['setup_output' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);'; + break; + } + } + var code = 'analogWrite(' + dropdown_pin + ', ' + value_num + ');\n'; + return code; +} + +export const inout_analog_read = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + const { analog } = Profile.default; + if (typeof analog === 'object') { + for (let i of analog) + if (dropdown_pin === i[1]) { + //generator.setups_['setup_output' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + break; + } + } + var code = 'analogRead(' + dropdown_pin + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_buildin_led = function (_, generator) { + var dropdown_stat = this.getFieldValue('STAT'); + generator.setups_['setup_output_13'] = 'pinMode(13, OUTPUT);'; + var code = 'digitalWrite(13, ' + dropdown_stat + ');\n' + return code; +} + +export const OneButton_interrupt = function (_, generator) { + generator.definitions_['include_OneButton'] = '#include '; + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('mode'); + var dropdown_stat = generator.valueToCode(this, 'STAT', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_button' + dropdown_pin] = 'OneButton button' + dropdown_pin + '(' + dropdown_pin + ', ' + ((dropdown_stat == 'HIGH') ? 'false' : 'true') + ');'; + generator.setups_['setup_onebutton_' + dropdown_pin + dropdown_mode] = 'button' + dropdown_pin + '.' + dropdown_mode + '(' + dropdown_mode + dropdown_pin + ');'; + var code = 'button' + dropdown_pin + '.tick();'; + var funcName = dropdown_mode + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const controls_attachInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('mode'); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT_PULLUP);'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')'; + var code = 'attachInterrupt' + '(' + interrupt_pin + ',' + 'attachInterrupt_fun_' + dropdown_mode + '_' + dropdown_pin + ', ' + dropdown_mode + ');\n' + var funcName = 'attachInterrupt_fun_' + dropdown_mode + '_' + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const controls_detachInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')'; + var code = 'detachInterrupt' + '(' + interrupt_pin + ');\n' + return code; +} + +export const controls_attachPinInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('mode'); + generator.definitions_['include_PinChangeInterrupt'] = '#include '; + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var code = 'attachPCINT(digitalPinToPCINT(' + dropdown_pin + '),' + 'attachPinInterrupt_fun_' + dropdown_mode + '_' + dropdown_pin + ', ' + dropdown_mode + ');\n' + var funcName = 'attachPinInterrupt_fun_' + dropdown_mode + '_' + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const controls_detachPinInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var code = 'detachPCINT(digitalPinToPCINT(' + dropdown_pin + '));\n' + return code; +} + + +export const inout_pulseIn = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_stat = this.getFieldValue('STAT'); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + var code = 'pulseIn(' + dropdown_pin + ', ' + dropdown_stat + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_pulseIn2 = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_stat = this.getFieldValue('STAT'); + var timeout = generator.valueToCode(this, 'TIMEOUT', generator.ORDER_ATOMIC) || '0'; + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);'; + var code = 'pulseIn(' + dropdown_pin + ', ' + dropdown_stat + ', ' + timeout + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const inout_shiftout = function (_, generator) { + var dropdown_pin1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var dropdown_pin2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var dropdown_order = this.getFieldValue('ORDER'); + var value = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.setups_['setup_output_' + dropdown_pin1] = 'pinMode(' + dropdown_pin1 + ', OUTPUT);'; + generator.setups_['setup_output_' + dropdown_pin2] = 'pinMode(' + dropdown_pin2 + ', OUTPUT);'; + var code = 'shiftOut(' + dropdown_pin1 + ', ' + dropdown_pin2 + ', ' + dropdown_order + ', ' + value + ');\n' + return code; +} + +export const ESP32touchButton = function (_, generator) { + generator.definitions_['include_ESP32touchButton'] = '#include '; + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('mode'); + generator.definitions_['var_declare_button' + dropdown_pin] = 'ESP32touchButton button' + dropdown_pin + '(' + dropdown_pin + ', true);'; + generator.setups_['setup_onebutton_' + dropdown_pin + dropdown_mode] = 'button' + dropdown_pin + '.' + dropdown_mode + '(' + dropdown_mode + dropdown_pin + ');'; + var code = 'button' + dropdown_pin + '.tick();'; + var funcName = dropdown_mode + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const inout_soft_analog_write = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var value_num = generator.valueToCode(this, 'NUM', generator.ORDER_ATOMIC); + generator.definitions_['include_SoftPWM'] = '#include '; + generator.setups_['setup_soft_analog_write'] = 'SoftPWMBegin();'; + var code = 'SoftPWMSet(' + dropdown_pin + ', ' + value_num + ');\n'; + return code; +} + +export const inout_cancel_soft_analog_write = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + generator.definitions_['include_SoftPWM'] = '#include '; + generator.setups_['setup_soft_analog_write'] = 'SoftPWMBegin();'; + var code = 'SoftPWMEnd(' + dropdown_pin + ');\n'; + return code; +} + +// ADS1015模数转换模块 设置范围以及精度 +export const ADS1015_setGain = function (_, generator) { + var GAIN = this.getFieldValue('ADS1015_setGain'); + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_Adafruit_ADS1015'] = '#include '; + generator.definitions_['var_declare_Adafruit_ADS1015_ads'] = 'Adafruit_ADS1015 ads;\n'; + generator.setups_['setup_ads.begin()'] = 'ads.begin();\n'; + generator.setups_['setup_ads.setGain'] = 'ads.setGain(' + GAIN + ');'; + var code = ''; + return code; +} + +// ADS1015模数转换模块 采集数值 +export const ADS1015_Get_Value = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_Adafruit_ADS1015'] = '#include '; + generator.definitions_['var_declare_Adafruit_ADS1015_ads'] = 'Adafruit_ADS1015 ads;\n'; + generator.setups_['setup_ads.begin()'] = 'ads.begin();'; + var dropdown_type = this.getFieldValue('ADS1015_AIN'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +// PCF8591T模数转换模块 采集数值 +export const PCF8591T = function (_, generator) { + //generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_PCF8591_h'] = '#include '; + generator.definitions_['var_declare_PCF8591'] = 'PCF8591 pcf8591(0x48);'; + generator.setups_['setup_pcf8591.begin()'] = 'pcf8591.begin();\n'; + var dropdown_type = this.getFieldValue('PCF8591T_AIN'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/lists.js b/mixly/boards/default_src/arduino_avr/generators/lists.js new file mode 100644 index 00000000..f4e9ead8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/lists.js @@ -0,0 +1,283 @@ +import { Variables } from 'blockly/core'; + +export const lists_create_with = function (_, generator) { + // Create a list with any number of elements of any type. + var dropdown_type = this.getFieldValue('TYPE'); + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var size = window.parseFloat(this.getFieldValue('SIZE')); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || '0'; + } + generator.definitions_['var_declare' + varName] = dropdown_type + ' ' + varName + '[' + size + ']' + '=' + '{' + code.join(', ') + '};\n'; + return ''; +} + +export const lists_create_with_text = function (_, generator) { + var dropdown_type = this.getFieldValue('TYPE'); + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var size = window.parseFloat(this.getFieldValue('SIZE')); + var text = this.getFieldValue('TEXT'); + generator.definitions_['var_declare' + varName] = dropdown_type + ' ' + varName + '[' + size + ']' + '=' + '{' + text + '};\n'; + return ''; +} + +export const lists_create_with2 = function (_, generator) { + // Create a list with any number of elements of any type. + var dropdown_type = this.getFieldValue('TYPE'); + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + //var size=window.parseFloat(this.getFieldValue('SIZE')); + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || '0'; + } + generator.definitions_['var_declare' + varName] = dropdown_type + ' ' + varName + '[]' + '=' + '{' + code.join(', ') + '};\n'; + return ''; +} + +export const lists_create_with_text2 = function (_, generator) { + var dropdown_type = this.getFieldValue('TYPE'); + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var size = window.parseFloat(this.getFieldValue('SIZE')) || ''; + var text = this.getFieldValue('TEXT'); + generator.definitions_['var_declare' + varName] = dropdown_type + ' ' + varName + '[' + size + ']' + '=' + '{' + text + '};\n'; + return ''; +} + +export const lists_getIndex = function (_, generator) { + // Indexing into a list is the same as indexing into a string. + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var argument0 = generator.valueToCode(this, 'AT', + generator.ORDER_ADDITIVE) || '1'; + if (argument0.match(/^\d+$/)) { + // If the index is a naked number, decrement it right now. + argument0 = parseInt(argument0, 10) - 1; + } else { + // If the index is dynamic, decrement it in code. + argument0 += ' - 1'; + } + var code = varName + '[(int)(' + argument0 + ')]'; + return [code, generator.ORDER_ATOMIC]; +} + +export const lists_setIndex = function (_, generator) { + // Set element at index. + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var argument0 = generator.valueToCode(this, 'AT', + generator.ORDER_ADDITIVE) || '1'; + var argument2 = generator.valueToCode(this, 'TO', + generator.ORDER_ASSIGNMENT) || '0'; + // Blockly uses one-based indicies. + if (argument0.match(/^\d+$/)) { + // If the index is a naked number, decrement it right now. + argument0 = parseInt(argument0, 10) - 1; + } else { + // If the index is dynamic, decrement it in code. + argument0 += ' - 1'; + } + return varName + '[(int)(' + argument0 + ')] = ' + argument2 + ';\n'; +} + +export const listsGetValueByIndex = function (_, generator) { + // Indexing into a list is the same as indexing into a string. + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var argument0 = generator.valueToCode(this, 'AT', + generator.ORDER_ADDITIVE) || '0'; + var code = varName + '[' + argument0 + ']'; + return [code, generator.ORDER_ATOMIC]; +} + +export const listsSetValueByIndex = function (_, generator) { + // Set element at index. + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var argument0 = generator.valueToCode(this, 'AT', + generator.ORDER_ADDITIVE) || '0'; + var argument2 = generator.valueToCode(this, 'TO', + generator.ORDER_ASSIGNMENT) || '0'; + return varName + '[' + argument0 + '] = ' + argument2 + ';\n'; +} + +export const lists_length = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), + Variables.NAME_TYPE); + var code = 'sizeof(' + varName + ')/sizeof(' + varName + '[0])'; + return [code, generator.ORDER_ATOMIC]; +} + +// 创建二维数组 +export const create_array2_with_text = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + var line = generator.valueToCode(this, 'line', generator.ORDER_ATOMIC); + var list = generator.valueToCode(this, 'list', generator.ORDER_ATOMIC); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var String = generator.valueToCode(this, 'String', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_array' + name] = '' + TYPE + ' ' + name + '[' + line + '][' + list + ']={' + String + '};\n '; + return ''; +} + +// 二维数组赋值 +export const array2_assignment = function (_, generator) { + var line = generator.valueToCode(this, 'line', generator.ORDER_ATOMIC); + var list = generator.valueToCode(this, 'list', generator.ORDER_ATOMIC); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var assignment = generator.valueToCode(this, 'assignment', generator.ORDER_ATOMIC); + var code = '' + name + '[' + line + '-1][' + list + '-1]=' + assignment + ';\n' + return code; +} + +// 获取二维数组值 +export const get_array2_value = function (_, generator) { + var line = generator.valueToCode(this, 'line', generator.ORDER_ATOMIC); + var list = generator.valueToCode(this, 'list', generator.ORDER_ATOMIC); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var code = '' + name + '[' + line + '-1][' + list + '-1]' + return [code, generator.ORDER_ATOMIC]; +} + +// 二维数组赋值 +export const lists2SetValueByIndex = function (_, generator) { + var line = generator.valueToCode(this, 'line', generator.ORDER_ATOMIC); + var list = generator.valueToCode(this, 'list', generator.ORDER_ATOMIC); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var assignment = generator.valueToCode(this, 'assignment', generator.ORDER_ATOMIC); + var code = name + '[' + line + '][' + list + '] = ' + assignment + ';\n' + return code; +} + +// 二维数组取值 +export const lists2GetValueByIndex = function (_, generator) { + var line = generator.valueToCode(this, 'line', generator.ORDER_ATOMIC); + var list = generator.valueToCode(this, 'list', generator.ORDER_ATOMIC); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var code = name + '[' + line + '][' + list + ']'; + return [code, generator.ORDER_ATOMIC]; +} + +export const lists_array2_setup = function (_, generator) { + var dropdown_lists_create_type = this.getFieldValue('lists_create_type'); + var text_lists_create_name = this.getFieldValue('lists_create_name'); + var statements_lists_with_2_1_data = generator.statementToCode(this, 'lists_with_2_1_data'); + + if (statements_lists_with_2_1_data) { + var num_x = 0; + var num_y_data = ''; + var num_y = 0; + var data = ''; + var choice = false; + var statements_lists_with_2_1_data1 = ''; + statements_lists_with_2_1_data = statements_lists_with_2_1_data.substring(2, statements_lists_with_2_1_data.length - 1); + for (var i of statements_lists_with_2_1_data) { + if (i == '→') { + statements_lists_with_2_1_data1 += '\n '; + choice = true; + continue; + } + if (choice) { + if (i == '{') { + if (num_y < num_y_data - 0) + num_y = num_y_data - 0; + num_y_data = ''; + choice = false; + } + else { + num_y_data = num_y_data + i; + continue; + } + } + data = data + i; + if (data == '},{') + num_x++; + if (data.length == 3) { + data = data.substring(1, 2) + i; + } + statements_lists_with_2_1_data1 = statements_lists_with_2_1_data1 + i; + } + num_x++; + generator.definitions_['var_declare' + text_lists_create_name] = dropdown_lists_create_type + ' ' + text_lists_create_name + '[' + num_x + '][' + num_y + '] = {' + statements_lists_with_2_1_data1 + '\n};'; + } + else { + if (dropdown_lists_create_type == 'String') + generator.definitions_['var_declare' + text_lists_create_name] = dropdown_lists_create_type + ' ' + text_lists_create_name + '[2][2] = {{"0","0"},{"0","0"}};'; + else + generator.definitions_['var_declare' + text_lists_create_name] = dropdown_lists_create_type + ' ' + text_lists_create_name + '[2][2] = {{0,0},{0,0}};'; + } + + var code = ''; + return code; +} + +export const lists_array2_setup_get_data = function (_, generator) { + // Create a list with any number of elements of any type. + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || '0'; + } + var code1 = ''; + var surround_parent = this.getSurroundParent(); + if (surround_parent && surround_parent.type == 'lists_array2_setup') { + for (var n = 0; n < this.itemCount_; n++) { + code1 = code1 + ', ' + code[n]; + } + code1 = code1.substring(2); + code1 = '→' + this.itemCount_ + '{' + code1 + '},'; + } + else if (surround_parent && surround_parent.type == 'part_lists_create_with_2_1') { + for (var n = 0; n < this.itemCount_; n++) { + code1 = code1 + ', ' + code[n]; + } + code1 = code1.substring(2); + code1 = '→' + this.itemCount_ + '{' + code1 + '},'; + } + else if (surround_parent && surround_parent.type == 'lists_create_with_2_1_new_2019_10_18') { + for (var n = 0; n < this.itemCount_; n++) { + code1 = code1 + ', ' + code[n]; + } + code1 = code1.substring(2); + code1 = '→' + this.itemCount_ + '{' + code1 + '},'; + } + else if (surround_parent && surround_parent.type == 'part_lists_create_with_2_1_new_2019_10_18') { + for (var n = 0; n < this.itemCount_; n++) { + code1 = code1 + ', ' + code[n]; + } + code1 = code1.substring(2); + code1 = '→' + this.itemCount_ + '{' + code1 + '},'; + } + else { + code1 = ''; + } + return code1; +} + +import FUNC_ARRAY_ROTATE_LOOP_TEMPLATE from '../templates/func-array-rotate-loop.c'; + +// 一维数组循环 +export const loop_array = function (_, generator) { + var mode = this.getFieldValue('mode'); + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + generator.definitions_['function_array_rotate_loop'] = FUNC_ARRAY_ROTATE_LOOP_TEMPLATE; + var code = `array_rotate_loop(${name}, sizeof(${name}[0]), sizeof(${name}) / sizeof(${name}[0]), ${mode});\n`; + return code; +} + +// 获取二维数组的行数与列数 +export const lists_array2_get_length = function (_, generator) { + var text_list_name = this.getFieldValue('list_name'); + var dropdown_type = this.getFieldValue('type'); + var code = ''; + if (dropdown_type == 'col') + code = '(sizeof(' + text_list_name + '[0]) / sizeof(' + text_list_name + '[0][0]))'; + else + code = '(sizeof(' + text_list_name + ') / sizeof(' + text_list_name + '[0]))'; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/logic.js b/mixly/boards/default_src/arduino_avr/generators/logic.js new file mode 100644 index 00000000..bbefc2ff --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/logic.js @@ -0,0 +1,58 @@ +export const logic_compare = function (_, generator) { + // Comparison operator. + var mode = this.getFieldValue('OP'); + var operator = logic_compare.OPERATORS[mode]; + var order = (operator == '==' || operator == '!=') ? + generator.ORDER_EQUALITY : generator.ORDER_RELATIONAL; + var argument0 = generator.valueToCode(this, 'A', order) || '0'; + var argument1 = generator.valueToCode(this, 'B', order) || '0'; + var code = argument0 + ' ' + operator + ' ' + argument1; + return [code, order]; +} + +logic_compare.OPERATORS = { + EQ: '==', + NEQ: '!=', + LT: '<', + LTE: '<=', + GT: '>', + GTE: '>=' +}; + +export const logic_operation = function (_, generator) { + // Operations 'and', 'or'. + var operator = (this.getFieldValue('OP') == 'AND') ? '&&' : '||'; + var order = (operator == '&&') ? generator.ORDER_LOGICAL_AND : + generator.ORDER_LOGICAL_OR; + var argument0 = generator.valueToCode(this, 'A', order) || 'false'; + var argument1 = generator.valueToCode(this, 'B', order) || 'false'; + var code = argument0 + ' ' + operator + ' ' + argument1; + return [code, order]; +} + +export const logic_negate = function (_, generator) { + // Negation. + var order = generator.ORDER_UNARY_PREFIX; + var argument0 = generator.valueToCode(this, 'BOOL', order) || 'false'; + var code = '!' + argument0; + return [code, order]; +} + +export const logic_boolean = function (_, generator) { + // Boolean values true and false. + var code = (this.getFieldValue('BOOL') == 'TRUE') ? 'true' : 'false'; + return [code, generator.ORDER_ATOMIC]; +} + +export const logic_null = function (_, generator) { + var code = 'NULL'; + return [code, generator.ORDER_ATOMIC]; +} + +export const logic_true_or_false = function (_, generator) { + var a = generator.valueToCode(this, 'A', generator.ORDER_ATOMIC) || 'false'; + var b = generator.valueToCode(this, 'B', generator.ORDER_ATOMIC) || 'false'; + var c = generator.valueToCode(this, 'C', generator.ORDER_ATOMIC) || 'false'; + var code = '(' + a + '?' + b + ':' + c + ')'; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/math.js b/mixly/boards/default_src/arduino_avr/generators/math.js new file mode 100644 index 00000000..e8de8607 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/math.js @@ -0,0 +1,239 @@ +export const math_number = function (_, generator) { + // Numeric value. + var code = (this.getFieldValue('NUM')); + // -4.abs() returns -4 in Dart due to strange order of operation choices. + // -4 is actually an operator and a number. Reflect this in the order. + var order = code < 0 ? + generator.ORDER_UNARY_PREFIX : generator.ORDER_ATOMIC; + return [code, order]; +} + +export const math_arithmetic = function (_, generator) { + // Basic arithmetic operators, and power. + const OPERATORS = { + ADD: [' + ', generator.ORDER_ADDITIVE], + MINUS: [' - ', generator.ORDER_ADDITIVE], + MULTIPLY: [' * ', generator.ORDER_MULTIPLICATIVE], + DIVIDE: [' / ', generator.ORDER_MULTIPLICATIVE], + QUYU: [' % ', generator.ORDER_MULTIPLICATIVE],//增加取余操作 + POWER: [null, generator.ORDER_NONE] // Handle power separately. + }; + var mode = this.getFieldValue('OP'); + var tuple = OPERATORS[mode]; + var operator = tuple[0]; + var order = tuple[1]; + var argument0 = generator.valueToCode(this, 'A', order) || '0'; + var argument1 = generator.valueToCode(this, 'B', order) || '0'; + var code; + if (!operator) { + code = 'pow(' + argument0 + ', ' + argument1 + ')'; + return [code, generator.ORDER_UNARY_POSTFIX]; + } + if (operator == ' % ') { + //取余必须是整数 + argument0 = '(long) (' + argument0 + ')'; + argument1 = '(long) (' + argument1 + ')'; + } + code = argument0 + operator + argument1; + return [code, order]; +} + +export const math_bit = function (_, generator) { + var operator = this.getFieldValue('OP'); + var order = generator.ORDER_ATOMIC; + var argument0 = generator.valueToCode(this, 'A', order) || '0'; + var argument1 = generator.valueToCode(this, 'B', order) || '0'; + var code = '(' + argument0 + operator + argument1 + ')'; + return [code, order]; +} + +export const math_single = function (_, generator) { + // Math operators with single operand. + var operator = this.getFieldValue('OP'); + var code; + var arg; + if (operator == 'NEG') { + // Negation is a special case given its different operator precedents. + arg = generator.valueToCode(this, 'NUM', + generator.ORDER_UNARY_PREFIX) || '0'; + if (arg[0] == '-') { + // --3 is not legal in Dart. + arg = ' ' + arg; + } + code = '-' + arg; + return [code, generator.ORDER_UNARY_PREFIX]; + } + if (operator == 'ABS' || operator.substring(0, 5) == 'ROUND') { + arg = generator.valueToCode(this, 'NUM', + generator.ORDER_UNARY_POSTFIX) || '0'; + } else if (operator == 'SIN' || operator == 'COS' || operator == 'TAN') { + arg = generator.valueToCode(this, 'NUM', + generator.ORDER_MULTIPLICATIVE) || '0'; + } else { + arg = generator.valueToCode(this, 'NUM', + generator.ORDER_NONE) || '0'; + } + // First, handle cases which generate values that don't need parentheses. + switch (operator) { + case 'ABS': + code = arg + '.abs()'; + break; + case 'ROOT': + code = 'sqrt(' + arg + ')'; + break; + case 'LN': + code = 'log(' + arg + ')'; + break; + case 'EXP': + code = 'exp(' + arg + ')'; + break; + case 'POW10': + code = 'pow(10,' + arg + ')'; + break; + case '++': + code = '(++' + arg + ')'; + break; + case '--': + code = '(--' + arg + ')'; + break; + case '~': + code = '~(' + arg + ')'; + break; + case 'ROUND': + code = arg + '.round()'; + break; + case 'ROUNDUP': + code = arg + '.ceil()'; + break; + case 'ROUNDDOWN': + code = arg + '.floor()'; + break; + case 'SIN': + code = 'sin(' + arg + ' / 180.0 * 3.14159)'; + break; + case 'COS': + code = 'cos(' + arg + ' / 180.0 * 3.14159)'; + break; + case 'TAN': + code = 'tan(' + arg + ' / 180.0 * 3.14159)'; + break; + } + if (code) { + return [code, generator.ORDER_UNARY_POSTFIX]; + } + // Second, handle cases which generate values that may need parentheses. + switch (operator) { + case 'LOG10': + code = 'log(' + arg + ') / log(10)'; + break; + case 'ASIN': + code = 'asin(' + arg + ') / 3.14159 * 180'; + break; + case 'ACOS': + code = 'acos(' + arg + ') / 3.14159 * 180'; + break; + case 'ATAN': + code = 'atan(' + arg + ') / 3.14159 * 180'; + break; + default: + throw 'Unknown math operator: ' + operator; + } + return [code, generator.ORDER_MULTIPLICATIVE]; +} + +export const math_trig = math_single; + +export const math_to_int = function (_, generator) { + var argument0 = generator.valueToCode(this, 'A', generator.ORDER_NONE) || '0'; + var operator = this.getFieldValue('OP'); + var code = operator + '(' + argument0 + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +// 变量定义 +export const arduino_variate_type = function (_, generator) { + var dropdown_variate_type = this.getFieldValue('variate_type'); + var code = dropdown_variate_type; + return [code, generator.ORDER_ATOMIC]; +} + +// 获取某个变量在内存中所占用的字节数 +export const math_SizeOf = function (_, generator) { + this.setTooltip("以字节形式返回某个操作数的储存大小"); + var value_data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var code = 'sizeof(' + value_data + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const math_max_min = function (_, generator) { + var a = generator.valueToCode(this, 'A', generator.ORDER_NONE) || '0'; + var b = generator.valueToCode(this, 'B', generator.ORDER_NONE) || '0'; + var operator = this.getFieldValue('OP'); + var code = operator + '(' + a + ', ' + b + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const math_random_seed = function (_, generator) { + // Random integer between [X] and [Y]. + var a = generator.valueToCode(this, 'NUM', generator.ORDER_NONE) || '0'; + //generator.setups_['setup_randomSeed'] ='randomSeed(' + a + ');'+'\n'; + return 'randomSeed(' + a + ');' + '\n'; +} + +export const math_random_int = function (_, generator) { + // Random integer between [X] and [Y]. + var argument0 = generator.valueToCode(this, 'FROM', + generator.ORDER_NONE) || '0'; + var argument1 = generator.valueToCode(this, 'TO', + generator.ORDER_NONE) || '0'; + var code = 'random(' + argument0 + ', ' + argument1 + ')'; + return [code, generator.ORDER_UNARY_POSTFIX]; +} + +export const base_map = function (_, generator) { + var dropdown_maptype = this.getFieldValue('maptype'); + var value_num = generator.valueToCode(this, 'NUM', generator.ORDER_NONE); + var value_fl = generator.valueToCode(this, 'fromLow', generator.ORDER_ATOMIC); + var value_fh = generator.valueToCode(this, 'fromHigh', generator.ORDER_ATOMIC); + var value_tl = generator.valueToCode(this, 'toLow', generator.ORDER_ATOMIC); + var value_th = generator.valueToCode(this, 'toHigh', generator.ORDER_ATOMIC); + if (dropdown_maptype == 'map_float') { + generator.definitions_['function_mapfloat'] = 'float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)' + + '\n{' + + '\n return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;' + + '\n}'; + var code = 'mapfloat(' + value_num + ', ' + value_fl + ', ' + value_fh + ', ' + value_tl + ', ' + value_th + ')'; + } + else { + var code = 'map(' + value_num + ', ' + value_fl + ', ' + value_fh + ', ' + value_tl + ', ' + value_th + ')'; + } + return [code, generator.ORDER_NONE]; +} + +export const math_constrain = function (_, generator) { + // Constrain a number between two limits. + var argument0 = generator.valueToCode(this, 'VALUE', + generator.ORDER_NONE) || '0'; + var argument1 = generator.valueToCode(this, 'LOW', + generator.ORDER_NONE) || '0'; + var argument2 = generator.valueToCode(this, 'HIGH', + generator.ORDER_NONE) || '0'; + var code = 'constrain(' + argument0 + ', ' + argument1 + ', ' + + argument2 + ')'; + return [code, generator.ORDER_UNARY_POSTFIX]; +} + +export const variables_operation = function (_, generator) { + var type = this.getFieldValue('type'); + var variables = generator.valueToCode(this, 'variables', generator.ORDER_ATOMIC); + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var code = '' + variables + ' = ' + variables + ' ' + type + ' ' + data + ';\n'; + return code; +} + +export const math_auto_add_or_minus = function (_, generator) { + var value_math_auto_add_minus_output = generator.valueToCode(this, 'math_auto_add_minus_output', generator.ORDER_ATOMIC); + var dropdown_math_auto_add_minus_type = this.getFieldValue('math_auto_add_minus_type'); + var code = value_math_auto_add_minus_output + dropdown_math_auto_add_minus_type + ';\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/pinout.js b/mixly/boards/default_src/arduino_avr/generators/pinout.js new file mode 100644 index 00000000..277fe95e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/pinout.js @@ -0,0 +1,8 @@ +export const uno_pin = function () { + return ''; +} + +export const nano_pin = uno_pin; +export const mega_pin = uno_pin; +export const promini_pin = uno_pin; +export const leonardo_pin = uno_pin; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/pins.js b/mixly/boards/default_src/arduino_avr/generators/pins.js new file mode 100644 index 00000000..ee8bc952 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/pins.js @@ -0,0 +1,13 @@ +export const pins_digital = function (_, generator) { + var code = this.getFieldValue('PIN'); + return [code, generator.ORDER_ATOMIC]; +} + +export const pins_analog = pins_digital; +export const pins_pwm = pins_digital; +export const pins_interrupt = pins_digital; +export const pins_MOSI = pins_digital; +export const pins_MISO = pins_digital; +export const pins_SCK = pins_digital; +export const pins_SCL = pins_digital; +export const pins_SDA = pins_digital; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/scoop.js b/mixly/boards/default_src/arduino_avr/generators/scoop.js new file mode 100644 index 00000000..d8882567 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/scoop.js @@ -0,0 +1,30 @@ +export const SCoopTask = function (_, generator) { + var _tasknum = this.getFieldValue('_tasknum'); + var statements_setup = generator.statementToCode(this, 'setup'); + var statements_loop = generator.statementToCode(this, 'loop'); + var taskcode = 'defineTask(scoopTask' + _tasknum + ')\n' + + 'void scoopTask' + _tasknum + '::setup()\n' + + '{\n' + + statements_setup + + '}\n' + + 'void scoopTask' + _tasknum + '::loop()\n' + + '{\n' + + statements_loop + + '}\n'; + generator.definitions_['include_Scoop'] = '#include "SCoop.h"'; + generator.setups_['scoop_start'] = 'mySCoop.start();'; + generator.definitions_['scoop_task' + _tasknum] = taskcode; + var code = ""; + return code; +} + +export const SCoop_yield = function () { + var code = 'yield();\n'; + return code; +} + +export const SCoop_sleep = function (_, generator) { + var value_sleeplength = generator.valueToCode(this, 'sleeplength', generator.ORDER_ATOMIC); + var code = 'sleep(' + value_sleeplength + ');\n' + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/sensor.js b/mixly/boards/default_src/arduino_avr/generators/sensor.js new file mode 100644 index 00000000..8de571f5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/sensor.js @@ -0,0 +1,734 @@ +import { Profile, JSFuncs } from 'mixly'; + +export const gps_init = function (_, generator) { + generator.definitions_['include_TinyGPS++'] = '#include '; + generator.definitions_['include_SoftwareSerial'] = '#include '; + var rx = generator.valueToCode(this, 'RX', generator.ORDER_ATOMIC); + var tx = generator.valueToCode(this, 'TX', generator.ORDER_ATOMIC); + var bt = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) + generator.definitions_['var_declare_TinyGPSPlus_gps'] = 'TinyGPSPlus gps;'; + generator.definitions_['var_declare_SoftwareSerial_gps_ss'] = 'SoftwareSerial gps_ss(' + rx + ', ' + tx + ');'; + generator.setups_['setup_gps_ss_begin'] = 'gps_ss.begin(' + bt + ');'; + return ''; +} + +export const gps_data_available = function (_, generator) { + var code = 'gps_ss.available()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const gps_data_encode = function (_, generator) { + var code = 'gps.encode(gps_ss.read())'; + return [code, generator.ORDER_ATOMIC]; +} + +export const gps_xxx_isValid = function (_, generator) { + var WHAT = this.getFieldValue('WHAT'); + var code = 'gps.' + WHAT + '.isValid()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const gps_getData_xxx = function (_, generator) { + var WHAT = this.getFieldValue('WHAT'); + var code = 'gps.' + WHAT + '()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const chaoshengbo2 = function (_, generator) { + var Trig = this.getFieldValue('Trig'); + var Echo = this.getFieldValue('Echo'); + generator.setups_['setup_output_' + Trig] = 'pinMode(' + Trig + ', OUTPUT);'; + generator.setups_['setup_output_' + Echo] = 'pinMode(' + Echo + ', INPUT);'; + var funcName = 'checkdistance_' + Trig + '_' + Echo; + var code = 'float' + ' ' + funcName + '() {\n' + + ' digitalWrite(' + Trig + ', LOW);\n' + ' delayMicroseconds(2);\n' + + ' digitalWrite(' + Trig + ', HIGH);\n' + ' delayMicroseconds(10);\n' + + ' digitalWrite(' + Trig + ', LOW);\n' + + ' float distance = pulseIn(' + Echo + ', HIGH) / 58.00;\n' + + ' delay(10);\n' + ' return distance;\n' + + '}\n'; + generator.definitions_[funcName] = code; + return [funcName + '()', generator.ORDER_ATOMIC]; +} + +export const DHT = function (_, generator) { + var sensor_type = this.getFieldValue('TYPE'); + var dropdown_pin = this.getFieldValue('PIN'); + var what = this.getFieldValue('WHAT'); + generator.definitions_['include_DHT'] = '#include '; + generator.definitions_['var_declare_dht' + dropdown_pin] = 'DHT dht' + dropdown_pin + '(' + dropdown_pin + ', ' + sensor_type + ');' + generator.setups_['DHT_SETUP' + dropdown_pin] = ' dht' + dropdown_pin + '.begin();'; + var code; + if (what == "temperature") + code = 'dht' + dropdown_pin + '.readTemperature()' + else + code = 'dht' + dropdown_pin + '.readHumidity()' + return [code, generator.ORDER_ATOMIC]; +} + +// LM35 Temperature +export const LM35 = function (_, generator) { + var board_type = JSFuncs.getPlatform(); + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = 'analogRead(' + dropdown_pin + ')*0.488'; + if (board_type.match(RegExp(/ESP8266/))) { + var code = 'analogRead(' + dropdown_pin + ')*0.322'; + } + else if (board_type.match(RegExp(/ESP32/))) { + var code = 'analogRead(' + dropdown_pin + ')*0.161'; + } + return [code, generator.ORDER_ATOMIC]; +} + +export const ds18b20 = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var unit = this.getFieldValue('UNIT'); + generator.definitions_['include_OneWire'] = '#include '; + generator.definitions_['include_DallasTemperature'] = '#include '; + generator.definitions_['var_declare_OneWire_DallasTemperature_sensors_' + dropdown_pin] = 'OneWire oneWire_' + dropdown_pin + '(' + dropdown_pin + ');\nDallasTemperature sensors_' + dropdown_pin + '(&oneWire_' + dropdown_pin + ');'; + generator.definitions_['var_declare_DeviceAddress_insideThermometer'] = 'DeviceAddress insideThermometer;'; + generator.setups_['setup_sensors_' + dropdown_pin + '_getAddress'] = 'sensors_' + dropdown_pin + '.getAddress(insideThermometer, 0);'; + generator.setups_['setup_sensors_' + dropdown_pin + '_setResolution'] = 'sensors_' + dropdown_pin + '.setResolution(insideThermometer, 9);'; + var funcName = 'ds18b20_' + dropdown_pin + '_getTemp'; + var code = 'float' + ' ' + funcName + '(int w) {\n' + + ' sensors_' + dropdown_pin + '.requestTemperatures();\n' + + ' if(w==0) {\n return sensors_' + dropdown_pin + '.getTempC(insideThermometer);\n }\n' + + ' else {\n return sensors_' + dropdown_pin + '.getTempF(insideThermometer);\n }\n' + + '}\n'; + generator.definitions_[funcName] = code; + return ['ds18b20_' + dropdown_pin + '_getTemp(' + unit + ')', generator.ORDER_ATOMIC]; +} + +// 初始化MLX90614红外测温传感器 +export const mlx90614_init = function (_, generator) { + var value_mlx90614_address = generator.valueToCode(this, 'mlx90614_address', generator.ORDER_ATOMIC); + var text_mlx90614_name = 'MLX'; + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_Adafruit_MLX90614'] = '#include '; + generator.definitions_['var_declare_MLX90614_' + text_mlx90614_name] = 'Adafruit_MLX90614 ' + text_mlx90614_name + ' = Adafruit_MLX90614(' + value_mlx90614_address + ');'; + generator.setups_['setup_MLX90614_' + text_mlx90614_name] = '' + text_mlx90614_name + '.begin();'; + var code = ''; + return code; +} + +// MLX90614获取数据 +export const mlx90614_get_data = function (_, generator) { + var text_mlx90614_name = 'MLX'; + var dropdown_mlx90614_data = this.getFieldValue('mlx90614_data'); + var code = '' + text_mlx90614_name + '.' + dropdown_mlx90614_data + '()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const weightSensor = function (_, generator) { + var DOUT = this.getFieldValue('DOUT'); + var SCK = this.getFieldValue('SCK'); + var scale = generator.valueToCode(this, 'scale', generator.ORDER_ATOMIC); + generator.definitions_['include_Hx711'] = '#include '; + generator.definitions_['var_declare_Hx711' + DOUT + SCK] = 'Hx711 scale' + DOUT + '_' + SCK + "(" + DOUT + "," + SCK + ");"; + generator.setups_['setup_HX711' + DOUT + SCK] = 'scale' + DOUT + '_' + SCK + '.setOffset(scale' + DOUT + '_' + SCK + '.getAverageValue(30));'; + generator.setups_['setup_' + 'scale' + DOUT + '_' + SCK + ' .setScale'] = 'scale' + DOUT + '_' + SCK + '.setScale(' + scale + ');'; + var code = 'scale' + DOUT + '_' + SCK + '.getWeight(10)'; + return [code, generator.ORDER_ATOMIC]; +} + +// DS1302 +export const DS1302_init = function (_, generator) { + var dropdown_rst = generator.valueToCode(this, 'RST', generator.ORDER_ATOMIC); + var dropdown_dat = generator.valueToCode(this, 'DAT', generator.ORDER_ATOMIC); + var dropdown_clk = generator.valueToCode(this, 'CLK', generator.ORDER_ATOMIC); + generator.definitions_['include_ThreeWire'] = '#include '; + generator.definitions_['include_RtcDS1302'] = '#include '; + //generator.definitions_['var_declare_RtcDateTime_dt'] = 'const RtcDateTime dt;'; + generator.definitions_['var_declare_ThreeWire'] = 'ThreeWire ' + 'myWire(' + dropdown_dat + ', ' + dropdown_clk + ', ' + dropdown_rst + ');'; + generator.definitions_['var_declare_RtcDS1302'] = 'RtcDS1302 Rtc(myWire);'; + generator.setups_['setup_Rtc.Begin'] = 'Rtc.Begin();\n Rtc.SetIsRunning(true);'; + return ""; +} + +export const DS1307_init = function (_, generator) { + var SDA = generator.valueToCode(this, 'SDA', generator.ORDER_ATOMIC); + var SCL = generator.valueToCode(this, 'SCL', generator.ORDER_ATOMIC); + var RTCType = this.getFieldValue('RTCType'); + generator.definitions_['include_' + RTCType] = '#include <' + RTCType + '.h>'; + //generator.definitions_['var_declare_RtcDateTime_dt'] = 'const RtcDateTime dt;'; + if (SDA != Profile.default.SDA[0][1] || SCL != Profile.default.SCL[0][1]) { + generator.definitions_['include_SoftwareWire'] = '#include '; + generator.definitions_['var_declare_SoftwareWire'] = 'SoftwareWire myWire(' + SDA + ',' + SCL + ');'; + generator.definitions_['var_declare_' + RTCType] = RTCType + ' Rtc(myWire);'; + } else { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['var_declare_' + RTCType] = RTCType + ' Rtc(Wire);'; + } + generator.setups_['setup_Rtc.Begin'] = 'Rtc.Begin();\n Rtc.SetIsRunning(true);'; + return ""; +} + +export const RTC_get_time = function (_, generator) { + var timeType = this.getFieldValue('TIME_TYPE'); + var code = 'Rtc.GetDateTime().' + timeType + '()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const RTC_date = function (_, generator) { + var year = generator.valueToCode(this, "year", generator.ORDER_ATOMIC); + var month = generator.valueToCode(this, "month", generator.ORDER_ATOMIC); + var day = generator.valueToCode(this, "day", generator.ORDER_ATOMIC); + + switch (month) { + case '1': + month = 'Jan'; + break; + case '2': + month = 'Feb'; + break; + case '3': + month = 'Mar'; + break; + case '4': + month = 'Apr'; + break; + case '5': + month = 'May'; + break; + case '6': + month = 'Jun'; + break; + case '7': + month = 'Jul'; + break; + case '8': + month = 'Aug'; + break; + case '9': + month = 'Sep'; + break; + case '10': + month = 'Oct'; + break; + case '11': + month = 'Nov'; + break; + case '12': + month = 'Dec'; + break; + default: + month = 'Jan'; + } + if (day.length == 1) + day = '0' + day; + var code = '"' + month + '/' + day + '/' + year + '"'; + return [code, generator.ORDER_ATOMIC]; +} + +export const RTC_time = function (_, generator) { + var hour = generator.valueToCode(this, "hour", generator.ORDER_ATOMIC); + var minute = generator.valueToCode(this, "minute", generator.ORDER_ATOMIC); + var second = generator.valueToCode(this, "second", generator.ORDER_ATOMIC); + if (hour.length == 1) + hour = '0' + hour; + if (minute.length == 1) + minute = '0' + minute; + if (second.length == 1) + second = '0' + second; + var code = '"' + hour + ':' + minute + ':' + second + '"'; + return [code, generator.ORDER_ATOMIC]; +} + +// 设置时间 +export const RTC_set_time = function (_, generator) { + var value_date = generator.valueToCode(this, 'date', generator.ORDER_ATOMIC); + var value_time = generator.valueToCode(this, 'time', generator.ORDER_ATOMIC); + var code = ''; + code = 'Rtc.SetDateTime(RtcDateTime(' + value_date + ', ' + value_time + '));\n'; + return code; +} + +// 获取烧录时间和日期 +export const get_system_date_time = function (_, generator) { + var dropdown_type = this.getFieldValue('type'); + var code = '__' + dropdown_type + '__'; + return [code, generator.ORDER_ATOMIC]; +} + +export const RTC_set_date = function () { + const now = new Date(); + const year = now.getFullYear(); // 年 + const month = now.getMonth() + 1; // 月 + const day = now.getDate(); // 日 + var RTCName = "myRTC"; + var code = RTCName + '.setDate(' + year + ',' + month + ',' + day + ');\n'; + code += RTCName + '.setDOW(' + year + ',' + month + ',' + day + ');\n'; + return code; +} + +// 传感器_sht20 +export const SHT20 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_DFRobot_SHT20'] = '#include '; + generator.definitions_['var_declare_DFRobot_SHT20'] = 'DFRobot_SHT20 sht20;\n'; + generator.setups_['setup_sht20initSHT20'] = 'sht20.initSHT20();'; + generator.setups_['setup_sht20.checkSHT20'] = 'sht20.checkSHT20(); \n'; + var dropdown_type = this.getFieldValue('SHT20_TYPE'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +// 传感器_重力感应块 +export const ADXL345 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_I2Cdev'] = '#include '; + generator.definitions_['include_ADXL345'] = '#include '; + generator.definitions_['var_declare_ADXL345'] = 'ADXL345 accel;\n'; + generator.setups_['setup_Wire.begin'] = 'Wire.begin();'; + generator.setups_['setup_accel.begin'] = 'accel.initialize(); \n'; + var dropdown_type = this.getFieldValue('ADXL345_PIN'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +// 传感器_重力感应块 +export const LIS3DHTR = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_LIS3DHTR'] = '#include '; + generator.definitions_['include_define_Wire'] = '#define WIRE Wire'; + generator.definitions_['var_declare_LIS3DHTR'] = 'LIS3DHTR LIS;\n'; + generator.setups_['setup_LIS.begin'] = 'LIS.begin(WIRE,0x19);\n'; + generator.setups_['setup_LIS.openTemp'] = 'LIS.openTemp();'; + generator.setups_['setup_LIS.setFullScaleRange'] = 'LIS.setFullScaleRange(LIS3DHTR_RANGE_2G);'; + generator.setups_['setup_LIS.setOutputDataRate'] = 'LIS.setOutputDataRate(LIS3DHTR_DATARATE_50HZ);'; + var dropdown_type = this.getFieldValue('LIS3DHTR_GETDATA'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +// 传感器_重力感应块 +export const ADXL345_setOffset = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_I2Cdev'] = '#include '; + generator.definitions_['include_ADXL345'] = '#include '; + generator.definitions_['var_declare_ADXL345'] = 'ADXL345 accel;\n'; + generator.setups_['setup_Wire.begin'] = 'Wire.begin();'; + generator.setups_['setup_accel.begin'] = 'accel.initialize(); \n'; + + var dropdown_type = this.getFieldValue('MIXEPI_ADXL345_OFFSET'); + var offset_value = generator.valueToCode(this, 'OFFSET', generator.ORDER_ATOMIC); + var code; + + if (dropdown_type == "setOffsetX") { + code = 'accel.setOffsetX(round(' + offset_value + '*4/15.9));\n'; + } else if (dropdown_type == "setOffsetY") { + code = 'accel.setOffsetY(round(' + offset_value + '*4/15.9));\n'; + } else if (dropdown_type == "setOffsetZ") { + code = 'accel.setOffsetZ(round(' + offset_value + '*4/15.9));\n'; + } + + return code; +} + +// 传感器-MPU6050-获取数据 +export const MPU6050 = function (_, generator) { + generator.definitions_['include_MPU6050_tockn'] = '#include '; + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['var_declare_mpu6050'] = 'MPU6050 mpu6050(Wire);'; + generator.setups_['setup_ngyro'] = 'Wire.begin();\n mpu6050.begin();\n mpu6050.calcGyroOffsets(true);'; + var MPU6050_TYPE = this.getFieldValue('MPU6050_TYPE'); + var code = 'mpu6050.' + MPU6050_TYPE; + return [code, generator.ORDER_ATOMIC]; +} + +// 传感器-MPU6050-更新数据 +export const MPU6050_update = function () { + var code = 'mpu6050.update();\n'; + return code; +} + +//旋转编码器写 +export const encoder_write = function (_, generator) { + var Encoder_NO = this.getFieldValue('Encoder_NO'); + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC); + var code = 'encoder_' + Encoder_NO + '.write(' + value + ');\n '; + return code; +} + +//旋转编码器读值 +export const encoder_read = function (_, generator) { + var Encoder_NO = this.getFieldValue('Encoder_NO'); + var code = 'encoder_' + Encoder_NO + '.read()'; + return [code, generator.ORDER_ATOMIC]; +} + +//旋转编码管脚定义 +export const encoder_init = function (_, generator) { + var CLK = this.getFieldValue('CLK'); + var DT = this.getFieldValue('DT'); + var Encoder_NO = this.getFieldValue('Encoder_NO'); + generator.definitions_['include_Encoder'] = '#include \n'; + generator.definitions_['var_declare_Encoder_' + Encoder_NO] = 'Encoder encoder_' + Encoder_NO + '(' + CLK + ',' + DT + ');\n '; + var code = ''; + return code; +} + +//旋转编码器写 +export const encoder_write1 = function (_, generator) { + var Encoder_NO = this.getFieldValue('Encoder_NO'); + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC); + var code = 'encoder_counter_' + Encoder_NO + ' = ' + value + ';\n '; + return code; +} + +//旋转编码器读值 +export const encoder_read1 = function (_, generator) { + var Encoder_NO = this.getFieldValue('Encoder_NO'); + var code = 'encoder_counter_' + Encoder_NO + ''; + return [code, generator.ORDER_ATOMIC]; +} + +//旋转编码管脚定义 +export const encoder_init1 = function (_, generator) { + var CLK = this.getFieldValue('CLK'); + var DT = this.getFieldValue('DT'); + var Encoder_NO = this.getFieldValue('Encoder_NO'); + generator.definitions_['var_declare_Encoder_' + Encoder_NO + ''] = 'int encoder_counter_' + Encoder_NO + ' = 0;\n' + + 'int encoder_aState_' + Encoder_NO + ';\n' + + 'int encoder_aLastState_' + Encoder_NO + ';\n' + generator.setups_['setups_encoder_' + Encoder_NO + ''] = ' pinMode (' + CLK + ', INPUT);\n' + + ' pinMode (' + DT + ', INPUT);\n' + + ' encoder_aLastState_' + Encoder_NO + ' = digitalRead(' + CLK + ');\n' + var code = ' encoder_aState_' + Encoder_NO + ' = digitalRead(' + CLK + ');\n' + + ' if (encoder_aState_' + Encoder_NO + ' != encoder_aLastState_' + Encoder_NO + ') {\n' + + ' if (digitalRead(' + DT + ') != encoder_aState_' + Encoder_NO + ') {\n' + + ' encoder_counter_' + Encoder_NO + ' ++;\n' + + ' } else {\n' + + ' encoder_counter_' + Encoder_NO + ' --;\n' + + ' }\n' + + ' }\n' + + ' encoder_aLastState_' + Encoder_NO + ' = encoder_aState_' + Encoder_NO + ';\n'; + return code; +} + +// 旋转编码器初始化 +export const sensor_encoder_init = function (_, generator) { + var dropdownType = this.getFieldValue('TYPE'); + var mode = this.getFieldValue('mode'); + var valueClk = generator.valueToCode(this, 'CLK', generator.ORDER_ATOMIC); + var valueDt = generator.valueToCode(this, 'DT', generator.ORDER_ATOMIC); + generator.definitions_['include_ESPRotary'] = '#include '; + generator.definitions_['var_declare_encoder' + dropdownType] = `ESPRotary encoder${dropdownType};`; + generator.setups_['setup_encoder' + dropdownType] = `encoder${dropdownType}.begin(${valueDt}, ${valueClk});\n encoder${dropdownType}.setStepsPerClick(${mode});`; + generator.loops_begin_['loop_encoder' + dropdownType] = `encoder${dropdownType}.loop();\n`; + return ''; +} + +// 旋转编码器读取 +export const sensor_encoder_get = function (_, generator) { + var dropdownType = this.getFieldValue('TYPE'); + var dropdownOperateType = this.getFieldValue('OPERATE_TYPE'); + var code = `encoder${dropdownType}.${dropdownOperateType}()`; + return [code, generator.ORDER_ATOMIC]; +} + +// 旋转编码器设置 +export const sensor_encoder_set = function (_, generator) { + var dropdownType = this.getFieldValue('TYPE'); + var valueData = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC); + var dropdownOperateType = this.getFieldValue('OPERATE_TYPE'); + var code = `encoder${dropdownType}.${dropdownOperateType}(${valueData});\n`; + return code; +} + +// 旋转编码器事件 +export const sensor_encoder_handle = function (_, generator) { + var dropdownType = this.getFieldValue('TYPE'); + var dropdownOperateType = this.getFieldValue('OPERATE_TYPE'); + var statementsDo = generator.statementToCode(this, 'DO'); + var cbFuncName = 'encoder' + dropdownType; + switch (dropdownOperateType) { + case 'setChangedHandler': + cbFuncName += 'OnChanged'; + break; + case 'setRightRotationHandler': + cbFuncName += 'OnRightRotation'; + break; + case 'setLeftRotationHandler': + cbFuncName += 'OnLeftRotation'; + break; + case 'setUpperOverflowHandler': + cbFuncName += 'OnUpperOverflow'; + break; + case 'setLowerOverflowHandler': + default: + cbFuncName += 'OnLowerOverflow'; + } + generator.definitions_['function_' + cbFuncName] = `void ${cbFuncName}(ESPRotary& encoder${dropdownType}) {\n` + + statementsDo + `}\n`; + generator.setups_['setup_' + cbFuncName] = `encoder${dropdownType}.${dropdownOperateType}(${cbFuncName});`; + var code = ''; + return code; +} + +//BME280读取 +export const BME280_READ = function (_, generator) { + var TYPE = this.getFieldValue('TYPE'); + var address = generator.valueToCode(this, 'address', generator.ORDER_ATOMIC); + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_SPI'] = '#include '; + generator.definitions_['include_Adafruit_Sensor'] = '#include '; + if (TYPE == "bme") { + generator.definitions_['include_Adafruit_BME280'] = '#include '; + generator.definitions_['var_declare_Adafruit_BME280'] = 'Adafruit_BME280 bme;'; + } + else { + generator.definitions_['include_Adafruit_BMP280'] = '#include '; + generator.definitions_['var_declare_Adafruit_BMP280'] = 'Adafruit_BMP280 bmp;'; + } + generator.setups_['setup_status'] = 'unsigned status;\n status = ' + TYPE + '.begin(' + address + ');'; + generator.definitions_['include_SEALEVELPRESSURE_HPA'] = '#define SEALEVELPRESSURE_HPA (1013.25)'; + var code = this.getFieldValue('BME_TYPE'); + return [TYPE + "." + code, generator.ORDER_ATOMIC]; +} + +export const PS2_init = function (_, generator) { + generator.definitions_['include_PS2X_lib'] = '#include '; + generator.definitions_['var_declare_PS2X'] = 'PS2X ps2x;'; + var PS2_DAT = this.getFieldValue('PS2_DAT'); + var PS2_CMD = this.getFieldValue('PS2_CMD'); + var PS2_SEL = this.getFieldValue('PS2_SEL'); + var PS2_CLK = this.getFieldValue('PS2_CLK'); + var rumble = this.getFieldValue('rumble'); + + generator.setups_['setup_ps2x_config_gamepad'] = 'ps2x.config_gamepad(' + PS2_CLK + ',' + PS2_CMD + ',' + PS2_SEL + ',' + PS2_DAT + ', true, ' + rumble + ');\n delay(300);\n'; + return ""; +} + +export const PS2_update = function () { + var code = 'ps2x.read_gamepad(false, 0);\ndelay(30);\n'; + return code; +} + +export const PS2_Button = function (_, generator) { + var bt = this.getFieldValue('psbt'); + var btstate = this.getFieldValue('btstate'); + var code = "ps2x." + btstate + "(" + bt + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +export const PS2_stk = function (_, generator) { + var stk = this.getFieldValue('psstk'); + var code = "ps2x.Analog(" + stk + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +// 改用DF TCS34725 颜色识别传感器库 +export const TCS34725_Get_RGB = function (_, generator) { + generator.definitions_['include_DFRobot_TCS34725'] = '#include '; + generator.definitions_['var_declare_TCS34725'] = 'DFRobot_TCS34725 tcs34725;\n'; + // generator.setups_['setup_DFRobot_TCS34725' ] = 'if (tcs34725.begin()) {\n Serial.println("Found sensor");\n} \nelse { \nSerial.println("No TCS34725 found ... check your connections");\nwhile (1);\n}'; + generator.setups_['setup_DFRobot_TCS34725'] = 'tcs34725.begin();'; + var RGB = this.getFieldValue('DF_TCS34725_COLOR'); + return [RGB, generator.ORDER_ATOMIC]; +} + +// 初始化TCS230颜色传感器 +export const tcs230_init = function (_, generator) { + var value_tcs230_s0 = generator.valueToCode(this, 'tcs230_s0', generator.ORDER_ATOMIC); + var value_tcs230_s1 = generator.valueToCode(this, 'tcs230_s1', generator.ORDER_ATOMIC); + var value_tcs230_s2 = generator.valueToCode(this, 'tcs230_s2', generator.ORDER_ATOMIC); + var value_tcs230_s3 = generator.valueToCode(this, 'tcs230_s3', generator.ORDER_ATOMIC); + var value_tcs230_led = generator.valueToCode(this, 'tcs230_led', generator.ORDER_ATOMIC); + var value_tcs230_out = generator.valueToCode(this, 'tcs230_out', generator.ORDER_ATOMIC); + + generator.definitions_['define_tcs230_pin'] = '#define tcs230_S0 ' + value_tcs230_s0 + '' + + '\n#define tcs230_S1 ' + value_tcs230_s1 + '' + + '\n#define tcs230_S2 ' + value_tcs230_s2 + '' + + '\n#define tcs230_S3 ' + value_tcs230_s3 + '' + + '\n#define tcs230_sensorOut ' + value_tcs230_out + '' + + '\n#define tcs230_LED ' + value_tcs230_led + ''; + + generator.definitions_['function_tcs230_Getcolor'] = '//TCS230颜色传感器获取RGB值' + + '\nint tcs230_Getcolor(char data)' + + '\n{' + + '\n int frequency = 0;' + + '\n switch(data)' + + '\n {' + + '\n case \'R\':' + + '\n {' + + '\n digitalWrite(tcs230_S2,LOW);' + + '\n digitalWrite(tcs230_S3,LOW);' + + '\n frequency = pulseIn(tcs230_sensorOut, LOW);' + + '\n frequency = map(frequency, 25, 72, 255, 0);' + + '\n break;' + + '\n }' + + '\n case \'G\':' + + '\n {' + + '\n digitalWrite(tcs230_S2,HIGH);' + + '\n digitalWrite(tcs230_S3,HIGH);' + + '\n frequency = pulseIn(tcs230_sensorOut, LOW);' + + '\n frequency = map(frequency, 30, 90, 255, 0);' + + '\n break;' + + '\n }' + + '\n case \'B\':' + + '\n {' + + '\n digitalWrite(tcs230_S2,LOW);' + + '\n digitalWrite(tcs230_S3,HIGH);' + + '\n frequency = pulseIn(tcs230_sensorOut, LOW);' + + '\n frequency = map(frequency, 25, 70, 255, 0);' + + '\n break;' + + '\n }' + + '\n default:' + + '\n return -1;' + + '\n }' + + '\n if (frequency < 0)' + + '\n frequency = 0;' + + '\n if (frequency > 255)' + + '\n frequency = 255;' + + '\n return frequency;' + + '\n}\n'; + + generator.setups_['setup_tcs230_pin'] = 'pinMode(tcs230_S0, OUTPUT);' + + '\n pinMode(tcs230_S1, OUTPUT);' + + '\n pinMode(tcs230_S2, OUTPUT);' + + '\n pinMode(tcs230_S3, OUTPUT);' + + '\n pinMode(tcs230_LED, OUTPUT);' + + '\n pinMode(tcs230_sensorOut, INPUT);' + + '\n digitalWrite(tcs230_S0,HIGH);' + + '\n digitalWrite(tcs230_S1,LOW);' + + '\n digitalWrite(tcs230_LED,HIGH);'; + var code = ''; + return code; +} + +// TCS230颜色传感器 获取RGB值 +export const tcs230_Get_RGB = function (_, generator) { + var dropdown_tcs230_color = this.getFieldValue('tcs230_color'); + var code = 'tcs230_Getcolor(\'' + dropdown_tcs230_color + '\')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const Arduino_keypad_4_4_start = function (_, generator) { + var text_keypad_name = this.getFieldValue('keypad_name'); + var text_keypad_row = generator.valueToCode(this, 'keypad_row', generator.ORDER_ATOMIC); + var text_keypad_col = generator.valueToCode(this, 'keypad_col', generator.ORDER_ATOMIC); + var text_keypad_type = generator.valueToCode(this, 'keypad_type', generator.ORDER_ATOMIC); + generator.definitions_['include_Keypad'] = '#include '; + generator.definitions_['var_keypadstart1' + text_keypad_name] = 'const byte ' + text_keypad_name + '_ROWS = 4;'; + generator.definitions_['var_keypadstart2' + text_keypad_name] = 'const byte ' + text_keypad_name + '_COLS = 4;'; + generator.definitions_['var_keypadstart3' + text_keypad_name] = 'char ' + text_keypad_name + '_hexaKeys[' + text_keypad_name + '_ROWS][' + text_keypad_name + '_COLS] = {' + '\n' + text_keypad_type + '\n};'; + generator.definitions_['var_keypadstart4' + text_keypad_name] = 'byte ' + text_keypad_name + '_rowPins[' + text_keypad_name + '_ROWS] = ' + text_keypad_row; + generator.definitions_['var_keypadstart5' + text_keypad_name] = 'byte ' + text_keypad_name + '_colPins[' + text_keypad_name + '_COLS] = ' + text_keypad_col; + generator.definitions_['var_keypadstart6' + text_keypad_name] = 'Keypad ' + text_keypad_name + ' = Keypad(makeKeymap(' + text_keypad_name + '_hexaKeys), ' + text_keypad_name + '_rowPins, ' + text_keypad_name + '_colPins, ' + text_keypad_name + '_ROWS, ' + text_keypad_name + '_COLS);'; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = ''; + return code; +} + +export const keypad_row_data = function (_, generator) { + var pin_keypad_row_1 = generator.valueToCode(this, 'keypad_row_1', generator.ORDER_ATOMIC); + var pin_keypad_row_2 = generator.valueToCode(this, 'keypad_row_2', generator.ORDER_ATOMIC); + var pin_keypad_row_3 = generator.valueToCode(this, 'keypad_row_3', generator.ORDER_ATOMIC); + var pin_keypad_row_4 = generator.valueToCode(this, 'keypad_row_4', generator.ORDER_ATOMIC); + var code = '{' + pin_keypad_row_1 + ', ' + pin_keypad_row_2 + ', ' + pin_keypad_row_3 + ', ' + pin_keypad_row_4 + '};'; + return [code, generator.ORDER_ATOMIC]; +} + +export const keypad_col_data = function (_, generator) { + var pin_keypad_col_1 = generator.valueToCode(this, 'keypad_col_1', generator.ORDER_ATOMIC); + var pin_keypad_col_2 = generator.valueToCode(this, 'keypad_col_2', generator.ORDER_ATOMIC); + var pin_keypad_col_3 = generator.valueToCode(this, 'keypad_col_3', generator.ORDER_ATOMIC); + var pin_keypad_col_4 = generator.valueToCode(this, 'keypad_col_4', generator.ORDER_ATOMIC); + var code = '{' + pin_keypad_col_1 + ', ' + pin_keypad_col_2 + ', ' + pin_keypad_col_3 + ', ' + pin_keypad_col_4 + '};'; + return [code, generator.ORDER_ATOMIC]; +} + +export const keypad_type_data = function (_, generator) { + var text_keypad_1_1 = this.getFieldValue('keypad_1_1'); + var text_keypad_1_2 = this.getFieldValue('keypad_1_2'); + var text_keypad_1_3 = this.getFieldValue('keypad_1_3'); + var text_keypad_1_4 = this.getFieldValue('keypad_1_4'); + + var text_keypad_2_1 = this.getFieldValue('keypad_2_1'); + var text_keypad_2_2 = this.getFieldValue('keypad_2_2'); + var text_keypad_2_3 = this.getFieldValue('keypad_2_3'); + var text_keypad_2_4 = this.getFieldValue('keypad_2_4'); + + var text_keypad_3_1 = this.getFieldValue('keypad_3_1'); + var text_keypad_3_2 = this.getFieldValue('keypad_3_2'); + var text_keypad_3_3 = this.getFieldValue('keypad_3_3'); + var text_keypad_3_4 = this.getFieldValue('keypad_3_4'); + + var text_keypad_4_1 = this.getFieldValue('keypad_4_1'); + var text_keypad_4_2 = this.getFieldValue('keypad_4_2'); + var text_keypad_4_3 = this.getFieldValue('keypad_4_3'); + var text_keypad_4_4 = this.getFieldValue('keypad_4_4'); + var code = + ' {\'' + text_keypad_1_1 + '\',\'' + text_keypad_1_2 + '\',\'' + text_keypad_1_3 + '\',\'' + text_keypad_1_4 + '\'},' + + '\n {\'' + text_keypad_2_1 + '\',\'' + text_keypad_2_2 + '\',\'' + text_keypad_2_3 + '\',\'' + text_keypad_2_4 + '\'},' + + '\n {\'' + text_keypad_3_1 + '\',\'' + text_keypad_3_2 + '\',\'' + text_keypad_3_3 + '\',\'' + text_keypad_3_4 + '\'},' + + '\n {\'' + text_keypad_4_1 + '\',\'' + text_keypad_4_2 + '\',\'' + text_keypad_4_3 + '\',\'' + text_keypad_4_4 + '\'}'; + return [code, generator.ORDER_ATOMIC]; +} + +export const get_keypad_num = function (_, generator) { + var text_keypad_name = this.getFieldValue('keypad_name'); + var code = '' + text_keypad_name + '.getKey()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const arduino_keypad_event = function (_, generator) { + var text_keypad_name = this.getFieldValue('keypad_name'); + var value_keypad_event_input = generator.valueToCode(this, 'keypad_event_input', generator.ORDER_ATOMIC); + var text_keypad_start_event_delay = this.getFieldValue('keypad_start_event_delay'); + var statements_keypad_event_data = generator.statementToCode(this, 'keypad_event_data'); + + generator.definitions_['define_variate_' + value_keypad_event_input] = 'volatile char ' + value_keypad_event_input + ';'; + generator.definitions_['var_keypadstart7_event' + text_keypad_name] = 'void keypadEvent_' + text_keypad_name + '(KeypadEvent ' + value_keypad_event_input + ') {' + + '\n' + statements_keypad_event_data + + '\n}'; + generator.setups_['setup_keypad_event_and_delay' + text_keypad_name] = text_keypad_name + '.addEventListener(keypadEvent_' + text_keypad_name + ');' + + '\n ' + text_keypad_name + '.setHoldTime(' + text_keypad_start_event_delay + ');'; + + var code = ''; + return code; +} + +//传感器_重力感应块_获取9轴数据 +export const mixgo_MPU9250 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_FaBo9Axis_MPU9250'] = '#include '; + generator.definitions_['var_declare_FaBo9Axis'] = 'FaBo9Axis fabo_9axis;\n float ax,ay,az,gx,gy,gz,mx,my,mz;'; + generator.setups_['setup_fabo_9axis'] = 'fabo_9axis.begin();'; + var dropdown_type = this.getFieldValue('MixGo_MPU9250_GETAB'); + var code = ''; + if (dropdown_type == "a") code += 'fabo_9axis.readAccelX()'; + if (dropdown_type == "b") code += 'fabo_9axis.readAccelY()'; + if (dropdown_type == "c") code += 'fabo_9axis.readAccelZ()'; + if (dropdown_type == "d") code += 'fabo_9axis.readGyroX()'; + if (dropdown_type == "e") code += 'fabo_9axis.readGyroY()'; + if (dropdown_type == "f") code += 'fabo_9axis.readGyroZ()'; + if (dropdown_type == "g") code += 'fabo_9axis.readMagnetX()'; + if (dropdown_type == "h") code += 'fabo_9axis.readMagnetY()'; + if (dropdown_type == "i") code += 'fabo_9axis.readMagnetZ()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const NTC_TEMP = function (_, generator) { + var PIN = this.getFieldValue('PIN'); + var NominalResistance = generator.valueToCode(this, 'NominalResistance', generator.ORDER_ATOMIC); + var betaCoefficient = generator.valueToCode(this, 'betaCoefficient', generator.ORDER_ATOMIC); + var seriesResistor = generator.valueToCode(this, 'seriesResistor', generator.ORDER_ATOMIC); + generator.definitions_['include_thermistor'] = '#include '; + generator.definitions_['var_declare_thermistor' + PIN] = 'THERMISTOR thermistor' + PIN + '(' + PIN + ',' + NominalResistance + "," + betaCoefficient + "," + seriesResistor + ");"; + var code = 'thermistor' + PIN + '.read()'; + return [code, generator.ORDER_ATOMIC]; +} + +// AHT20/21温湿度传感器 +export const AHT20_21 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_RL_AHT21'] = '#include '; + generator.definitions_['var_declare_AHT21'] = 'AHT21Class AHT21;\n'; + generator.setups_['setup_Wire.begin'] = 'Wire.begin();'; + generator.setups_['setup_AHT21.begin'] = 'AHT21.begin();\n'; + var dropdown_type = this.getFieldValue('AHT21_TYPE'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/serial.js b/mixly/boards/default_src/arduino_avr/generators/serial.js new file mode 100644 index 00000000..8151ce17 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/serial.js @@ -0,0 +1,110 @@ +import { Profile } from 'mixly'; + +export const serial_begin = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || Profile.default.serial; + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + content + ');'; + return ''; +} + +export const serial_write = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || '""' + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + '.write(' + content + ');\n'; + return code; +} + +export const serial_print = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var new_line = this.getFieldValue('new_line'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || '""' + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + '.' + new_line + '(' + content + ');\n'; + return code; +} + +export const serial_println = serial_print; + +export const serial_print_num = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var Decimal = this.getFieldValue('STAT'); + var new_line = this.getFieldValue('new_line'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || '0' + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + '.' + new_line + '(' + content + ',' + Decimal + ');\n'; + return code; +} + +export const serial_print_hex = serial_print_num; + +export const serial_available = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + ".available()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const serial_readstr = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + ".readString()"; + return [code, generator.ORDER_ATOMIC]; +} + +export const serial_readstr_until = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC); + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + ".readStringUntil(" + content + ")"; + return [code, generator.ORDER_ATOMIC]; +} + +export const serial_parseInt_Float = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var dropdown_stat = this.getFieldValue('STAT'); + var code = serial_select + '.' + dropdown_stat + '()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const serial_flush = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + if (!generator.setups_['setup_serial_' + serial_select]) { + generator.setups_['setup_serial_' + serial_select] = serial_select + '.begin(' + Profile.default.serial + ');'; + } + var code = serial_select + '.flush();\n'; + return code; +} + +export const serial_softserial = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var dropdown_pin1 = generator.valueToCode(this, 'RX', generator.ORDER_ATOMIC); + var dropdown_pin2 = generator.valueToCode(this, 'TX', generator.ORDER_ATOMIC); + generator.definitions_['include_SoftwareSerial'] = '#include '; + generator.definitions_['var_declare_' + serial_select] = 'SoftwareSerial ' + serial_select + '(' + dropdown_pin1 + ',' + dropdown_pin2 + ');'; + return ''; +} + +export const serial_event = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var funcName = 'attachPinInterrupt_fun_' + serial_select; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void ' + serial_select.replace('Serial', 'serialEvent') + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return ""; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/storage.js b/mixly/boards/default_src/arduino_avr/generators/storage.js new file mode 100644 index 00000000..25f806ec --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/storage.js @@ -0,0 +1,262 @@ +import { JSFuncs } from 'mixly'; + +var pin_cs; + +export const store_sd_init = function (_, generator) { + var board_type = JSFuncs.getPlatform(); + pin_cs = generator.valueToCode(this, 'PIN_CS', generator.ORDER_ATOMIC); + if (board_type.match(RegExp(/ESP32/))) { + generator.definitions_['include_mySD'] = '#include '; + } else { + generator.definitions_['include_SD'] = '#include '; + } + generator.definitions_['include_SPI'] = '#include '; + generator.setups_['setup_sd_write_begin'] = 'SD.begin(' + pin_cs + ');'; + var code = ''; + return code; +} + +export const store_sd_write = function (_, generator) { + var file = generator.valueToCode(this, 'FILE', generator.ORDER_ATOMIC) || '""'; + //file=file.replace(/String/,""); + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '""'; + //data=data.replace(/String/,""); + var newline = generator.valueToCode(this, 'NEWLINE', generator.ORDER_ATOMIC) || 'false'; + generator.definitions_['var_declare_File_datafile'] = 'File datafile;'; + var code = 'datafile = SD.open(' + file + ', FILE_WRITE);\n'; + code += 'if(datafile){\n'; + code += ' datafile.print(' + data + ');\n'; + if (newline == 'true') { + code += ' datafile.println("");\n'; + } + code += ' datafile.close();\n'; + code += '}\n'; + return code; +} + +export const sd_card_type = function (_, generator) { + generator.definitions_['var_declare_Sd2Card_card'] = 'Sd2Card card;'; + generator.setups_['setup_card_init'] = 'card.init(SPI_HALF_SPEED, ' + pin_cs + ');'; + var code = 'card.type()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const sd_card_root_files = function (_, generator) { + generator.definitions_['var_declare_Sd2Card_card'] = 'Sd2Card card;'; + generator.definitions_['var_declare_SdFile'] = 'SdFile root;'; + generator.definitions_['var_declare_SdVolume'] = 'SdVolume volume;'; + generator.setups_['setup_card_init'] = 'card.init(SPI_HALF_SPEED, ' + pin_cs + ');'; + generator.setups_['setup_volume_init'] = 'volume.init(card);'; + var code = 'root.openRoot(volume);\nroot.ls(LS_R | LS_DATE | LS_SIZE);'; + return code; +} + +export const sd_volume = function (_, generator) { + generator.definitions_['var_declare_Sd2Card_card'] = 'Sd2Card card;'; + generator.setups_['setup_card_init'] = 'card.init(SPI_HALF_SPEED, ' + pin_cs + ');'; + generator.definitions_['var_declare_SdVolume'] = 'SdVolume volume;'; + generator.setups_['setup_volume_init'] = 'volume.init(card);'; + var volume_TYPE = this.getFieldValue('volume_TYPE'); + var code = volume_TYPE; + return [code, generator.ORDER_ATOMIC]; +} + +export const sd_exist = function (_, generator) { + var text_FileName = generator.valueToCode(this, 'FileName', generator.ORDER_ATOMIC); + var code = 'SD.exists(' + text_FileName + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const sd_read = function (_, generator) { + var text_FileName = generator.valueToCode(this, 'FileName', generator.ORDER_ATOMIC); + generator.definitions_['var_declare_File_datafile'] = 'File datafile;'; + generator.definitions_['var_declare_File_datafile_SD_card_reading'] = 'String SD_card_reading(String path) {\n' + + 'datafile = SD.open(path.c_str());\n' + + ' String sd_data = "";\n' + + ' while (datafile.available()) {\n' + + ' sd_data = String(sd_data) + String(char(datafile.read()));\n' + + ' }\n' + + ' return sd_data;\n' + + '}'; + var code = 'SD_card_reading(' + text_FileName + ')' + return [code, generator.ORDER_ATOMIC]; +} + +export const sd_DelFile = function (_, generator) { + var text_FileName = generator.valueToCode(this, 'FileName', generator.ORDER_ATOMIC); + var code = 'SD.remove(' + text_FileName + ');'; + return code; +} + +export const store_eeprom_write_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + var funcName = 'eepromWriteLong'; + var code2 = 'void ' + funcName + '(int address, unsigned long value){\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.ULtime=value;\n' + + ' EEPROM.write(address, time.b[0]);\n' + + ' EEPROM.write(address+1, time.b[1]);\n' + + ' if(time.b[2] != EEPROM.read(address+2))\n' + + ' EEPROM.write(address+2, time.b[2]);\n' + + ' if(time.b[3] != EEPROM.read(address+3))\n' + + ' EEPROM.write(address+3, time.b[3]);\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return 'eepromWriteLong(' + address + ', ' + data + ');\n'; +} + +export const store_eeprom_read_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + var code = 'eepromReadLong(' + address + ')'; + var funcName = 'eepromReadLong'; + var code2 = 'unsigned long ' + funcName + '(int address) {\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.b[0] = EEPROM.read(address);\n' + + ' time.b[1] = EEPROM.read(address+1);\n' + + ' time.b[2] = EEPROM.read(address+2);\n' + + ' time.b[3] = EEPROM.read(address+3);\n' + + ' return time.ULtime;\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_write_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.write(' + address + ', ' + data + ');\n'; +} + +export const store_eeprom_read_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + var code = 'EEPROM.read(' + address + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_put = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.put(' + address + ', ' + data + ');\n'; +}; + +export const store_eeprom_get = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.get(' + address + ', ' + data + ');\n'; +} + +//ESP32简化SPIFFS +export const simple_spiffs_store_spiffs_write = function (_, generator) { + var MODE = this.getFieldValue('MODE'); + var file = generator.valueToCode(this, 'FILE', generator.ORDER_ATOMIC) || '""'; + //file=file.replace(/String/,""); + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '""'; + //data=data.replace(/String/,""); + var newline = generator.valueToCode(this, 'NEWLINE', generator.ORDER_ATOMIC) || 'false'; + generator.definitions_['include_ESP_FS'] = '#include "FS.h"'; + generator.definitions_['include_ESP_SPIFFS'] = '#include "SPIFFS.h"'; + + if (MODE == 1) { + generator.definitions_['var_simple_spiffs_store_spiffs_write' + MODE] = 'void writeFile(fs::FS &fs, const char * path, const char * message) {\n' + + ' File file = fs.open(path, FILE_WRITE);\n' + + ' if (!file) {\n' + + ' Serial.println("- failed to open file for writing");\n' + + ' return;\n' + + ' }\n' + + ' if (file.print(message)) {\n' + + ' Serial.println("- file written");\n' + + ' } else {\n' + + ' Serial.println("- write failed");\n' + + ' }\n' + + ' file.close();\n' + + '}'; + if (newline == 'true') { + var code = 'writeFile(SPIFFS, ' + file + ', String(String(' + data + ') + String("\\r\\n")).c_str());\n'; + } else { + var code = 'writeFile(SPIFFS, ' + file + ', String(' + data + ').c_str());\n'; + } + } + if (MODE == 2) { + generator.definitions_['var_simple_spiffs_store_spiffs_write' + MODE] = 'void appendFile(fs::FS &fs, const char * path, const char * message) {\n' + + ' File file = fs.open(path, FILE_APPEND);\n' + + ' if (!file) {\n' + + ' Serial.println("- failed to open file for appending");\n' + + ' return;\n' + + ' }\n' + + ' if (file.print(message)) {\n' + + ' Serial.println("- message appended");\n' + + ' } else {\n' + + ' Serial.println("- append failed");\n' + + ' }\n' + + ' file.close();\n' + + '}'; + if (newline == 'true') { + var code = 'appendFile(SPIFFS, ' + file + ', String(String(' + data + ') + String("\\r\\n")).c_str());\n'; + } else { + var code = 'appendFile(SPIFFS, ' + file + ', String(' + data + ').c_str());\n'; + } + } + return code; +} + +export const simple_spiffs_read = function (_, generator) { + var text_FileName = generator.valueToCode(this, 'FileName', generator.ORDER_ATOMIC); + generator.definitions_['include_ESP_FS'] = '#include "FS.h"'; + generator.definitions_['include_ESP_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['var_simple_spiffs_read'] = 'String readFile(fs::FS &fs, const char * path) {\n' + + ' File file = fs.open(path);\n' + + ' if (!file || file.isDirectory()) {\n' + + ' Serial.println("- failed to open file for reading");\n' + + ' file.close();\n' + + ' return "SPIFFS_error";\n' + + ' } else {\n' + + ' Serial.println("- read from file:");\n' + + ' String SPIFFS_data = "";\n' + + ' while (file.available()) {\n' + + ' SPIFFS_data = String(SPIFFS_data) + String(char(file.read()));\n' + + ' }\n' + + ' file.close();\n' + + ' return SPIFFS_data;\n' + + ' }\n' + + '}'; + generator.setups_['setup_ESP_SPIFFS'] = ' if (!SPIFFS.begin(true)) {\n' + + ' Serial.println("SPIFFS Mount Failed");\n' + + ' return;\n' + + ' }'; + var code = 'readFile(SPIFFS, ' + text_FileName + ')' + return [code, generator.ORDER_ATOMIC]; +} + +export const simple_spiffs_DelFile = function (_, generator) { + generator.definitions_['include_ESP_FS'] = '#include "FS.h"'; + generator.definitions_['include_ESP_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['var_simple_spiffs_DelFile'] = 'void deleteFile(fs::FS &fs, const char * path) {\n' + + ' if (fs.remove(path)) {\n' + + ' Serial.println("- file deleted");\n' + + ' } else {\n' + + ' Serial.println("- delete failed");\n' + + ' }\n' + + '}'; + generator.setups_['setup_ESP_SPIFFS'] = ' if (!SPIFFS.begin(true)) {\n' + + ' Serial.println("SPIFFS Mount Failed");\n' + + ' return;\n' + + ' }'; + var text_FileName = generator.valueToCode(this, 'FileName', generator.ORDER_ATOMIC); + var code = 'deleteFile(SPIFFS, ' + text_FileName + ');\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/text.js b/mixly/boards/default_src/arduino_avr/generators/text.js new file mode 100644 index 00000000..e3ead312 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/text.js @@ -0,0 +1,152 @@ +export const text = function (_, generator) { + // Text value. + //var code = 'String('+generator.quote_(this.getFieldValue('TEXT'))+')'; + var code = generator.quote_(this.getFieldValue('TEXT')); + return [code, generator.ORDER_ATOMIC]; +} + +export const text_char = function (_, generator) { + var code = '\'' + this.getFieldValue('TEXT') + '\''; + return [code, generator.ORDER_ATOMIC]; +} + +export const text_join = function (_, generator) { + // Text value. + var a = 'String(' + generator.valueToCode(this, 'A', generator.ORDER_ATOMIC) + ')'; + var b = 'String(' + generator.valueToCode(this, 'B', generator.ORDER_ATOMIC) + ')'; + return [a + ' + ' + b, generator.ORDER_ATOMIC]; +} + +export const text_to_number = function (_, generator) { + var towhat = this.getFieldValue('TOWHAT'); + var str = 'String(' + generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC) + ')'; + return [str + '.' + towhat + '()', generator.ORDER_ATOMIC]; +} + +export const ascii_to_char = function (_, generator) { + var asciivalue = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC) || '0' + return ['char(' + asciivalue + ')', generator.ORDER_ATOMIC]; +} + +export const char_to_ascii = function (_, generator) { + var charvalue = '\'' + this.getFieldValue('TEXT') + '\''; + return ['toascii(' + charvalue + ')', generator.ORDER_ATOMIC]; +} + +export const number_to_text = function (_, generator) { + var towhat = this.getFieldValue('TOWHAT'); + var str = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC) || '0' + return ['String(' + str + ", " + towhat + ")", generator.ORDER_ATOMIC]; +} + +export const text_length = function (_, generator) { + var str = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC) || '""'; + return ['String(' + str + ')' + '.length()', generator.ORDER_ATOMIC]; +} + +export const text_char_at = function (_, generator) { + var str = generator.valueToCode(this, 'VAR', generator.ORDER_ATOMIC) || '""'; + var at = generator.valueToCode(this, 'AT', generator.ORDER_ATOMIC) || '0'; + return ['String(' + str + ')' + '.charAt(' + at + ')', generator.ORDER_ATOMIC]; +} + +export const text_equals_starts_ends = function (_, generator) { + var str1 = 'String(' + (generator.valueToCode(this, 'STR1', generator.ORDER_ATOMIC) || '""') + ')'; + var str2 = 'String(' + (generator.valueToCode(this, 'STR2', generator.ORDER_ATOMIC) || '""') + ')'; + var dowhat = this.getFieldValue('DOWHAT'); + return [str1 + '.' + dowhat + '(' + str2 + ')', generator.ORDER_ATOMIC]; +} + +export const text_compareTo = function (_, generator) { + var str1 = 'String(' + (generator.valueToCode(this, 'STR1', generator.ORDER_ATOMIC) || '""') + ')'; + var str2 = 'String(' + (generator.valueToCode(this, 'STR2', generator.ORDER_ATOMIC) || '""') + ')'; + return [str1 + '.compareTo(' + str2 + ')', generator.ORDER_ATOMIC]; +} + +// 小数获取有效位 +export const decimal_places = function (_, generator) { + var numeral = generator.valueToCode(this, 'numeral', generator.ORDER_ATOMIC); + var decimal_places = generator.valueToCode(this, 'decimal_places', generator.ORDER_ATOMIC); + var code = 'String(' + numeral + ', ' + decimal_places + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +// 截取字符串 +export const substring = function (_, generator) { + var name = generator.valueToCode(this, 'name', generator.ORDER_ATOMIC); + var Start = generator.valueToCode(this, 'Start', generator.ORDER_ATOMIC); + var end = generator.valueToCode(this, 'end', generator.ORDER_ATOMIC); + var code = 'String(' + name + ').substring(' + Start + ',' + end + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +// 字符串转化为大小写 +export const letter_conversion = function (_, generator) { + var type = this.getFieldValue('type'); + var String = generator.valueToCode(this, 'String', generator.ORDER_ATOMIC); + var code = '' + String + '' + type + ';\n'; + return code; +} + +// 字符串变量替换 +export const data_replacement = function (_, generator) { + var String = generator.valueToCode(this, 'String', generator.ORDER_ATOMIC); + var replace = generator.valueToCode(this, 'replace', generator.ORDER_ATOMIC); + var source_data = generator.valueToCode(this, 'source_data', generator.ORDER_ATOMIC); + var code = '' + String + '.replace(' + source_data + ', ' + replace + ');\n'; + return code; +} + +// 消除非可视字符 +export const eliminate = function (_, generator) { + var String = generator.valueToCode(this, 'String', generator.ORDER_ATOMIC); + var code = '' + String + '.trim();\n'; + return code; +} + +// 检测是否以特定字符串开头或结尾 +export const first_and_last = function (_, generator) { + var type = this.getFieldValue('type'); + var String = generator.valueToCode(this, 'String', generator.ORDER_ATOMIC); + var String1 = generator.valueToCode(this, 'String1', generator.ORDER_ATOMIC); + var code = 'String(' + String + ')' + type + '(' + String1 + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +// 数据类型转换 +export const type_conversion = function (_, generator) { + var variable = generator.valueToCode(this, 'variable', generator.ORDER_ATOMIC); + var type = this.getFieldValue('type'); + var code = '' + type + '(' + variable + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const String_indexOf = function (_, generator) { + var str1 = generator.valueToCode(this, 'str1', generator.ORDER_ATOMIC); + var str2 = generator.valueToCode(this, 'str2', generator.ORDER_ATOMIC); + var code = 'String(' + str1 + ').indexOf(String(' + str2 + '))'; + return [code, generator.ORDER_ATOMIC]; +} + +export const text_join2 = function (_, generator) { + // Create a list with any number of elements of any type. + var code = new Array(this.itemCount_); + for (var n = 0; n < this.itemCount_; n++) { + code[n] = generator.valueToCode(this, 'ADD' + n, + generator.ORDER_NONE) || '0'; + } + var code1 = ''; + for (var n = 0; n < this.itemCount_; n++) { + code1 = code1 + ' + ' + 'String(' + code[n] + ')'; + } + code1 = code1.substring(3); + return [code1, generator.ORDER_ATOMIC]; +} + +// 字符串转长整数 +export const String_to_Long_Integer = function(_, generator) { + var data= generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var type= this.getFieldValue('type'); + var code = 'strtol(String(' +data+ ').c_str(), NULL, ' +type+ ')'; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/generators/tools.js b/mixly/boards/default_src/arduino_avr/generators/tools.js new file mode 100644 index 00000000..d41bb827 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/generators/tools.js @@ -0,0 +1,557 @@ +import { Variables } from 'blockly/core'; + +export const factory_notes = function () { + var content = this.getFieldValue('VALUE'); + //console.log(content); + if (content) { + var content2arr = content.split('\n'); + var code = ''; + for (var eachElement in content2arr) { + //console.log(content2arr[eachElement]); + content2arr[eachElement] = '//' + content2arr[eachElement] + '\n'; + //console.log(content2arr[eachElement]); + } + for (var eachElement of content2arr) { + code += eachElement; + } + return code; + } + return '//\n'; +} + +export const folding_block = function (_, generator) { + var branch = generator.statementToCode(this, 'DO'); + branch = branch.replace(/(^\s*)|(\s*$)/g, "");//去除两端空格 + return '' + branch + '\n'; +} + +export const IICSCAN = function (_, generator) { + generator.definitions_['include_WIRE'] = '#include '; + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + generator.setups_['setup_wire_begin'] = 'Wire.begin();'; + generator.setups_['setup_Serial.println("I2C Scanner")'] = 'Serial.println("I2C Scanner");'; + var code = 'byte error, address;\n' + + 'int nDevices;\n' + + 'Serial.println("Scanning...");\n' + + 'nDevices = 0;\n' + + 'for (address = 1; address < 127; address++ ){\n' + + ' Wire.beginTransmission(address);\n' + + ' error = Wire.endTransmission();\n' + + ' if (error == 0){\n' + + ' Serial.print("I2C device found at address 0x");\n' + + ' if (address < 16)\n' + + ' Serial.print("0");\n' + + ' Serial.print(address, HEX);\n' + + ' Serial.println(" !");\n' + + ' nDevices++;\n' + + ' }\n' + + ' else if (error == 4){\n' + + ' Serial.print("Unknow error at address 0x");\n' + + ' if (address < 16)\n' + + ' Serial.print("0");\n' + + ' Serial.println(address, HEX);\n' + + ' }\n' + + '}\n' + + 'if (nDevices == 0)\n' + + ' Serial.println("No I2C devices found");\n' + + 'else\n' + + ' Serial.println("done");\n' + + 'delay(5000);\n'; + return code; +} + +function string_Bin_to_Hex(outstr_select) { + switch (outstr_select) { + case '0000': + outstr_select = '0'; + break; + case '0001': + outstr_select = '1'; + break; + case '0010': + outstr_select = '2'; + break; + case '0011': + outstr_select = '3'; + break; + case '0100': + outstr_select = '4'; + break; + case '0101': + outstr_select = '5'; + break; + case '0110': + outstr_select = '6'; + break; + case '0111': + outstr_select = '7'; + break; + case '1000': + outstr_select = '8'; + break; + case '1001': + outstr_select = '9'; + break; + case '1010': + outstr_select = 'A'; + break; + case '1011': + outstr_select = 'B'; + break; + case '1100': + outstr_select = 'C'; + break; + case '1101': + outstr_select = 'D'; + break; + case '1110': + outstr_select = 'E'; + break; + case '1111': + outstr_select = 'F'; + break; + } + return outstr_select; +} + +//将文本或符号编码 +function encodeUnicode(str) { + let res = []; + for (let i = 0; i < str.length; i++) { + res[i] = ("00" + str.charCodeAt(i).toString(16)).slice(-4); + } + return "_u" + res.join("_u"); +} + +//将字符串转整数 +function myAtoi(str) { + str = str.replace(/(^\s*)|(\s*$)/g, "");//去掉字符串最前面的空格,中间的不用管 + var str1 = ""; + for (let i = 0; i < str.length; i++) { + if ((str.charAt(i) == "-" || str.charAt(i) == "+") && i == 0) { + str1 = str1.concat(str.charAt(i)) + }//如果“+”“-”号在最前面 + else if (/^\d+$/.test(str.charAt(i))) { + str1 = str1.concat(str.charAt(i)) + }//用字符串存储值 + else { + break//直接跳出for循环 + } + } + if (str1 - 0 > 2147483647) { + return 2147483647 + } //str-0 字符串化为数组最简单也是最常用的方法 + else if (str1 - 0 < -2147483648) { + return -2147483648 + } + if (isNaN(str1 - 0)) return 0//"+"/"-"这种情况,返回0 + return str1 - 0 +} + +//取模工具显示数据部分 +export const tool_modulus_show = function (_, generator) { + var varName = generator.variableDB_.getName(this.getFieldValue('VAR'), Variables.NAME_TYPE); + var checkbox_save_hz = this.getFieldValue('save_hz') == 'TRUE'; + var value_input = generator.valueToCode(this, 'input_data', generator.ORDER_ATOMIC); + + var X_1 = 0; + for (var i of value_input) { + if (i == ',') + X_1++; + } + X_1++; + + this.setFieldValue(X_1, "x"); + + if (checkbox_save_hz) + generator.libs_[varName] = 'static const unsigned char PROGMEM ' + varName + '[' + X_1 + '] = ' + '{' + value_input + '};'; + else + generator.libs_[varName] = 'unsigned char ' + varName + '[' + X_1 + '] = ' + '{' + value_input + '};'; + var code = ''; + return code; +} + +//取模工具设置部分 +var bitArr = new Array(); +for (var i = 0; i < 8; i++)bitArr[i] = (0x80 >> i);//初始化位数组 +var canvas = document.createElement("canvas");//创建canvas +var ctx = canvas.getContext("2d");//获得内容描述句柄 + +export const tool_modulus = function (_, generator) { + var dropdown_bitmap_formats = this.getFieldValue('bitmap_formats'); + var dropdown_modulus_way = this.getFieldValue('modulus_way'); + var dropdown_modulus_direction = this.getFieldValue('modulus_direction'); + var dropdown_hz_sharp = this.getFieldValue('hz_sharp'); + var text_hz_line_height = this.getFieldValue('hz_line_height'); + var dropdown_hz_up_down = this.getFieldValue('hz_up_down'); + var text_hz_up_down_data = this.getFieldValue('hz_up_down_data'); + var dropdown_hz_left_right = this.getFieldValue('hz_left_right'); + var text_hz_left_right_data = this.getFieldValue('hz_left_right_data'); + var text_bitmap_width = this.getFieldValue('bitmap_width'); + var text_bitmap_height = this.getFieldValue('bitmap_height'); + var angle_bitmap_rotate = 0; + // var checkbox_show_hz = this.getFieldValue('show_hz') == 'TRUE'; + var checkbox_show_hz = 'TRUE'; + var text_input_data = this.getFieldValue('input_data'); + var dropdown_hz_variant = 'normal'; + var dropdown_hz_style = 'normal'; + var dropdown_hz_thickness = 'normal'; + var fontSize_width = myAtoi(text_bitmap_width); + var fontSize_height = myAtoi(text_bitmap_height); + var bs = Math.ceil(fontSize_width / 8);//每行占字节数 + + var move_x = 0; + var move_y = 0; + if (dropdown_hz_up_down == "hz_down") { + move_y = myAtoi(text_hz_up_down_data); + } + else { + move_y = myAtoi("-" + text_hz_up_down_data); + } + + if (dropdown_hz_left_right == "hz_right") { + move_x = myAtoi(text_hz_left_right_data); + } + else { + move_x = myAtoi("-" + text_hz_left_right_data); + } + canvas.width = fontSize_width; + canvas.height = fontSize_height; + ctx.font = dropdown_hz_style + ' ' + dropdown_hz_variant + ' ' + dropdown_hz_thickness + ' ' + text_hz_line_height + 'px ' + dropdown_hz_sharp; + ctx.textAlign = "left"; + ctx.textBaseline = "top"; + + var c = text_input_data; + + ctx.fillStyle = "#000000"; + ctx.fillRect(0, 0, fontSize_width, fontSize_height);//涂背景 + ctx.fillStyle = "#ffffff"; + ctx.translate(fontSize_width / 2, fontSize_height / 2); + ctx.rotate(Math.PI / 180 * (angle_bitmap_rotate - 0)); + ctx.fillText(c, move_x - fontSize_width / 2, move_y - fontSize_height / 2);//写字 + //ctx.drawImage(img,0,0,100,100);//写字 + + var data = ctx.getImageData(0, 0, fontSize_width, fontSize_height).data;//获取图像 + var zm = new Array(bs * fontSize_height); + for (var i = 0; i < zm.length; i++)zm[i] = 0;//初始化字模数组 + for (var i = 0; i < fontSize_height; i++)//读像素值组成字模数组 + for (var j = 0; j < fontSize_width; j++) + if (data[i * fontSize_width * 4 + j * 4]) zm[parseInt(j / 8) + i * bs] += bitArr[j % 8]; + + var zm1 = new Array(bs * fontSize_height); + var outstr1 = ""; + for (var i in zm) zm1[i] = zm[i].toString(2); + for (var i in zm1) { + var str = ""; + for (var j = 0; j < 8 - zm1[i].length; j++)str += "0"; + zm1[i] = str + zm1[i]; + } + for (var i in zm1) outstr1 += zm1[i]; + + var HZ_image = ""; + var num_hz = 0; + for (var i = 0; i < fontSize_width; i++) { + HZ_image += "--"; + if (i == (fontSize_width - 1)) HZ_image += "\n|"; + } + + for (var data_hz of outstr1) { + num_hz++; + if (num_hz == outstr1.length) { + HZ_image += "|\n"; + } + else if (num_hz % (bs * 8) < fontSize_width && num_hz % (bs * 8) > 0) { + if (data_hz == "0") HZ_image += " "; + else if (data_hz == "1") HZ_image += "0 "; + } + else if (num_hz % (bs * 8) == 0) { + HZ_image += "|\n|"; + } + } + for (var i = 0; i < fontSize_width; i++) { + HZ_image += "--"; + } + HZ_image = "/*" + "\n" + HZ_image + "\n" + "*/"; + + var hz_sharp = ""; + switch (dropdown_hz_sharp) { + case "STHeiti": + hz_sharp = "华文黑体"; + break; + case "STKaiti": + hz_sharp = "华文楷体"; + break; + case "STXihei": + hz_sharp = "华文细黑"; + break; + case "STSong": + hz_sharp = "华文宋体"; + break; + case "STZhongsong": + hz_sharp = "华文中宋"; + break; + case "STFangsong": + hz_sharp = "华文仿宋"; + break; + case "STCaiyun": + hz_sharp = "华文彩云"; + break; + case "STHupo": + hz_sharp = "华文琥珀"; + break; + case "STLiti": + hz_sharp = "华文隶书"; + break; + case "STXingkai": + hz_sharp = "华文行楷"; + break; + case "STXinwei": + hz_sharp = "华文新魏"; + break; + case "simHei": + hz_sharp = "黑体"; + break; + case "simSun": + hz_sharp = "宋体"; + break; + case "NSimSun": + hz_sharp = "新宋体"; + break; + case "FangSong": + hz_sharp = "仿宋"; + break; + case "KaiTi": + hz_sharp = "楷体"; + break; + case "FangSong_GB2312": + hz_sharp = "仿宋_GB2312"; + break; + case "KaiTi_GB2312": + hz_sharp = "楷体_GB2312"; + break; + case "LiSu": + hz_sharp = "隶书"; + break; + case "YouYuan": + hz_sharp = "幼圆"; + break; + case "PMingLiU": + hz_sharp = "新细明体"; + break; + case "MingLiU": + hz_sharp = "细明体"; + break; + case "DFKai-SB": + hz_sharp = "标楷体"; + break; + case "Microsoft JhengHei": + hz_sharp = "微软正黑体"; + break; + case "Microsoft YaHei": + hz_sharp = "微软雅黑体"; + break; + default: + hz_sharp = dropdown_hz_sharp; + break; + } + hz_sharp = "字体:" + hz_sharp + " 字号:" + text_hz_line_height + "px" + " 显示文字:" + text_input_data + '\n' + HZ_image; + + var modulus_array = new Array(); + for (var i = 0; i < fontSize_height; i++) { + modulus_array[i] = new Array(); + for (var j = 0; j < bs * 8; j++) { + modulus_array[i][j] = ""; + } + } + + for (var i = 1; i <= fontSize_height; i++) { + for (var j = 1; j <= bs * 8; j++) { + modulus_array[i - 1][j - 1] = outstr1.charAt((i - 1) * bs * 8 + j - 1); + } + } + //取模方式 + //逐列式 - 1,逐行式 - 2,列行式 - 3,行列式 - 4 + + //取模走向 + //顺向(高位在前) - 1,逆向(低位在前) - 2 + var bit_num = fontSize_height * bs; + var modulus_data = ""; + var array_x = 0; + var array_y = 0; + var modulus_y = Math.ceil(fontSize_height / 8); + var modulus_x = Math.ceil(fontSize_width / 8); + + //if(dropdown_modulus_direction == '1') + //{ + //逐列式 - 1 + if (dropdown_modulus_way == '1') { + bit_num = modulus_y * fontSize_width; + for (var j = 1; j <= bit_num; j++) { + for (var i = 1; i <= 8; i++) { + if (j % modulus_y == 0) + array_y = (modulus_y - 1) * 8 + i - 1; + else + array_y = (j % modulus_y - 1) * 8 + i - 1; + + array_x = Math.ceil(j / modulus_y) - 1; + if (array_x > (fontSize_width - 1)) + break; + if (array_y > (fontSize_height - 1)) { + if (dropdown_bitmap_formats == '1') + modulus_data += "0"; + else + modulus_data += "1"; + continue; + } + + //modulus_data+=modulus_array[array_y][array_x]; + if (dropdown_bitmap_formats == '1') + modulus_data += modulus_array[array_y][array_x]; + else { + if (modulus_array[array_y][array_x] == "0") + modulus_data += "1"; + else + modulus_data += "0"; + } + } + modulus_data += ","; + } + } + //逐行式 - 2 + else if (dropdown_modulus_way == '2') { + bit_num = modulus_x * fontSize_height; + for (var j = 1; j <= bit_num; j++) { + for (var i = 1; i <= 8; i++) { + if (j % modulus_x == 0) + array_x = (modulus_x - 1) * 8 + i - 1; + else + array_x = (j % modulus_x - 1) * 8 + i - 1; + array_y = Math.ceil(j / modulus_x) - 1; + + //modulus_data+=modulus_array[array_y][array_x]; + if (dropdown_bitmap_formats == '1') + modulus_data += modulus_array[array_y][array_x]; + else { + if (modulus_array[array_y][array_x] == "0") + modulus_data += "1"; + else + modulus_data += "0"; + } + } + modulus_data += ","; + } + } + //列行式 - 3 + else if (dropdown_modulus_way == '3') { + bit_num = modulus_y * fontSize_width; + for (var j = 1; j <= bit_num; j++) { + for (var i = 1; i <= 8; i++) { + if (j % (modulus_x * 8) == 0) + array_x = modulus_x * 8 - 1; + else + array_x = j % (modulus_x * 8) - 1; + array_y = (Math.ceil(j / (modulus_x * 8)) - 1) * 8 + i - 1; + if (array_x > (fontSize_width - 1)) + break; + if (array_y > (fontSize_height - 1)) { + if (dropdown_bitmap_formats == '1') + modulus_data += "0"; + else + modulus_data += "1"; + continue; + } + + //modulus_data+=modulus_array[array_y][array_x]; + if (dropdown_bitmap_formats == '1') + modulus_data += modulus_array[array_y][array_x]; + else { + if (modulus_array[array_y][array_x] == "0") + modulus_data += "1"; + else + modulus_data += "0"; + } + } + modulus_data += ","; + } + } + //行列式 - 4 + else if (dropdown_modulus_way == '4') { + bit_num = modulus_x * fontSize_height; + for (var j = 1; j <= bit_num; j++) { + for (var i = 1; i <= 8; i++) { + if (j % fontSize_height == 0) + array_y = fontSize_height - 1; + else + array_y = j % fontSize_height - 1; + array_x = (Math.ceil(j / fontSize_height) - 1) * 8 + i - 1; + + //modulus_data+=modulus_array[array_y][array_x]; + if (dropdown_bitmap_formats == '1') + modulus_data += modulus_array[array_y][array_x]; + else { + if (modulus_array[array_y][array_x] == "0") + modulus_data += "1"; + else + modulus_data += "0"; + } + } + modulus_data += ","; + } + } + //} + var now_data = ""; + var end_data = ""; + if (dropdown_modulus_direction == 2) { + for (var i of modulus_data) { + if (i == ",") { + end_data += now_data; + end_data += ","; + now_data = ""; + } + else + now_data = i + now_data; + } + modulus_data = end_data; + } + + now_data = ""; + end_data = "0x"; + for (var i of modulus_data) { + if (i == ",") { + end_data += ",0x"; + continue; + } + now_data += i; + if (now_data.length == 4) { + end_data += string_Bin_to_Hex(now_data); + now_data = ""; + } + } + modulus_data = end_data; + modulus_data = modulus_data.substring(0, modulus_data.length - 3); + + if (checkbox_show_hz) + generator.definitions_['var_declare_tool_modulus_data_' + dropdown_hz_sharp + '_' + text_hz_line_height + 'px' + encodeUnicode(text_input_data)] = '//' + hz_sharp; + + var code = modulus_data; + return [code, generator.ORDER_ATOMIC]; +} + +//获取两个日期差值 +export const get_the_number_of_days_between_the_two_dates = function (_, generator) { + var year_start = generator.valueToCode(this, 'year_start', generator.ORDER_ATOMIC); + var month_start = generator.valueToCode(this, 'month_start', generator.ORDER_ATOMIC); + var day_start = generator.valueToCode(this, 'day_start', generator.ORDER_ATOMIC); + var year_end = generator.valueToCode(this, 'year_end', generator.ORDER_ATOMIC); + var month_end = generator.valueToCode(this, 'month_end', generator.ORDER_ATOMIC); + var day_end = generator.valueToCode(this, 'day_end', generator.ORDER_ATOMIC); + generator.definitions_['get_the_number_of_days_between_the_two_dates'] = 'int day_diff(int year_start, int month_start, int day_start, int year_end, int month_end, int day_end)\n{\n int y2, m2, d2;\n int y1, m1, d1;\n m1 = (month_start + 9) % 12;\n y1 = year_start - m1/10;\n d1 = 365*y1 + y1/4 - y1/100 + y1/400 + (m1*306 + 5)/10 + (day_start - 1);\n m2 = (month_end + 9) % 12;\n y2 = year_end - m2/10;\n d2 = 365*y2 + y2/4 - y2/100 + y2/400 + (m2*306 + 5)/10 + (day_end - 1);\n return (d2 - d1);\n}'; + var code = 'day_diff(' + year_start + ', ' + month_start + ', ' + day_start + ', ' + year_end + ', ' + month_end + ', ' + day_end + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const esp8266_board_pin = function (_, generator) { + var pin = this.getFieldValue('pin'); + var code = '' + pin + ''; + return [code, generator.ORDER_ATOMIC]; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/index.js b/mixly/boards/default_src/arduino_avr/index.js new file mode 100644 index 00000000..25904c2e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/index.js @@ -0,0 +1,124 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +import { + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + Procedures, + Variables, + Arduino +} from '@mixly/arduino'; + +import { + ArduinoAVRPins, + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinoutBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRScoopBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinoutGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRScoopGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators +} from './'; + +import './css/color.css'; + +Blockly.Arduino = Arduino; +Blockly.generator = Arduino; + +Object.assign(Blockly.Variables, Variables); +Object.assign(Blockly.Procedures, Procedures); + +Profile.default = {}; +Object.assign(Profile, ArduinoAVRPins); +Object.assign(Profile.default, ArduinoAVRPins.arduino_standard); + +Object.assign( + Blockly.Blocks, + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinoutBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRScoopBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks +); + +Object.assign( + Blockly.Arduino.forBlock, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinoutGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRScoopGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators +); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/jsconfig.json b/mixly/boards/default_src/arduino_avr/jsconfig.json new file mode 100644 index 00000000..143a8a42 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/jsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "baseUrl": "./", + "paths": { + "@mixly/arduino": [ + "../arduino" + ] + } + }, + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/media/blocks_icons/loop.png b/mixly/boards/default_src/arduino_avr/media/blocks_icons/loop.png new file mode 100644 index 00000000..e3f81030 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blocks_icons/loop.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/iot.png b/mixly/boards/default_src/arduino_avr/media/blynk/iot.png new file mode 100644 index 00000000..e9daa342 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/iot.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_accelerometer_sensor.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_accelerometer_sensor.png new file mode 100644 index 00000000..e31416e1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_accelerometer_sensor.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_bridge.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_bridge.png new file mode 100644 index 00000000..7225116d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_bridge.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_email.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_email.png new file mode 100644 index 00000000..82e51e6a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_email.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_gravity_sensor.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_gravity_sensor.png new file mode 100644 index 00000000..6df50bed Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_gravity_sensor.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd.png new file mode 100644 index 00000000..4a8aee1d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd2.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd2.png new file mode 100644 index 00000000..786b8b45 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_lcd2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_led.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_led.png new file mode 100644 index 00000000..948ed1dc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_led.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_light_sensor.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_light_sensor.png new file mode 100644 index 00000000..5b5dcd5f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_light_sensor.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_player.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_player.png new file mode 100644 index 00000000..e2efcb9f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_player.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_push_notifications.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_push_notifications.png new file mode 100644 index 00000000..23a8db43 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_push_notifications.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_rtc.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_rtc.png new file mode 100644 index 00000000..13b65373 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_rtc.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_terminal.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_terminal.png new file mode 100644 index 00000000..496737e4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_terminal.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_timeinput.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_timeinput.png new file mode 100644 index 00000000..3eeaa32f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_timeinput.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/widget_video.png b/mixly/boards/default_src/arduino_avr/media/blynk/widget_video.png new file mode 100644 index 00000000..d7beab4d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/widget_video.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/blynk/wifi_udp.png b/mixly/boards/default_src/arduino_avr/media/blynk/wifi_udp.png new file mode 100644 index 00000000..c5c6fcff Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/blynk/wifi_udp.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/boards/Leonardo.png b/mixly/boards/default_src/arduino_avr/media/boards/Leonardo.png new file mode 100644 index 00000000..d00850ed Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/boards/Leonardo.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/boards/Mega.png b/mixly/boards/default_src/arduino_avr/media/boards/Mega.png new file mode 100644 index 00000000..660d3895 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/boards/Mega.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/boards/Nano.png b/mixly/boards/default_src/arduino_avr/media/boards/Nano.png new file mode 100644 index 00000000..196839f1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/boards/Nano.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/boards/ProMini.png b/mixly/boards/default_src/arduino_avr/media/boards/ProMini.png new file mode 100644 index 00000000..2c95ed7b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/boards/ProMini.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/boards/Uno.png b/mixly/boards/default_src/arduino_avr/media/boards/Uno.png new file mode 100644 index 00000000..7e7c9465 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/boards/Uno.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/btn/setting.png b/mixly/boards/default_src/arduino_avr/media/btn/setting.png new file mode 100644 index 00000000..158fc1c8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/btn/setting.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/100.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/100.png new file mode 100644 index 00000000..562207e7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/100.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/101.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/101.png new file mode 100644 index 00000000..721d1fb0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/101.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/102.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/102.png new file mode 100644 index 00000000..814f3e0c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/102.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/103.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/103.png new file mode 100644 index 00000000..4f764fd7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/103.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/104.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/104.png new file mode 100644 index 00000000..9f9c522a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/104.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/105.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/105.png new file mode 100644 index 00000000..fae65d89 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/105.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/106.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/106.png new file mode 100644 index 00000000..b5edbcf5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/106.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/107.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/107.png new file mode 100644 index 00000000..0f1d1ff5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/107.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/108.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/108.png new file mode 100644 index 00000000..e59845fb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/108.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/109.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/109.png new file mode 100644 index 00000000..81aec12b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/109.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/110.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/110.png new file mode 100644 index 00000000..6388b699 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/110.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/111.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/111.png new file mode 100644 index 00000000..483b5027 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/111.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/112.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/112.png new file mode 100644 index 00000000..eabafd6d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/112.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/113.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/113.png new file mode 100644 index 00000000..74f6b250 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/113.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/114.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/114.png new file mode 100644 index 00000000..19a1b721 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/114.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/115.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/115.png new file mode 100644 index 00000000..5637f87f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/115.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/116.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/116.png new file mode 100644 index 00000000..a55b0062 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/116.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/117.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/117.png new file mode 100644 index 00000000..7a4d0c6b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/117.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/118.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/118.png new file mode 100644 index 00000000..db7ab939 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/118.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/119.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/119.png new file mode 100644 index 00000000..5d0d49fd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/119.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/120.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/120.png new file mode 100644 index 00000000..1d9ba11f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/120.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/121.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/121.png new file mode 100644 index 00000000..eb58218b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/121.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/122.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/122.png new file mode 100644 index 00000000..4aec08a9 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/122.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/123.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/123.png new file mode 100644 index 00000000..fa8c7904 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/123.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/124.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/124.png new file mode 100644 index 00000000..d9496b67 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/124.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/125.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/125.png new file mode 100644 index 00000000..0b5fac21 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/125.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/126.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/126.png new file mode 100644 index 00000000..a3806536 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/126.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/127.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/127.png new file mode 100644 index 00000000..f2f3bfa8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/127.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/128.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/128.png new file mode 100644 index 00000000..37b49879 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/128.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/129.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/129.png new file mode 100644 index 00000000..5e8aebaf Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/129.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/130.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/130.png new file mode 100644 index 00000000..8e6a2d70 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/130.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/131.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/131.png new file mode 100644 index 00000000..5ac0438d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/131.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/132.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/132.png new file mode 100644 index 00000000..c0702d98 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/132.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/133.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/133.png new file mode 100644 index 00000000..91f54452 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/133.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/134.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/134.png new file mode 100644 index 00000000..368e4fe7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/134.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/135.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/135.png new file mode 100644 index 00000000..2b6cb083 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/135.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/136.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/136.png new file mode 100644 index 00000000..85336cb0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/136.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/137.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/137.png new file mode 100644 index 00000000..2243846d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/137.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/138.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/138.png new file mode 100644 index 00000000..cd084851 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/138.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/139.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/139.png new file mode 100644 index 00000000..c56c7615 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/139.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/140.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/140.png new file mode 100644 index 00000000..17a0a119 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/140.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/141.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/141.png new file mode 100644 index 00000000..f3007282 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/141.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/142.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/142.png new file mode 100644 index 00000000..5ddb4fc4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/142.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/143.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/143.png new file mode 100644 index 00000000..c525af88 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/143.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/144.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/144.png new file mode 100644 index 00000000..0ee9cdfc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/144.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/145.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/145.png new file mode 100644 index 00000000..7a847e97 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/145.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/146.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/146.png new file mode 100644 index 00000000..18273e99 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/146.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/147.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/147.png new file mode 100644 index 00000000..093c6711 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/147.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/148.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/148.png new file mode 100644 index 00000000..da1f3d38 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/148.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/149.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/149.png new file mode 100644 index 00000000..19cb4b30 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/149.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/150.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/150.png new file mode 100644 index 00000000..2063ffcc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/150.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/151.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/151.png new file mode 100644 index 00000000..4741737d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/151.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/152.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/152.png new file mode 100644 index 00000000..8af0d104 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/152.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/153.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/153.png new file mode 100644 index 00000000..4320671d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/153.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/154.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/154.png new file mode 100644 index 00000000..25bbd8fd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/154.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/155.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/155.png new file mode 100644 index 00000000..29d16a57 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/155.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/156.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/156.png new file mode 100644 index 00000000..22e93036 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/156.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/157.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/157.png new file mode 100644 index 00000000..c3ef6fa4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/157.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/158.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/158.png new file mode 100644 index 00000000..fc772fac Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/158.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/159.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/159.png new file mode 100644 index 00000000..97747301 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/159.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/160.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/160.png new file mode 100644 index 00000000..6379ca9b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/160.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/161.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/161.png new file mode 100644 index 00000000..a63c7a62 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/161.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/162.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/162.png new file mode 100644 index 00000000..ea480f19 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/162.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/163.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/163.png new file mode 100644 index 00000000..8536a28d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/163.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/164.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/164.png new file mode 100644 index 00000000..a56525c7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/164.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/165.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/165.png new file mode 100644 index 00000000..b909e81f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/165.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/166.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/166.png new file mode 100644 index 00000000..8f5a8917 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/166.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/167.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/167.png new file mode 100644 index 00000000..c972b7a4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/167.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/168.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/168.png new file mode 100644 index 00000000..250ced5c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/168.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/169.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/169.png new file mode 100644 index 00000000..dcb48dfc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/169.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/170.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/170.png new file mode 100644 index 00000000..cff3b11b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/170.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/171.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/171.png new file mode 100644 index 00000000..82da831c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/171.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/172.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/172.png new file mode 100644 index 00000000..7ba486e1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/172.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/173.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/173.png new file mode 100644 index 00000000..918dcfca Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/173.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/174.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/174.png new file mode 100644 index 00000000..009d1c26 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/174.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/175.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/175.png new file mode 100644 index 00000000..7a9156ff Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/175.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/176.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/176.png new file mode 100644 index 00000000..27f5d374 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/176.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/177.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/177.png new file mode 100644 index 00000000..232db2cd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/177.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/178.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/178.png new file mode 100644 index 00000000..8d02f98f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/178.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/179.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/179.png new file mode 100644 index 00000000..f5cc14da Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/179.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/180.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/180.png new file mode 100644 index 00000000..bbd35d21 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/180.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/181.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/181.png new file mode 100644 index 00000000..57f7e4e6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/181.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/182.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/182.png new file mode 100644 index 00000000..c69769cd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/182.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/183.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/183.png new file mode 100644 index 00000000..3e98f716 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/183.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/184.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/184.png new file mode 100644 index 00000000..ae09266c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/184.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/185.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/185.png new file mode 100644 index 00000000..f27cb99a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/185.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/186.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/186.png new file mode 100644 index 00000000..9cdc235e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/186.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/187.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/187.png new file mode 100644 index 00000000..8c6f1a66 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/187.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/188.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/188.png new file mode 100644 index 00000000..33658698 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/188.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/189.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/189.png new file mode 100644 index 00000000..6eb8dfff Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/189.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/190.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/190.png new file mode 100644 index 00000000..0a5999c1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/190.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/191.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/191.png new file mode 100644 index 00000000..86dd0d25 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/191.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/192.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/192.png new file mode 100644 index 00000000..6674a0bf Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/192.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/193.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/193.png new file mode 100644 index 00000000..6318d7c1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/193.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/194.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/194.png new file mode 100644 index 00000000..05aec8dc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/194.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/195.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/195.png new file mode 100644 index 00000000..7d9f6ff0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/195.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/196.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/196.png new file mode 100644 index 00000000..0da6198f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/196.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/197.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/197.png new file mode 100644 index 00000000..939fe664 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/197.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/198.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/198.png new file mode 100644 index 00000000..5064fb13 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/198.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/199.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/199.png new file mode 100644 index 00000000..3aebf433 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/199.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/200.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/200.png new file mode 100644 index 00000000..3b21688b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/200.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/201.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/201.png new file mode 100644 index 00000000..179c4f5b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/201.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/202.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/202.png new file mode 100644 index 00000000..16de67cb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/202.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/203.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/203.png new file mode 100644 index 00000000..0f8dcfb3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/203.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/204.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/204.png new file mode 100644 index 00000000..40dc096e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/204.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/205.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/205.png new file mode 100644 index 00000000..ec81a26b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/205.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/206.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/206.png new file mode 100644 index 00000000..2e949aa4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/206.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/207.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/207.png new file mode 100644 index 00000000..0e3fc6dc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/207.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/208.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/208.png new file mode 100644 index 00000000..4d73a459 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/208.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/209.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/209.png new file mode 100644 index 00000000..d8e950a2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/209.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/210.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/210.png new file mode 100644 index 00000000..2eaf875a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/210.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/211.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/211.png new file mode 100644 index 00000000..7b7b9af0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/211.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/212.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/212.png new file mode 100644 index 00000000..5b4f39fb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/212.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/213.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/213.png new file mode 100644 index 00000000..f670cf83 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/213.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/214.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/214.png new file mode 100644 index 00000000..fde2c536 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/214.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/215.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/215.png new file mode 100644 index 00000000..bb24ffd8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/215.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/216.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/216.png new file mode 100644 index 00000000..eeeaed70 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/216.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/217.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/217.png new file mode 100644 index 00000000..239105c8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/217.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/218.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/218.png new file mode 100644 index 00000000..9511cd53 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/218.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/219.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/219.png new file mode 100644 index 00000000..e69f6349 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/219.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/220.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/220.png new file mode 100644 index 00000000..534a1c1e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/220.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/221.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/221.png new file mode 100644 index 00000000..770afa8f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/221.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/222.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/222.png new file mode 100644 index 00000000..21549488 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/222.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/223.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/223.png new file mode 100644 index 00000000..57878df6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/223.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/224.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/224.png new file mode 100644 index 00000000..9aaeb622 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/224.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/225.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/225.png new file mode 100644 index 00000000..5b6266ce Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/225.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/226.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/226.png new file mode 100644 index 00000000..e20b44a7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/226.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/227.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/227.png new file mode 100644 index 00000000..ac7e666b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/227.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/228.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/228.png new file mode 100644 index 00000000..85e525dd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/228.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/229.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/229.png new file mode 100644 index 00000000..645cefdd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/229.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/230.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/230.png new file mode 100644 index 00000000..0ef87cb4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/230.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/231.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/231.png new file mode 100644 index 00000000..9de7de96 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/231.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/232.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/232.png new file mode 100644 index 00000000..6ff1e02e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/232.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/233.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/233.png new file mode 100644 index 00000000..47bcf388 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/233.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/234.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/234.png new file mode 100644 index 00000000..401af424 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/234.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/235.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/235.png new file mode 100644 index 00000000..cbffcd56 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/235.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/236.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/236.png new file mode 100644 index 00000000..3920208d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/236.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/237.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/237.png new file mode 100644 index 00000000..48ac5a07 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/237.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/238.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/238.png new file mode 100644 index 00000000..3f7377c0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/238.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/239.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/239.png new file mode 100644 index 00000000..3f2084f5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/239.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/240.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/240.png new file mode 100644 index 00000000..eb7b4397 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/240.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/241.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/241.png new file mode 100644 index 00000000..67ca2056 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/241.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/242.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/242.png new file mode 100644 index 00000000..b392bd5d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/242.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/243.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/243.png new file mode 100644 index 00000000..3de229c8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/243.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/244.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/244.png new file mode 100644 index 00000000..5e6bc981 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/244.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/245.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/245.png new file mode 100644 index 00000000..479e5669 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/245.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/246.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/246.png new file mode 100644 index 00000000..8844ed30 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/246.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/247.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/247.png new file mode 100644 index 00000000..fb21c9ec Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/247.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/248.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/248.png new file mode 100644 index 00000000..5be1c12b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/248.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/249.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/249.png new file mode 100644 index 00000000..ae6386f3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/249.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/250.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/250.png new file mode 100644 index 00000000..39749fb1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/250.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/251.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/251.png new file mode 100644 index 00000000..2f5b113b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/251.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/252.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/252.png new file mode 100644 index 00000000..be4d87db Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/252.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/253.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/253.png new file mode 100644 index 00000000..44094cdf Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/253.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/254.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/254.png new file mode 100644 index 00000000..a160561f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/254.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/255.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/255.png new file mode 100644 index 00000000..f46d38cf Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/255.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/256.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/256.png new file mode 100644 index 00000000..0988a740 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/256.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/257.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/257.png new file mode 100644 index 00000000..1c04c294 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/257.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/258.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/258.png new file mode 100644 index 00000000..16ecee9d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/258.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/259.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/259.png new file mode 100644 index 00000000..9cfa64dd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/259.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/260.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/260.png new file mode 100644 index 00000000..a598624c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/260.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/261.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/261.png new file mode 100644 index 00000000..a3606fb1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/261.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/262.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/262.png new file mode 100644 index 00000000..f8ce26ad Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/262.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/263.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/263.png new file mode 100644 index 00000000..359a72b7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/263.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/264.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/264.png new file mode 100644 index 00000000..2a0d4886 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/264.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/265.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/265.png new file mode 100644 index 00000000..3c041716 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/265.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/266.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/266.png new file mode 100644 index 00000000..049cada4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/266.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/267.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/267.png new file mode 100644 index 00000000..2b619422 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/267.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/268.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/268.png new file mode 100644 index 00000000..3a068d73 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/268.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/269.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/269.png new file mode 100644 index 00000000..7326e6c3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/269.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/270.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/270.png new file mode 100644 index 00000000..1618b8ea Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/270.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/271.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/271.png new file mode 100644 index 00000000..0c4e4e4b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/271.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/272.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/272.png new file mode 100644 index 00000000..73a52331 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/272.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/273.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/273.png new file mode 100644 index 00000000..4cf39000 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/273.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/274.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/274.png new file mode 100644 index 00000000..5ac3a00d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/274.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/275.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/275.png new file mode 100644 index 00000000..4f330ce6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/275.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/276.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/276.png new file mode 100644 index 00000000..0aa328a0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/276.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/277.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/277.png new file mode 100644 index 00000000..a01b1f39 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/277.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/278.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/278.png new file mode 100644 index 00000000..9886fbea Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/278.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/279.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/279.png new file mode 100644 index 00000000..9fdce3de Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/279.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/280.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/280.png new file mode 100644 index 00000000..7626bd7f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/280.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/281.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/281.png new file mode 100644 index 00000000..9dab2925 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/281.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/282.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/282.png new file mode 100644 index 00000000..01989681 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/282.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/283.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/283.png new file mode 100644 index 00000000..b0aae2c6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/283.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/284.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/284.png new file mode 100644 index 00000000..07858e40 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/284.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/285.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/285.png new file mode 100644 index 00000000..f1b8052d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/285.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/286.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/286.png new file mode 100644 index 00000000..1fe6a239 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/286.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/64.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/64.png new file mode 100644 index 00000000..dbfbb16a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/64.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/65.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/65.png new file mode 100644 index 00000000..bc757088 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/65.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/66.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/66.png new file mode 100644 index 00000000..3d55df59 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/66.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/67.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/67.png new file mode 100644 index 00000000..669bc26c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/67.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/68.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/68.png new file mode 100644 index 00000000..e1520abd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/68.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/69.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/69.png new file mode 100644 index 00000000..1e3b6cfe Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/69.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/70.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/70.png new file mode 100644 index 00000000..e1eae41f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/70.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/71.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/71.png new file mode 100644 index 00000000..99e3e395 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/71.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/72.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/72.png new file mode 100644 index 00000000..048cc8dd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/72.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/73.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/73.png new file mode 100644 index 00000000..7b341764 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/73.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/74.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/74.png new file mode 100644 index 00000000..b81b573c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/74.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/75.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/75.png new file mode 100644 index 00000000..7885a51d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/75.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/76.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/76.png new file mode 100644 index 00000000..ef8f183d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/76.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/77.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/77.png new file mode 100644 index 00000000..e3d20545 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/77.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/78.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/78.png new file mode 100644 index 00000000..505269b0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/78.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/79.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/79.png new file mode 100644 index 00000000..1e749b7d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/79.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/80.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/80.png new file mode 100644 index 00000000..65ce624f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/80.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/81.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/81.png new file mode 100644 index 00000000..7ae56802 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/81.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/82.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/82.png new file mode 100644 index 00000000..3f1963e8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/82.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/83.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/83.png new file mode 100644 index 00000000..b85cb254 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/83.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/84.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/84.png new file mode 100644 index 00000000..566fd7c2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/84.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/85.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/85.png new file mode 100644 index 00000000..f2a48e2b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/85.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/86.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/86.png new file mode 100644 index 00000000..aa41cb8b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/86.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/87.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/87.png new file mode 100644 index 00000000..554af276 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/87.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/88.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/88.png new file mode 100644 index 00000000..3395079d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/88.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/89.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/89.png new file mode 100644 index 00000000..395557a1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/89.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/90.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/90.png new file mode 100644 index 00000000..39551064 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/90.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/91.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/91.png new file mode 100644 index 00000000..de747ea2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/91.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/92.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/92.png new file mode 100644 index 00000000..131246f7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/92.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/93.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/93.png new file mode 100644 index 00000000..c3790aa8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/93.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/94.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/94.png new file mode 100644 index 00000000..44b2f691 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/94.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/95.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/95.png new file mode 100644 index 00000000..f23d3e68 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/95.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/96.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/96.png new file mode 100644 index 00000000..2e811f50 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/96.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/97.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/97.png new file mode 100644 index 00000000..b90d1a37 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/97.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/98.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/98.png new file mode 100644 index 00000000..9eee6552 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/98.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/99.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/99.png new file mode 100644 index 00000000..a7cc48e0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/99.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/1.png new file mode 100644 index 00000000..7686d399 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/10.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/10.png new file mode 100644 index 00000000..75953c92 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/10.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/11.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/11.png new file mode 100644 index 00000000..4f69f637 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/11.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/12.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/12.png new file mode 100644 index 00000000..2f09a1bf Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/12.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/2.png new file mode 100644 index 00000000..f1ff20a8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/3.png new file mode 100644 index 00000000..389fd6b4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/4.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/4.png new file mode 100644 index 00000000..3ea7fa26 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/4.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/5.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/5.png new file mode 100644 index 00000000..2e120b4a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/5.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/6.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/6.png new file mode 100644 index 00000000..b2f30aeb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/6.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/7.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/7.png new file mode 100644 index 00000000..17a62d0e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/7.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/8.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/8.png new file mode 100644 index 00000000..ffe35e03 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/8.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/9.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/9.png new file mode 100644 index 00000000..5118c40c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/9.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Big smile.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Big smile.png new file mode 100644 index 00000000..5bc84af7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Big smile.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart large.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart large.png new file mode 100644 index 00000000..42eebd96 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart large.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart small.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart small.png new file mode 100644 index 00000000..c5524ef3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Heart small.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 open.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 open.png new file mode 100644 index 00000000..1dadad34 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 open.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 shut.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 shut.png new file mode 100644 index 00000000..29bc794b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 1 shut.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 open.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 open.png new file mode 100644 index 00000000..32e7ab29 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 open.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 shut.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 shut.png new file mode 100644 index 00000000..535553b8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Mouth 2 shut.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sad.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sad.png new file mode 100644 index 00000000..e98969ea Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sad.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sick.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sick.png new file mode 100644 index 00000000..19aaf372 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Sick.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Smile.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Smile.png new file mode 100644 index 00000000..dffe7176 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Smile.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Swearing.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Swearing.png new file mode 100644 index 00000000..1db1fd87 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Swearing.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Talking.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Talking.png new file mode 100644 index 00000000..80aad2cd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Talking.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Wink.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Wink.png new file mode 100644 index 00000000..2c30ce72 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/Wink.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/ZZZ.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/ZZZ.png new file mode 100644 index 00000000..03ecea74 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Expressions/ZZZ.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Angry.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Angry.png new file mode 100644 index 00000000..665bf38c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Angry.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Awake.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Awake.png new file mode 100644 index 00000000..a3cd569b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Awake.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Black eye.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Black eye.png new file mode 100644 index 00000000..d02d0f73 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Black eye.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom left.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom left.png new file mode 100644 index 00000000..c3d2df0f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom left.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom right.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom right.png new file mode 100644 index 00000000..544144fb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Bottom right.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 1.png new file mode 100644 index 00000000..954d6610 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 2.png new file mode 100644 index 00000000..d1fab5a3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Crazy 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Disappointed.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Disappointed.png new file mode 100644 index 00000000..06f27617 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Disappointed.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Dizzy.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Dizzy.png new file mode 100644 index 00000000..367a8b81 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Dizzy.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Down.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Down.png new file mode 100644 index 00000000..1bbb7464 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Down.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Evil.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Evil.png new file mode 100644 index 00000000..7950b4de Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Evil.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Hurt.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Hurt.png new file mode 100644 index 00000000..748a2813 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Hurt.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Knocked out.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Knocked out.png new file mode 100644 index 00000000..ab74e245 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Knocked out.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Love.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Love.png new file mode 100644 index 00000000..0bea7f3d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Love.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle left.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle left.png new file mode 100644 index 00000000..a7f56f95 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle left.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle right.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle right.png new file mode 100644 index 00000000..35f55bee Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Middle right.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Neutral.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Neutral.png new file mode 100644 index 00000000..c91e934f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Neutral.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Nuclear.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Nuclear.png new file mode 100644 index 00000000..4d67b532 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Nuclear.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch left.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch left.png new file mode 100644 index 00000000..5f284bdd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch left.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch middle.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch middle.png new file mode 100644 index 00000000..0f222ba1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch middle.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch right.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch right.png new file mode 100644 index 00000000..cd2351a6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Pinch right.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tear.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tear.png new file mode 100644 index 00000000..4d961761 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tear.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired left.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired left.png new file mode 100644 index 00000000..23a4dc48 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired left.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired middle.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired middle.png new file mode 100644 index 00000000..e893fa0b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired middle.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired right.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired right.png new file mode 100644 index 00000000..6707b4ef Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Tired right.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Toxic.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Toxic.png new file mode 100644 index 00000000..5de71150 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Toxic.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Up.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Up.png new file mode 100644 index 00000000..b104103b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Up.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Winking.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Winking.png new file mode 100644 index 00000000..e230b414 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Eyes/Winking.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Accept.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Accept.png new file mode 100644 index 00000000..863b98a4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Accept.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Backward.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Backward.png new file mode 100644 index 00000000..3cdab138 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Backward.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Decline.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Decline.png new file mode 100644 index 00000000..617f6188 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Decline.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Forward.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Forward.png new file mode 100644 index 00000000..4606b66c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Forward.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Left.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Left.png new file mode 100644 index 00000000..7d369ab1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Left.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/No go.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/No go.png new file mode 100644 index 00000000..fe138ca4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/No go.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Question mark.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Question mark.png new file mode 100644 index 00000000..aee1b1ae Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Question mark.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Right.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Right.png new file mode 100644 index 00000000..cc4e4852 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Right.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 1.png new file mode 100644 index 00000000..36330301 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 2.png new file mode 100644 index 00000000..8415cb30 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Stop 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs down.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs down.png new file mode 100644 index 00000000..704bdaa5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs down.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs up.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs up.png new file mode 100644 index 00000000..a405824a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Thumbs up.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Warning.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Warning.png new file mode 100644 index 00000000..5b7fc217 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Information/Warning.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Bomb.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Bomb.png new file mode 100644 index 00000000..b2974638 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Bomb.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Boom.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Boom.png new file mode 100644 index 00000000..559d6de5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Boom.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Fire.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Fire.png new file mode 100644 index 00000000..fc3b036b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Fire.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Flowers.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Flowers.png new file mode 100644 index 00000000..8e4239af Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Flowers.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Forest.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Forest.png new file mode 100644 index 00000000..1c999710 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Forest.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light off.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light off.png new file mode 100644 index 00000000..fd2a478e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light off.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light on.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light on.png new file mode 100644 index 00000000..c0013007 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Light on.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Lightning.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Lightning.png new file mode 100644 index 00000000..2540ea87 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Lightning.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Night.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Night.png new file mode 100644 index 00000000..fb779593 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Night.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Pirate.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Pirate.png new file mode 100644 index 00000000..abf76b21 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Pirate.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Snow.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Snow.png new file mode 100644 index 00000000..5471e6c5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Snow.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Target.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Target.png new file mode 100644 index 00000000..e5c1a447 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Objects/Target.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 0.png new file mode 100644 index 00000000..afaad742 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 1.png new file mode 100644 index 00000000..da79fe6d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 2.png new file mode 100644 index 00000000..01d98f38 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 3.png new file mode 100644 index 00000000..48b5d728 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 4.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 4.png new file mode 100644 index 00000000..22b18adc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Bar 4.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 0.png new file mode 100644 index 00000000..05fa892e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 1.png new file mode 100644 index 00000000..a64ce5e8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 2.png new file mode 100644 index 00000000..250df38f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 3.png new file mode 100644 index 00000000..db2b650b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 4.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 4.png new file mode 100644 index 00000000..033fd7e7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dial 4.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 0.png new file mode 100644 index 00000000..e0f444cb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 1.png new file mode 100644 index 00000000..9aa5cab4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 2.png new file mode 100644 index 00000000..007dbafd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 3.png new file mode 100644 index 00000000..de5505a1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Dots 3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 0.png new file mode 100644 index 00000000..3d17a76d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 1.png new file mode 100644 index 00000000..e80265b0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 2.png new file mode 100644 index 00000000..5fbb34af Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Hourglass 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 0.png new file mode 100644 index 00000000..97c497a7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 1.png new file mode 100644 index 00000000..19f7c267 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 2.png new file mode 100644 index 00000000..b10b9528 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 3.png new file mode 100644 index 00000000..517277ff Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 4.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 4.png new file mode 100644 index 00000000..ef4cc940 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Timer 4.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 0.png new file mode 100644 index 00000000..c85d62c0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 1.png new file mode 100644 index 00000000..b9018c1f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 2.png new file mode 100644 index 00000000..2dc1c16d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 3.png new file mode 100644 index 00000000..9e1a4bd3 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/Progress/Water level 3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_1.png new file mode 100644 index 00000000..83a7a2d4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_2.png new file mode 100644 index 00000000..8a6045e4 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Accept_2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Alert.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Alert.png new file mode 100644 index 00000000..284939cb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Alert.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Box.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Box.png new file mode 100644 index 00000000..8f67d7c2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Box.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_0.png new file mode 100644 index 00000000..5dd2cf34 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_1.png new file mode 100644 index 00000000..7fcb4ba0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Busy_1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_1.png new file mode 100644 index 00000000..aac95171 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_2.png new file mode 100644 index 00000000..34d8c00f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Decline_2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_empty.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_empty.png new file mode 100644 index 00000000..833d9a0a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_empty.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_full.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_full.png new file mode 100644 index 00000000..fa18c45a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Dot_full.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Play.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Play.png new file mode 100644 index 00000000..8083fdd2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Play.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_0.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_0.png new file mode 100644 index 00000000..f4fccfca Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_0.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_1.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_1.png new file mode 100644 index 00000000..568c6108 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_1.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_2.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_2.png new file mode 100644 index 00000000..ebb15bb5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_2.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_3.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_3.png new file mode 100644 index 00000000..66c495cd Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_3.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_4.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_4.png new file mode 100644 index 00000000..4cfd383f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_4.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_5.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_5.png new file mode 100644 index 00000000..ff5ef71c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_5.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_6.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_6.png new file mode 100644 index 00000000..094f1712 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_6.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_7.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_7.png new file mode 100644 index 00000000..b814752c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_7.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_8.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_8.png new file mode 100644 index 00000000..c1423390 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/System/Slider_8.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/listFileName.bat b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/listFileName.bat new file mode 100644 index 00000000..4c4a0ce0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/listFileName.bat @@ -0,0 +1 @@ +dir *.* /b> namelist.txt \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper.png new file mode 100644 index 00000000..07414936 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper_s.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper_s.png new file mode 100644 index 00000000..76858ef8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/paper_s.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock.png new file mode 100644 index 00000000..de4845d6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock_s.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock_s.png new file mode 100644 index 00000000..18e69652 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/rock_s.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors.png new file mode 100644 index 00000000..bcb6a098 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors_s.png b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors_s.png new file mode 100644 index 00000000..8e37cf63 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/face/scissors_s.png differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/icons.psd b/mixly/boards/default_src/arduino_avr/media/oled_icons/icons.psd new file mode 100644 index 00000000..f6be65ee Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/icons.psd differ diff --git a/mixly/boards/default_src/arduino_avr/media/oled_icons/icons2.psd b/mixly/boards/default_src/arduino_avr/media/oled_icons/icons2.psd new file mode 100644 index 00000000..3d45bf32 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/media/oled_icons/icons2.psd differ diff --git a/mixly/boards/default_src/arduino_avr/origin/config.json b/mixly/boards/default_src/arduino_avr/origin/config.json new file mode 100644 index 00000000..731eb2be --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/config.json @@ -0,0 +1,113 @@ +{ + "board": { + "Arduino/Genuino Uno": { + "key": "arduino:avr:uno", + "config": [] + }, + "Arduino Nano": { + "key": "arduino:avr:nano", + "config": [ + { + "label": "Processor", + "key": "cpu", + "options": [ + { + "key": "atmega328old", + "label": "ATmega328P (Old Bootloader)" + }, { + "key": "atmega328", + "label": "ATmega328P" + }, { + "key": "atmega168", + "label": "ATmega168" + } + ] + } + ] + }, + "Arduino Pro or Pro Mini": { + "key": "arduino:avr:pro", + "config": [ + { + "label": "Processor", + "key": "cpu", + "options": [ + { + "key": "16MHzatmega328", + "label": "ATmega328P (5V, 16 MHz)" + }, { + "key": "8MHzatmega328", + "label": "ATmega328P (3.3V, 8 MHz)" + }, { + "key": "16MHzatmega168", + "label": "ATmega168 (5V, 16 MHz)" + }, { + "key": "8MHzatmega168", + "label": "ATmega168 (3.3V, 8 MHz)" + } + ] + } + ] + }, + "Arduino Mega or Mega 2560": { + "key": "arduino:avr:mega", + "config": [ + { + "label": "Processor", + "key": "cpu", + "options": [ + { + "key": "atmega2560", + "label": "ATmega2560 (Mega 2560)" + }, { + "key": "atmega1280", + "label": "ATmega1280" + } + ] + } + ] + }, + "Arduino Leonardo": "arduino:avr:leonardo" + }, + "language": "C/C++", + "burn": "None", + "upload": { + "portSelect": "all" + }, + "nav": { + "compile": true, + "upload": true, + "save": { + "ino": true, + "hex": true + }, + "setting": { + "thirdPartyLibrary": true, + "wiki": true + } + }, + "serial": { + "ctrlCBtn": false, + "ctrlDBtn": false, + "baudRates": 9600, + "yMax": 100, + "yMin": 0, + "pointNum": 100, + "rts": true, + "dtr": true + }, + "lib": { + "mixly": { + "url": [ + "http://download.mixlylibs.cloud/mixly3-packages/cloud-libs/arduino_avr/libs.json" + ] + } + }, + "web": { + "devices": { + "serial": true, + "hid": false, + "usb": false + } + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/01-LED闪烁.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/01-LED闪烁.mix new file mode 100644 index 00000000..c82c9cfd --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/01-LED闪烁.mix @@ -0,0 +1 @@ +D13连接LED\nLED将亮一秒灭一秒13HIGHdelay100013LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/02-开关灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/02-开关灯.mix new file mode 100644 index 00000000..b3225683 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/02-开关灯.mix @@ -0,0 +1 @@ +D2接按钮,D13接LED。\n按下按钮产生高电平,点亮LED。\n松开按钮产生低电平,熄灭LED。13HIGH2 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/03-调光灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/03-调光灯.mix new file mode 100644 index 00000000..bd458fe4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/03-调光灯.mix @@ -0,0 +1 @@ +A0接电位器,D3接LED。\n调节电位器,LED灯随电位器转动改变亮度。30DIVIDE1A04 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/04-多功能按键.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/04-多功能按键.mix new file mode 100644 index 00000000..f8719c60 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/04-多功能按键.mix @@ -0,0 +1 @@ +D2上连接按钮\n将看到单击、双击、长按开始、长按中、长按结束,在串口输出不同的提示语。attachClick2HIGHSerialprintlnone ClickattachDoubleClick2HIGHSerialprintlndouble ClickattachLongPressStart2HIGHSerialprintlnlongPress StartattachDuringLongPress2HIGHSerialprintlnlongPressingattachLongPressStop2HIGHSerialprintlnlongPress End \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/05-硬件中断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/05-硬件中断.mix new file mode 100644 index 00000000..a15f2b1e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/05-硬件中断.mix @@ -0,0 +1 @@ +硬件中断\nD2连接按钮,D12连接LED。\n按下按钮,LED灯点亮。\n再次按下按钮,LED灯熄灭。如此往复。RISING212HIGH12 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/06-软件中断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/06-软件中断.mix new file mode 100644 index 00000000..024c31a9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/06-软件中断.mix @@ -0,0 +1 @@ +软件中断\n\nD4连接按钮,D12连接LED。\n将看到按钮被按下,LED灯亮灭切换。FALLING412HIGH12 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/07-声控灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/07-声控灯.mix new file mode 100644 index 00000000..e0937851 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/07-声控灯.mix @@ -0,0 +1 @@ +A1连接声音传感器,D11连接LED灯。\n先通过串口输出A1的模拟值,观察声音值大小。\n当声音传感器的模拟值大于300时,点亮11引脚的LED灯1秒,否则熄灭LED。Serial9600SerialprintlnA1GTA130011HIGHdelay100011LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/08-脉冲.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/08-脉冲.mix new file mode 100644 index 00000000..0e2e4f7e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/08-脉冲.mix @@ -0,0 +1 @@ +D3连接蜂鸣器\n在串口监视器中将看到高电平的脉冲周期Serial96003131SerialprintlnHIGH3SerialprintlnHIGH31000000delay1000Serialprintln***********************************************************3delay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/09-软件模拟PWM.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/09-软件模拟PWM.mix new file mode 100644 index 00000000..6ff871d8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/09-软件模拟PWM.mix @@ -0,0 +1 @@ +i0255113255idelay5i2541-113255idelay5 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/10-ShiftOut数字骰子.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/10-ShiftOut数字骰子.mix new file mode 100644 index 00000000..a33176d0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/10-ShiftOut数字骰子.mix @@ -0,0 +1 @@ +bytemylist110xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90D8连接到74HC595芯片的使能引脚\nD3连接到74HC595芯片的时钟引脚\nD9连接到74HC595芯片的数据引脚\n利用ShiftOut模块实现单位数码管的随机数字骰子i1518LOWMSBFIRST930mylist11108HIGHdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/11-ShiftOut流水灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/11-ShiftOut流水灯.mix new file mode 100644 index 00000000..ae70dac7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/01-输入输出/11-ShiftOut流水灯.mix @@ -0,0 +1 @@ +intLight91,2,4,8,16,32,64,128,256D8连接到74HC595芯片的使能引脚\nD12连接到74HC595芯片的时钟引脚\nD11连接到74HC595芯片的数据引脚\n实现8个LED的流水灯效果i1818LOWMSBFIRST11120Light1i8HIGHdelay10008LOWMSBFIRST111208HIGH \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/01-初始化.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/01-初始化.mix new file mode 100644 index 00000000..e4463fa7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/01-初始化.mix @@ -0,0 +1 @@ +D13连接LED。\n在初始化内的程序,\n只会在硬件上电后执行一次,\n一般用来放初始化设置程序。13HIGHdelay100013LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/02-LED流水灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/02-LED流水灯.mix new file mode 100644 index 00000000..4379dd19 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/02-LED流水灯.mix @@ -0,0 +1 @@ +D5-D13接LED灯\n用循环结构来实现流水灯效果i513110iHIGHdelay100010iLOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/03-While循环.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/03-While循环.mix new file mode 100644 index 00000000..6eb059c8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/03-While循环.mix @@ -0,0 +1 @@ +D7连接按钮\n按钮按下时,串口输出提示语“D7 is HIGH”Serial9600WHILETRUE7SerialprintlnD7 is HIGH \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/04-延时灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/04-延时灯.mix new file mode 100644 index 00000000..cd81d96b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/04-延时灯.mix @@ -0,0 +1 @@ +D2连接按钮,D12连接LED\n按下按钮,LED亮3秒,然后熄灭。212HIGHdelay300012LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/05-定时器控制灯亮灭.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/05-定时器控制灯亮灭.mix new file mode 100644 index 00000000..56528792 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/05-定时器控制灯亮灭.mix @@ -0,0 +1 @@ +D12连接LED\n每隔500ms,切换亮灭效果50012HIGH12 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/06-简单定时器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/06-简单定时器.mix new file mode 100644 index 00000000..f2ba44ba --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/06-简单定时器.mix @@ -0,0 +1 @@ +D12,D13分别连接LED灯\n每隔200ms,D12引脚LED灯切换亮灭;\n每隔300ms,D13引脚LED灯切换亮灭;\n简单定时器常用于多任务处理120012HIGH12230013HIGH13 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/07-随机亮灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/07-随机亮灯.mix new file mode 100644 index 00000000..d56e76a6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/07-随机亮灯.mix @@ -0,0 +1 @@ +D2连接按钮。\nD11、D12、D13分别连接LED灯。\n按下按钮随机点亮其中一盏灯。global_variatecountint09972count14count111HIGH12LOW13LOW211LOW12HIGH13LOW311LOW12LOW13HIGH11LOW12LOW13LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/08-Scoop多线程.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/08-Scoop多线程.mix new file mode 100644 index 00000000..83ba4e7c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/08-Scoop多线程.mix @@ -0,0 +1 @@ +D13,D12分别接1个LED模块,\nD12的LED每隔200ms亮灭一次\nD13的LED每隔300ms亮灭一次113HIGH30013LOW300212HIGH20012LOW200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/09-硬件中断-秒表.mix b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/09-硬件中断-秒表.mix new file mode 100644 index 00000000..c498b4df --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/02-控制/09-硬件中断-秒表.mix @@ -0,0 +1 @@ +秒表\n按钮传感器连接到D2\n第一次按下按钮开始计时,再次按下按钮停止计时,\n并通过串口监视器输出时间值Serial9600global_variatestartTimeintglobal_variateendTimeintglobal_variatestatebooleanFALSERISING2EQstateFALSEstateTRUEstartTimemillisstateFALSEendTimemillisSerialprintlnMINUS1endTime1startTime \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/01-模拟输入和模拟输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/01-模拟输入和模拟输出.mix new file mode 100644 index 00000000..355c1715 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/01-模拟输入和模拟输出.mix @@ -0,0 +1 @@ +A0连接旋转电位器,D11连接LED\nLED灯随着电位器的旋转呈现在0-255区间的不同亮度global_variateliangduintmap_intA0010230255110liangdu \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/02-绘制三角函数曲线.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/02-绘制三角函数曲线.mix new file mode 100644 index 00000000..69a925c4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/02-绘制三角函数曲线.mix @@ -0,0 +1 @@ +绘制SIN-COS的函数图像\n程序上传后,打开串口监视器\n并切换到绘图模式Serial9600i03601SerialprintADD1MULTIPLY1SINi1256512Serialprint,SerialprintlnADD1MULTIPLY1COSi1256512delay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/03-映射.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/03-映射.mix new file mode 100644 index 00000000..79470817 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/03-映射.mix @@ -0,0 +1 @@ +A0接电位器\n串口输出20-180区间的数值Serial9600Serialprintlnmap_intA00102320180delay500 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/04-随机数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/04-随机数.mix new file mode 100644 index 00000000..5c14cff8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/04-随机数.mix @@ -0,0 +1 @@ +随机数不包括最大数,如 1—7 随机数只有 1、2、3、4、5、6。Serial9600997Serialprintln1100delay100 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/05-约束运算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/05-约束运算.mix new file mode 100644 index 00000000..adc132a3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/05-约束运算.mix @@ -0,0 +1 @@ +Serial9600输出两个数取余的值SerialprintlnQUYU103A0连接电位器,\n将看到LED亮灭随电位器的旋转约束在0-255之间不同的亮度110MULTIPLY10QUYU10A03500255 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/06-移位计算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/06-移位计算.mix new file mode 100644 index 00000000..453d5e75 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/03-数学/06-移位计算.mix @@ -0,0 +1 @@ +使用移位计算global_variateitemint4096Serial9600i1121Serialprintln>>4096item1item>>4096item1 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/01-serial_string-1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/01-serial_string-1.mix new file mode 100644 index 00000000..4397b402 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/01-serial_string-1.mix @@ -0,0 +1 @@ +只执行一次串口输出积木块Serial9600SerialprintlnI like Mixly!串口输出数字后不换行i161SerialprintiSerialprint Serialprintln \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/02-serial_string-2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/02-serial_string-2.mix new file mode 100644 index 00000000..c9166124 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/02-serial_string-2.mix @@ -0,0 +1 @@ +用转ASCII字符积木块加空格Serial9600SerialprintlnHelloMixlySerialprintlnHello 127Mixlydelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/03-serial_string-3.mix b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/03-serial_string-3.mix new file mode 100644 index 00000000..1b8b8ce0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/03-serial_string-3.mix @@ -0,0 +1 @@ +截取字符串中的一部分Serial9600SerialprintlnI Love Mixly712 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/04-serial_string-4.mix b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/04-serial_string-4.mix new file mode 100644 index 00000000..14b0e299 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/04-serial_string-4.mix @@ -0,0 +1 @@ +截取字符串的一部分\n消除非可视字符将删除字符串首尾的非可视字符Serial9600global_variatewenziString wenzi I like Mixly! SerialprintlnwenziSerialprintlnLength: MixlyhellowenziSerialprintlnEarthChinaAmericawenzi813.toUpperCase()StringwenziSerialprintlnwenziStringwenziSerialprintlnwenziSerialprintlnLength: Mixlyhellowenzi \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/URL和Base64编解码.mix new file mode 100644 index 00000000..a6489d31 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/04-文本/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/01-一维数组输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/01-一维数组输出.mix new file mode 100644 index 00000000..41b4f5f1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/01-一维数组输出.mix @@ -0,0 +1 @@ +串口输出字符型数组元素charCHINACHINAi15CHINA1SerialprintCHINA1i \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/02-二维数组输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/02-二维数组输出.mix new file mode 100644 index 00000000..63cf04ad --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/05-数组/02-二维数组输出.mix @@ -0,0 +1 @@ +串口输出二维数组元素intarray33{1,2,3},{4,5,6},{7,8,9}i131j131SerialprintHelloarray1i1j,EQQUYU1j30Serialprintln \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/01-比较运算符.mix b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/01-比较运算符.mix new file mode 100644 index 00000000..19bc9d73 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/01-比较运算符.mix @@ -0,0 +1 @@ +在A0连接电位器,D9连接LED。\n转动电位器,大于600灯一直亮,在400和600之间,灯灭,小于400灯闪。SerialprintlnA0delay1000GTEA06009HIGHLTEA04009HIGHdelay2009LOWdelay2009LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/02-逻辑运算符.mix b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/02-逻辑运算符.mix new file mode 100644 index 00000000..244bd218 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/02-逻辑运算符.mix @@ -0,0 +1 @@ +光控按钮灯\n\nA0连接光线传感器,D4连接LED,D3连接按钮\n当A0<50(光线暗)并按钮被被下时,LED为高电平\n否则,LED为低电电平ANDLTA05034HIGH4LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/03-?语句.mix b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/03-?语句.mix new file mode 100644 index 00000000..441d3c2f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/06-逻辑/03-?语句.mix @@ -0,0 +1 @@ +声控灯\nA0连接声音传感器,D2连接LED\n当A0>50时,LED为高电平\n否则,LED为低电平SerialprintlnA02HIGHGTA050HIGHLOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/01-串口交互.mix b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/01-串口交互.mix new file mode 100644 index 00000000..8018d196 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/01-串口交互.mix @@ -0,0 +1 @@ +串口交互\nD9连接红色LED,D10连接黄色LED,D11连接绿色LED。\n输入R,点亮红色LED,输入Y,点亮黄色LED,输入G,点亮绿色LED。Serial9600global_variateLightchar SerialLightSerialreadLightR9HIGHY10HIGHG11HIGH9LOW10LOW11LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/02-串口控制开关灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/02-串口控制开关灯.mix new file mode 100644 index 00000000..36630e07 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/02-串口控制开关灯.mix @@ -0,0 +1 @@ +串口交互\nD13接LED。\n输入1,开灯;输入0,关灯。Serial9600global_variateLightchar0SerialLightSerialreadLight113HIGH013LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/03-打印ASCII值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/03-打印ASCII值.mix new file mode 100644 index 00000000..ad548b75 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/07-串口/03-打印ASCII值.mix @@ -0,0 +1 @@ +Serial9600i331271SerialiSerialprint,DEC:SerialprintiSerialprint,HEX:SerialprintHEX0iSerialprint,BIN:SerialprintBIN0iSerialprintln \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/01-IRremote红外控制灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/01-IRremote红外控制灯.mix new file mode 100644 index 00000000..4fdeebc7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/01-IRremote红外控制灯.mix @@ -0,0 +1 @@ +ir_item2SerialprintlnHEXir_itemir_item0xFFA25D9HIGH0xFF629D10HIGH0xFFE21D11HIGH9LOW10LOW11LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符.mix new file mode 100644 index 00000000..1838e554 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符.mix @@ -0,0 +1 @@ +IIC通信:主机发送字符a、b、ci1a10c14223idelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符串.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符串.mix new file mode 100644 index 00000000..2c457f06 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_字符串.mix @@ -0,0 +1 @@ +IIC通信:当接收到YES时点亮D13,当打开NO时熄灭D13\n\nUNO1(A4)-UNO2(A4)\nUNO1(A5)-UNO2(A5)\nUNO1(GND)-UNO2(GND)global_variatetransmitStringString4ONdelay10004OFFdelay1000requesttransmitStringdelay1043WHILETRUE+itemtransmitString1charEQhellotransmitString0NtransmitStringsubstringtransmitString02SerialprintlntransmitStringEQtransmitStringOK13HIGH13LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_请求数据.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_请求数据.mix new file mode 100644 index 00000000..641ca132 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICMaster_请求数据.mix @@ -0,0 +1 @@ +global_variateoutput_dataunsigned long0bytereceive_data4084WHILETRUESerialprint0xi141receive_data1iSerialprintLTreceive_data1i0x100SerialprintHEX0receive_data1iSerialprint output_data|0|0|0<<0&0receive_data10xffffffff240<<0&0receive_data20xffffffff160<<0&0receive_data30xffffffff80receive_data4Serialprint\\n0xSerialprintlnHEX0output_dataSerialprintlndelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符.mix new file mode 100644 index 00000000..76592eae --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符.mix @@ -0,0 +1 @@ +IIC通信:从机接收到字符a、b、c,分别点亮D13、D12、D11Serial9600字符变量赋空格为初始值global_variateCchar 4WHILETRUECSerialprintlnCCa13HIGH11LOW12LOWb12HIGH13LOW11LOWc11HIGH12LOW13LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符串.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符串.mix new file mode 100644 index 00000000..1cbfe1a9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/02-IICSlave_字符串.mix @@ -0,0 +1 @@ +IIC通信:当接收到ON时点亮D13,当打开OFF时熄灭D13\n\nUNO1(A4)-UNO2(A4)\nUNO1(A5)-UNO2(A5)\nUNO1(GND)-UNO2(GND)4global_variateReceiveStringStringglobal_variateLED_STAboolean0ReceiveStringWHILETRUE+itemReceiveString1charSerialprintlnReceiveStringEQReceiveStringON13HIGHLED_STA1delay2000EQReceiveStringOFF13LOWLED_STA0delay2000LED_STA1YES0NO \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master.mix new file mode 100644 index 00000000..534edbef --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master.mix @@ -0,0 +1 @@ +100Adelay1000100Bdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_1.mix new file mode 100644 index 00000000..03201de4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_1.mix @@ -0,0 +1 @@ +1010Cdelay1000Ddelay1000Edelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_2.mix new file mode 100644 index 00000000..1c291c23 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_2.mix @@ -0,0 +1 @@ +global_variateMasterSendint0global_variateMasteReceiveint010Serial1152002MasterSend1MasterSend010MasteReceiveAMasterSendEQMasteReceive13HIGH3LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_字符串.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_字符串.mix new file mode 100644 index 00000000..ce070fcf --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Master_字符串.mix @@ -0,0 +1 @@ +1010 10i010MINUS1hello!11SerialAhello!0iSerialprintlndelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave.mix new file mode 100644 index 00000000..311dab69 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave.mix @@ -0,0 +1 @@ +global_variateSlaveSendint0Serial115200SPDREQSPDR13HIGHSerialprintlnSlave LED ON3LOWSerialprintlnSlave LED OFF2SlaveSend1SlaveSend0SPDRSlaveSenddelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_1.mix new file mode 100644 index 00000000..0555e99e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_1.mix @@ -0,0 +1 @@ +SPDRSerialSPDRSerialprintlnSerialprintln223SPDREQSPDRC2LOW3HIGH4LOWEQSPDRD2LOW3LOW4HIGHEQSPDRE2HIGH3LOW4LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_2.mix new file mode 100644 index 00000000..23ccde8d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_2.mix @@ -0,0 +1 @@ +global_variateSlaveSendint0Serial115200SPDREQSPDR13HIGHSerialprintlnSlave LED ON3LOWSerialprintlnSlave LED OFF2SlaveSend1SlaveSend0SPDRSlaveSenddelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_字符串.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_字符串.mix new file mode 100644 index 00000000..20d2a5bb --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/03-SPI_Slave_字符串.mix @@ -0,0 +1 @@ +global_variatedataString global_variateiint0global_variatedata1byteSPDRSPDRSPDRhello0i+itemi1+itemdata1223SPDREQdata1!i0Serialprintlndatadata \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡&读卡.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡&读卡.mix new file mode 100644 index 00000000..7e73bb7b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡&读卡.mix @@ -0,0 +1 @@ +Serial9600rfid101311129SerialprintlnRFID写卡&读卡测试bytemylist162,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32bytemylist2100rfidrfid1mylist16rfid1mylist210i1101Serialprintlnmylist21idelay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡.mix new file mode 100644 index 00000000..7c49b37f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_写卡.mix @@ -0,0 +1 @@ +Serial9600rfid101311129SerialprintlnRFID写卡测试bytemylist161,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16rfidrfid1mylist16delay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读卡.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读卡.mix new file mode 100644 index 00000000..d03f28da --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读卡.mix @@ -0,0 +1 @@ +Serial9600rfid101311129SerialprintlnRFID读卡测试bytemylist160rfidrfid1mylist16i1161Serialprintlnmylist1idelay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读取RFID卡号.mix b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读取RFID卡号.mix new file mode 100644 index 00000000..f048822f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/08-通信/04-RFID_读取RFID卡号.mix @@ -0,0 +1 @@ +Serial9600rfid101311129global_variateRFID_CardUIDStringSerialprintln读取RFID卡号测试rfidRFID_CardUIDrfidSerialprintlnCard UID:MixlyRFID_CardUIDdelay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM.mix b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM.mix new file mode 100644 index 00000000..b10b76a2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM.mix @@ -0,0 +1 @@ +D2:接按钮\nD9:接LED\n按下按钮可以控制LED开关切换,并且将开关状态存储到EEPROM中。\n每次重启时,先从EEPROM中读取灯在之前的状态,先将灯的状态恢复。\n即,如果主板在断电之前灯是开启状态的,主板重启后自动开灯。global_variatestatebooleanFALSEstate09HIGHstateattachClick2LOWstatestate9HIGHstate00state \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字符数组.mix b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字符数组.mix new file mode 100644 index 00000000..72f09e55 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字符数组.mix @@ -0,0 +1 @@ +Serial9600charmylistabcdefgcharmylist1700mylist0mylist1i171Serialprintlnmylist11i \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字节数组.mix b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字节数组.mix new file mode 100644 index 00000000..cf018ffe --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取字节数组.mix @@ -0,0 +1 @@ +Serial9600bytemylist1234567bytemylist1700mylist0mylist1i171Serialprintlnmylist11i \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取小数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取小数.mix new file mode 100644 index 00000000..165a6322 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取小数.mix @@ -0,0 +1 @@ +Serial9600global_variateput_datafloat3.14global_variateget_datafloat000put_data0itemget_dataSerialprintlnget_data \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取长整数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取长整数.mix new file mode 100644 index 00000000..5ff80866 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/09-存储/02-EEPROM_写入和读取长整数.mix @@ -0,0 +1 @@ +Serial9600global_variateput_dataunsigned long123456789global_variateget_dataunsigned long000put_data0itemget_dataSerialprintlnget_data \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/01-超声波测距.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/01-超声波测距.mix new file mode 100644 index 00000000..e1e9bf0f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/01-超声波测距.mix @@ -0,0 +1 @@ +超声波测距\n超声波传感器trig接D2,Echo接D3\n串口输出超声波传感器检测的距离值Serial9600Serialprintln距离:23cmdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/02-LCD1602显示温湿度.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/02-LCD1602显示温湿度.mix new file mode 100644 index 00000000..8cff520e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/02-LCD1602显示温湿度.mix @@ -0,0 +1 @@ +温湿度计\nDHT11接D4,LCD1402接IIC接口\n将看到LCD上显示温度和温度及单位\n注:摄氏度符号由小圆圈对应的ASCII码是0xdf,后面是大写字母C组成16,2mylcdA5A40x3fmylcd11Hello114temperatureMixlyHello0xdfCmylcd21Hello114humidity% \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/04-DS18B20温度传感器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/04-DS18B20温度传感器.mix new file mode 100644 index 00000000..103ce8df --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/04-DS18B20温度传感器.mix @@ -0,0 +1 @@ +DS18B20读取温度\nDS18B20连接在D2管脚,串口打印出温度值\n注:如果使用的DS18B20是散件,则需要在电源线和信号线之间并联一个5K左右的电阻Serial9600Serialprintln温度:20Serialprintln温度:21Serialprintlndelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/05-MLX90614测温.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/05-MLX90614测温.mix new file mode 100644 index 00000000..418e0c1c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/05-MLX90614测温.mix @@ -0,0 +1 @@ +MLX90614测温\nMLX90614连接IIC接口\nSerial96000x5ASerialprintln目标物体温度:readObjectTempCreadObjectTempFSerialprintln周围环境温度:readAmbientTempCreadAmbientTempFSerialprintln\\n\\ndelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/06-TCS34725颜色识别传感器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/06-TCS34725颜色识别传感器.mix new file mode 100644 index 00000000..90e2a288 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/06-TCS34725颜色识别传感器.mix @@ -0,0 +1 @@ +TCS34725颜色识别传感器\nTCS34725传感器连接在IIC接口Serial9600SerialprintR:tcs34725.getRedToGamma() G:tcs34725.getGreenToGamma() B:tcs34725.getBlueToGamma()Serialprintlndelay500 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/07-TCS230颜色识别传感器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/07-TCS230颜色识别传感器.mix new file mode 100644 index 00000000..2567216f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/07-TCS230颜色识别传感器.mix @@ -0,0 +1 @@ +TCS230颜色识别传感器Serial9600234567SerialprintlnR:R G:G B:BSerialprintlndelay500 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/11-旋转编码器读取数据.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/11-旋转编码器读取数据.mix new file mode 100644 index 00000000..9ebec5d3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/11-旋转编码器读取数据.mix @@ -0,0 +1 @@ +Serial96001451resetPosition51setUpperBound101setLowerBound01setLeftRotationHandlerSerialprintln左转:Mixly1getPosition1setRightRotationHandlerSerialprintln右转:Mixly1getPosition1setChangedHandlerSerialprintln状态改变:MixlyEQ1getDirection1右转左转1setUpperOverflowHandlerSerialprintln高于上限:Mixly1getPosition1setLowerOverflowHandlerSerialprintln低于下限:Mixly1getPositionCiNpbmNsdWRlIDxFU1BSb3RhcnkuaD4KCkVTUFJvdGFyeSBlbmNvZGVyMTsKCnZvaWQgZW5jb2RlcjFPbkxlZnRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuW3pui9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuWPs+i9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uQ2hhbmdlZChFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIueKtuaAgeaUueWPmO+8miIpICsgU3RyaW5nKCgoZW5jb2RlcjEuZ2V0RGlyZWN0aW9uKCkgPT0gMSk/IuWPs+i9rCI6IuW3pui9rCIpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPblVwcGVyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLpq5jkuo7kuIrpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPbkxvd2VyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLkvY7kuo7kuIvpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgZW5jb2RlcjEuYmVnaW4oNSwgNCk7CiAgZW5jb2RlcjEuc2V0U3RlcHNQZXJDbGljaygyKTsKICBlbmNvZGVyMS5yZXNldFBvc2l0aW9uKDUpOwogIGVuY29kZXIxLnNldFVwcGVyQm91bmQoMTApOwogIGVuY29kZXIxLnNldExvd2VyQm91bmQoMCk7CiAgZW5jb2RlcjEuc2V0TGVmdFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uTGVmdFJvdGF0aW9uKTsKICBlbmNvZGVyMS5zZXRSaWdodFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbik7CiAgZW5jb2RlcjEuc2V0Q2hhbmdlZEhhbmRsZXIoZW5jb2RlcjFPbkNoYW5nZWQpOwogIGVuY29kZXIxLnNldFVwcGVyT3ZlcmZsb3dIYW5kbGVyKGVuY29kZXIxT25VcHBlck92ZXJmbG93KTsKICBlbmNvZGVyMS5zZXRMb3dlck92ZXJmbG93SGFuZGxlcihlbmNvZGVyMU9uTG93ZXJPdmVyZmxvdyk7Cn0KCnZvaWQgbG9vcCgpewogIGVuY29kZXIxLmxvb3AoKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302液晶时钟.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302液晶时钟.mix new file mode 100644 index 00000000..20ce8877 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302液晶时钟.mix @@ -0,0 +1 @@ +用DS1302在LCD1602上显示实时时钟\nLCD1602接线:SCL--D12,SDA——D11\nDS102接线:RST-D2,DAT-D3,CLK-D416,2mylcd12110x3fSerial9600global_variate:LsTimeString 234DATETIME11000用逻辑运算符组合条件判断时、分、秒是否为个位数,如果是0-9的个位数,修改输出格式,否则直接输出。:LsTime ANDGTEHour0LTEHour9:LsTime00:Hour::LsTimeString0Hour:ANDGTEMinute0LTEMinute9:LsTime0:LsTime:00:Minute::LsTimeString0:LsTime:0Minute:ANDGTESecond0LTESecond9:LsTime0:LsTime:0:Second:LsTimeString0:LsTime:SecondSerialprintlnHelloHelloYearMixly/MixlyMonthMixly/MixlyDaySerialprintln:LsTimemylcdHelloHelloYearMixly/MixlyMonthMixly/MixlyDay:LsTime \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302输出日期.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302输出日期.mix new file mode 100644 index 00000000..6c608c39 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/12-DS1302输出日期.mix @@ -0,0 +1 @@ +串口输出日期\nDS102接线:RST-D2,DAT-D3,CLK-D4Serial9600234SerialprintlnHelloHelloYearMixly/MixlyMonthMixly/MixlyDaySerialprintlndelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘密码灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘密码灯.mix new file mode 100644 index 00000000..c2d262cb --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘密码灯.mix @@ -0,0 +1 @@ +名称:密码灯\n矩阵键盘按照程序定义接线。\n当通过矩阵键盘输入密码1234后,按下D键,表示确认。\n如果密码正确点亮D13的LED,如果密码错误则熄灭。global_variatekeycharglobal_variatepwdStringKEYPAD_4_423456789123A456B789C*0#DkeyKEYPAD_4_4equalskeyDSerialprintlnpwdequalspwd123413HIGH13LOWpwdHellopwdMixlykey \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘打印按键值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘打印按键值.mix new file mode 100644 index 00000000..ae782e35 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘打印按键值.mix @@ -0,0 +1 @@ +global_variatechar_keycharaKEYPAD_4_423456789123A456B789C*0#Dchar_keyKEYPAD_4_4char_keySerialprintlnchar_key \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘简易密码锁.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘简易密码锁.mix new file mode 100644 index 00000000..06ac2e75 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/13-矩阵键盘简易密码锁.mix @@ -0,0 +1 @@ +global_variatestring_keyStringglobal_variatechar_keycharaglobal_variatekey_dataString123ABCKEYPAD_4_423456789123A456B789C*0#Dchar_keyKEYPAD_4_4char_keystring_keyHellostring_keyMixlychar_keySerialprintlnstring_keyEQhellostring_key6EQstring_keykey_dataSerialprintlnkey is trueSerialprintlnSerialprintlnkey is falseSerialprintlnstring_key \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/15-MPU6050打印数值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/15-MPU6050打印数值.mix new file mode 100644 index 00000000..20473f91 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/15-MPU6050打印数值.mix @@ -0,0 +1 @@ +读取MPU6050数据\n连接方式:MPU6050连接主控板的IIC接口Serial9600Serialprint\nX轴加速度:SerialprintgetAccX()Serialprint\tY轴加速度:SerialprintgetAccY()Serialprint\tZ轴加速度:SerialprintlngetAccZ()SerialprintX轴角度:SerialprintgetAngleX()Serialprint\tY轴角度:SerialprintgetAngleY()Serialprint\tZ轴角度:SerialprintlngetAngleZ()Serialprint温度:SerialprintlngetTemp()Serialprint###############################################delay100{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"921600","LoopCore":"1","EventsCore":"1"}CiNpbmNsdWRlIDxNUFU2MDUwX3RvY2tuLmg+CiNpbmNsdWRlIDxXaXJlLmg+CgpNUFU2MDUwIG1wdTYwNTAoV2lyZSk7Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFdpcmUuYmVnaW4oKTsKICBtcHU2MDUwLmJlZ2luKCk7CiAgbXB1NjA1MC5jYWxjR3lyb09mZnNldHModHJ1ZSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6K+75Y+WTVBVNjA1MOaVsOaNrlxu6L+e5o6l5pa55byP77yaTVBVNjA1MOi/nuaOpeS4u+aOp+adv+eahElJQ+aOpeWPowogIG1wdTYwNTAudXBkYXRlKCk7CiAgU2VyaWFsLnByaW50KCJcbljovbTliqDpgJ/luqY6Iik7CiAgU2VyaWFsLnByaW50KG1wdTYwNTAuZ2V0QWNjWCgpKTsKICBTZXJpYWwucHJpbnQoIlx0Wei9tOWKoOmAn+W6pjoiKTsKICBTZXJpYWwucHJpbnQobXB1NjA1MC5nZXRBY2NZKCkpOwogIFNlcmlhbC5wcmludCgiXHRa6L205Yqg6YCf5bqmOiIpOwogIFNlcmlhbC5wcmludGxuKG1wdTYwNTAuZ2V0QWNjWigpKTsKICBTZXJpYWwucHJpbnQoIljovbTop5LluqY6Iik7CiAgU2VyaWFsLnByaW50KG1wdTYwNTAuZ2V0QW5nbGVYKCkpOwogIFNlcmlhbC5wcmludCgiXHRZ6L206KeS5bqmOiIpOwogIFNlcmlhbC5wcmludChtcHU2MDUwLmdldEFuZ2xlWSgpKTsKICBTZXJpYWwucHJpbnQoIlx0Wui9tOinkuW6pjoiKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldEFuZ2xlWigpKTsKICBTZXJpYWwucHJpbnQoIua4qeW6pjoiKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldFRlbXAoKSk7CiAgU2VyaWFsLnByaW50KCIjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280打印温度值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280打印温度值.mix new file mode 100644 index 00000000..e00c6a9a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280打印温度值.mix @@ -0,0 +1 @@ +Serial9600Serialprintln温度:bmereadTemperature()0x77delay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280气象站.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280气象站.mix new file mode 100644 index 00000000..59fc1911 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/16-BME280气象站.mix @@ -0,0 +1 @@ +SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3C13000u8g2page1u8g22418016qixiangzhanu8g212203216wenduu8g212403216shiduu8g2tim14Ru8g250201234bmereadTemperature()0x77u8g290201616sheshiduu8g250401234HellobmereadHumidity()0x77%wendu64TRUE122STHeiti163216温度shidu64TRUE122STHeiti163216湿度qixiangzhan160TRUE122STHeiti168016数字气象站sheshidu32TRUE122STHeiti161616 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/17-PS2手柄_打印摇杆值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/17-PS2手柄_打印摇杆值.mix new file mode 100644 index 00000000..a0e7c8f0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/17-PS2手柄_打印摇杆值.mix @@ -0,0 +1 @@ +24512trueSerial960011000SerialprintlnLeft_X:MixlyPSS_LXSerialprintlnRight_X:MixlyPSS_RY \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/B01-声控舵机.mix b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/B01-声控舵机.mix new file mode 100644 index 00000000..4bd0cf16 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/10-传感器/B01-声控舵机.mix @@ -0,0 +1 @@ +声控舵机\n\nA0接声音传感器,D2接舵机\n舵机转动角度随音量大小在0-180之间来回转20map_intA015000180100 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/01-门铃.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/01-门铃.mix new file mode 100644 index 00000000..eb799e0e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/01-门铃.mix @@ -0,0 +1 @@ +D8连接蜂鸣器,D2连接按钮传感器\n当按钮被按下时,蜂鸣器出现“叮咚”的声音28659delay5008532delay5008 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/02-蜂鸣器播放简单声音.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/02-蜂鸣器播放简单声音.mix new file mode 100644 index 00000000..d78d4904 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/02-蜂鸣器播放简单声音.mix @@ -0,0 +1 @@ +蜂鸣器:D8,\n播放简谱1,2,3,4,5,6floattonelist71046.5,1174.7,1318.5,1396.9,1568,1760,1975.5i1718131tonelist1idelay6008delay600 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/03-按键钢琴.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/03-按键钢琴.mix new file mode 100644 index 00000000..f6e3e3a0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/03-按键钢琴.mix @@ -0,0 +1 @@ +D2-D8接7个按钮\n按下不同的铵钮,播放对应的音调floattonelist71046.5,1174.7,1318.5,1396.9,1568,1760,1975.5212131tonelist1312131tonelist2412131tonelist3512131tonelist4612131tonelist5712131tonelist6812131tonelist712 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/04-两只老虎.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/04-两只老虎.mix new file mode 100644 index 00000000..b14fd271 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/04-两只老虎.mix @@ -0,0 +1 @@ +播放两只老虎\n\nD8连接蜂鸣器,D2连接按钮\nfloattonelist71046.5,1174.7,1318.5,1396.9,1568,1760,1975.5longmusiclist321,2,3,1,1,2,3,1,3,4,5,3,4,5,5,6,5,4,3,1,5,6,5,4,3,1,2,5,1,2,5,1longhighlist320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,-1,0longupdownlist320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0floatrhythmlist321,1,1,1,1,1,1,1,1,1,2,1,1,2,0.5,0.5,0.5,0.5,1,1,0.5,0.5,0.5,0.5,1,1,1,1,2,1,1,2global_variatespeedfloat120.0global_variateupdownlong0playmusici13218131MULTIPLYMULTIPLYtonelistmusiclistiPOWER2highlistiPOWER2DIVIDEADDupdownlistiupdown12.0delay1000MULTIPLYMULTIPLY1000DIVIDE60speedrhythmlisti8delay102 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/05-Alarm.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/05-Alarm.mix new file mode 100644 index 00000000..37d6ba24 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/05-Alarm.mix @@ -0,0 +1 @@ +RISING210LOW410HIGHWHILE10i018018131ADD1MULTIPLY1SINi10002000delay108 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/06-WS2812.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/06-WS2812.mix new file mode 100644 index 00000000..b568370b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/06-WS2812.mix @@ -0,0 +1 @@ +D2接灯带2NEO_GRB10220i110121i#ff00002 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/07-mini MP3_播放音乐.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/07-mini MP3_播放音乐.mix new file mode 100644 index 00000000..5e6e17d3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/07-mini MP3_播放音乐.mix @@ -0,0 +1 @@ +简易MP3播放器\n模块使用软串口\n上一曲按键接在D2\n下一曲按键接在D3\nmySerial78mySerial9600myPlayermySerialmyPlayer500myPlayer2DFPLAYER_DEVICE_SDmyPlayer15attachClick2LOWmyPlayerpreviousattachClick3LOWmyPlayernext \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/09-七彩流水灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/09-七彩流水灯.mix new file mode 100644 index 00000000..8bf57c5f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/11-执行器/09-七彩流水灯.mix @@ -0,0 +1 @@ +12NEO_GRB12i03276764j112112jQUYU5461MULTIPLY1ADD5461MULTIPLY54611MINUS5461j11i26553625525512delay2 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/01-TM1650_显示变化的数字.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/01-TM1650_显示变化的数字.mix new file mode 100644 index 00000000..21116ea8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/01-TM1650_显示变化的数字.mix @@ -0,0 +1 @@ +IIC接口连接TM1650数码管\n每隔一秒显示数增加1global_variateitemint011000abcditemitemADD1item1 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/03-LCD1602_显示Hello Mixly.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/03-LCD1602_显示Hello Mixly.mix new file mode 100644 index 00000000..7aa032ba --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/03-LCD1602_显示Hello Mixly.mix @@ -0,0 +1 @@ +SCL--SCL,SDA-SDA\nLCD1602的第1行显示hello,第二行显示mixly\n一秒之后,\n第一行nihao,第二行显示misiqi16,2mylcdA5A40x27mylcdhellomixlydelay1000mylcdclearmylcdnihaomisiqidelay1000mylcdclear \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_多页切换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_多页切换.mix new file mode 100644 index 00000000..ca8f257e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_多页切换.mix @@ -0,0 +1 @@ +OLED 多页切换\n固定坐标位置(0,20)交替显示\"1234\"和\"hello\"SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2delay1000u8g2delay1000page1u8g2tim08Ru8g20201234page2u8g2tim08Ru8g2020hellopage3u8g2drawFrame1112462u8g2drawCircleU8G2_DRAW_ALL643210u8g2drawCircleU8G2_DRAW_ALL383210u8g2drawCircleU8G2_DRAW_ALL903210u8g2drawCircleU8G2_DRAW_ALL514210u8g2drawCircleU8G2_DRAW_ALL774210 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示Mixly Logo.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示Mixly Logo.mix new file mode 100644 index 00000000..13ae7b6b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示Mixly Logo.mix @@ -0,0 +1 @@ +OLED显示Mixly LogoSSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2u8g2bitmap10x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, 0x80,0xFF,0x0F,0xE0,0x0F,0x00,0x00,0x00,0xF8,0xFF,0x0F,0xF0,0x1F,0x00,0x00,0x00, 0xF8,0xFF,0x0F,0xFC,0x1F,0x00,0x00,0x00,0xF0,0xFF,0x07,0xFE,0x1F,0x00,0x1E,0x00, 0x80,0xFF,0x07,0xFF,0x3F,0xC0,0x7F,0x00,0x00,0xFF,0x87,0xFF,0x3F,0xE0,0xFF,0x00, 0x00,0xFF,0xC7,0xFF,0x3F,0xF0,0xFF,0x01,0x00,0xFF,0xC7,0xFF,0x3F,0xF8,0xFF,0x03, 0x00,0xFF,0xE7,0xFF,0x3F,0xFC,0xFF,0x03,0x00,0xFF,0xE3,0xFF,0x3F,0xFE,0xFF,0x07, 0x00,0xFE,0xF3,0xFF,0x3F,0xFF,0xFF,0x07,0x00,0xFE,0xF3,0xFF,0x3F,0xFF,0xFF,0x07, 0x00,0xFE,0xFB,0xF8,0xBF,0x8F,0xFF,0x07,0x00,0xFE,0x7B,0xF0,0xDF,0x87,0xFF,0x07, 0x00,0xFE,0x3F,0xF0,0xFF,0x83,0xFF,0x07,0x00,0xFE,0x3F,0xF0,0xFF,0x81,0xFF,0x07, 0x00,0xFE,0x1F,0xF0,0xFF,0x80,0xFF,0x03,0x00,0xFE,0x1F,0xF0,0xFF,0x80,0xFF,0x03, 0x00,0xFE,0x0F,0xF0,0x7F,0x80,0xFF,0x03,0x00,0xFE,0x0F,0xF0,0x7F,0x80,0xFF,0x01, 0x00,0xFC,0x0F,0xE0,0x3F,0xC0,0xFF,0x01,0x00,0xFC,0x0F,0xF0,0x3F,0xC0,0xFF,0x00, 0x00,0xFC,0x07,0xF0,0x1F,0xC0,0xFF,0x00,0x00,0xFC,0x07,0xF0,0x1F,0xE0,0x7F,0x00, 0x00,0xFC,0x07,0xF0,0x1F,0xE0,0x3F,0x00,0x00,0xF8,0x0F,0xF0,0x0F,0xE0,0x1F,0x00, 0x00,0xF8,0x0F,0xF0,0x0F,0xF0,0x0F,0x00,0x00,0xF8,0x0F,0xF0,0x0F,0xF0,0x07,0x00, 0x80,0xFF,0x0F,0xF0,0x0F,0xF8,0x07,0x00,0x80,0xFF,0x0F,0xF0,0x0F,0xF8,0xFF,0x00, 0x80,0xFF,0x1F,0xF8,0x0F,0xFC,0xFF,0x01,0x80,0xFF,0x1F,0xF8,0x0F,0xFC,0xFF,0x01, 0x80,0x00,0x1E,0xF8,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x1F,0x00,0x00,0x00, 0x00,0x00,0x00,0xE0,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x3C,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x7C,0x00,0x00,0x00,0x00,0x1C,0x00, 0x00,0xFC,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0xFC,0x03,0x00,0x00,0x00,0x1F,0x00, 0x00,0xF8,0x3F,0x00,0x00,0x80,0x0F,0x00,0x00,0xF8,0xFF,0x0F,0x00,0xF0,0x0F,0x00, 0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0x0F,0x00, 0x00,0x80,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0x03,0x00, 0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,0x80,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0x00,0xFC,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x0F,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,page1u8g23206464bitmap1 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示奥运五环图案.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示奥运五环图案.mix new file mode 100644 index 00000000..e7c2176f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示奥运五环图案.mix @@ -0,0 +1 @@ +OLED上显示奥运五环图案SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2page1u8g2drawFrame1112462u8g2drawCircleU8G2_DRAW_ALL643210u8g2drawCircleU8G2_DRAW_ALL383210u8g2drawCircleU8G2_DRAW_ALL903210u8g2drawCircleU8G2_DRAW_ALL514210u8g2drawCircleU8G2_DRAW_ALL774210 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示文本.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示文本.mix new file mode 100644 index 00000000..fa71cc91 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示文本.mix @@ -0,0 +1 @@ +OLED上第一行显示1234\nOLED上第二行显示hello,Mixly!SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2page1u8g2tim08Ru8g2001234u8g2tim14Ru8g2020hello,Mixly! \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字(取模).mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字(取模).mix new file mode 100644 index 00000000..65e9b030 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字(取模).mix @@ -0,0 +1 @@ +SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2page1u8g2004816MISIQIMISIQI96TRUE122STHeiti164816米思齐 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字.mix new file mode 100644 index 00000000..46815b50 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示汉字.mix @@ -0,0 +1 @@ +OLED显示汉字\n米思齐SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2mi 0x80,0x00,0x84,0x10,0x88,0x10,0x90,0x08,0x90,0x04,0x80,0x00,0xFE,0x3F,0xC0,0x01, 0xA0,0x02,0xA0,0x02,0x90,0x04,0x88,0x08,0x84,0x10,0x83,0x60,0x80,0x00,0x80,0x00,/*\"米\",0*/u8g2si0x00,0x00,0xFC,0x1F,0x84,0x10,0x84,0x10,0xFC,0x1F,0x84,0x10,0x84,0x10,0xFC,0x1F, 0x04,0x10,0x80,0x00,0x10,0x11,0x12,0x21,0x12,0x48,0x12,0x48,0xE1,0x0F,0x00,0x00,/*\"思\",0*/u8g2qi0x40,0x00,0x80,0x00,0xFE,0x3F,0x10,0x04,0x20,0x02,0xC0,0x01,0x30,0x06,0x0C,0x18, 0x13,0x64,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x08,0x04,0x08,0x04,0x04,0x04,/*\"齐\",0*/u8g2page1u8g2001616miu8g21601616siu8g23201616qi \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片.mix new file mode 100644 index 00000000..4a15bede --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片.mix @@ -0,0 +1 @@ +SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2page1u8g216400u8g2264100u8g2464280 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片1.mix new file mode 100644 index 00000000..4cc78327 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/04-OLED_显示表情图片1.mix @@ -0,0 +1 @@ +OLED显示表情图片\nUNO由于空间限制,只能显示一张SSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x3Cu8g2page1u8g2Angry,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFF,0xFF,0x00,0x00,0x00,0xFC,0xFF,0x3F,0x00,0x00,0x00,0xFE,0xFF,0xFF,0x03,0x00,0x80,0xFF,0xFF,0xFF,0x01,0x00,0x80,0xFF,0xFF,0xFF,0x0F,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0xC0,0x07,0x00,0x00,0x1F,0x00,0xE0,0x03,0x00,0xC0,0x07,0x00,0xE0,0x01,0x00,0x00,0x3C,0x00,0xF0,0x00,0x00,0x00,0x0F,0x00,0xE0,0x00,0x00,0x00,0x38,0x00,0x78,0x00,0x00,0x00,0x1E,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x70,0x00,0x00,0x00,0x70,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x1C,0x00,0x00,0x00,0x38,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x38,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0x78,0x00,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0x01,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x30,0x00,0xF8,0x07,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x38,0x00,0xB8,0x1F,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x00,0x3E,0x00,0x38,0x7F,0x00,0x00,0xE0,0x00,0x0C,0x00,0x00,0x80,0x3F,0x00,0x38,0xFC,0x01,0x00,0xE0,0x00,0x0C,0x00,0x00,0xE0,0x3F,0x00,0x38,0xF0,0x07,0x00,0xE0,0x00,0x0C,0x00,0x00,0xF8,0x31,0x00,0x38,0xC0,0x1F,0x00,0xE0,0x00,0x0C,0x00,0x00,0x7E,0x30,0x00,0x38,0x00,0x7F,0x00,0xE0,0x00,0x0C,0x00,0x80,0x1F,0x30,0x00,0x38,0x00,0xFC,0x01,0xE0,0x00,0x0C,0x00,0xE0,0x07,0x30,0x00,0x38,0x00,0xF0,0x07,0xE0,0x00,0x0C,0x00,0xF8,0x01,0x30,0x00,0x38,0x00,0xE0,0x1F,0xE0,0x00,0x0C,0x00,0xFE,0x00,0x30,0x00,0x38,0x00,0xF0,0x7F,0xE0,0x00,0x0C,0x80,0x3F,0x00,0x30,0x00,0x38,0x00,0xF8,0xFF,0xE1,0x00,0x0C,0xE0,0x6F,0x01,0x30,0x00,0x38,0x00,0xFC,0xF9,0xE7,0x00,0x0C,0xF8,0x4F,0x00,0x30,0x00,0x38,0x00,0xFD,0xDD,0xFF,0x00,0x0C,0xFE,0xF7,0x00,0x30,0x00,0x38,0x00,0xFE,0x3F,0xFF,0x00,0x8C,0xFF,0xFF,0x02,0x30,0x00,0x38,0x00,0xFE,0x3F,0xFC,0x00,0xFC,0xFF,0xFF,0x00,0x30,0x00,0x38,0x00,0xFE,0x3F,0xF0,0x00,0xFC,0xF5,0xFF,0x02,0x30,0x00,0x38,0x00,0xFC,0x1F,0xE0,0x00,0x7C,0xF0,0xFF,0x00,0x30,0x00,0x38,0x00,0xFD,0x5F,0xE0,0x00,0x1C,0xE0,0x7F,0x00,0x38,0x00,0x70,0x00,0xF8,0x0F,0x70,0x00,0x1C,0xE8,0x7F,0x01,0x38,0x00,0x70,0x00,0xF0,0x07,0x70,0x00,0x3C,0xC0,0x3F,0x00,0x3C,0x00,0xF0,0x00,0xC0,0x01,0x78,0x00,0x38,0x20,0x4F,0x00,0x1C,0x00,0xE0,0x01,0x20,0x04,0x3C,0x00,0x78,0x80,0x10,0x00,0x1E,0x00,0xC0,0x03,0x00,0x00,0x1E,0x00,0xF0,0x01,0x00,0x80,0x0F,0x00,0x80,0x1F,0x00,0xC0,0x0F,0x00,0xE0,0x07,0x00,0xE0,0x07,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x00,0xC0,0xFF,0xFF,0xFF,0x03,0x00,0x00,0xFC,0xFF,0xFF,0x01,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/05-NOKIA5110_显示汉字(取模).mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/05-NOKIA5110_显示汉字(取模).mix new file mode 100644 index 00000000..36053e7c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/05-NOKIA5110_显示汉字(取模).mix @@ -0,0 +1 @@ +bitmap96TRUE122STHeiti164816米思齐PCD8544_84X48u8g2U8G2_R013111098u8g2100u8g2page1u8g2tim08Ru8g22610MIXLYu8g218204816bitmap \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 8080_显示汉字(取模).mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 8080_显示汉字(取模).mix new file mode 100644 index 00000000..ad743b26 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 8080_显示汉字(取模).mix @@ -0,0 +1 @@ +bitmap96TRUE122STHeiti164816米思齐u8g2U8G2_R0987654321110u8g2page1u8g2tim08Ru8g24020MIXLYu8g232304816bitmap \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 SPI_显示汉字(取模).mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 SPI_显示汉字(取模).mix new file mode 100644 index 00000000..eb25a61e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/06-LCD12864 SPI_显示汉字(取模).mix @@ -0,0 +1 @@ +bitmap96TRUE122STHeiti164816米思齐u8g2U8G2_R0101311u8g2page1u8g2tim08Ru8g24020MIXLYu8g232304816bitmap \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_显示笑脸和哭脸.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_显示笑脸和哭脸.mix new file mode 100644 index 00000000..7a08502a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_显示笑脸和哭脸.mix @@ -0,0 +1 @@ +MAX7219上显示笑脸和哭脸各1秒1191311MAX72191LedArray1FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEFALSEFALSETRUEFALSETRUEFALSETRUEFALSEFALSETRUEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEdelay1000MAX72191LedArray2FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_水平方向四块级联滚动显示Mixly.mix b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_水平方向四块级联滚动显示Mixly.mix new file mode 100644 index 00000000..7b655af9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/12-显示器/07-MAX7219_水平方向四块级联滚动显示Mixly.mix @@ -0,0 +1 @@ +MAX729硬件连接:DIN-D11,CS--D9,CLK--D13\n水平方向四块级联滚动显\n示\"Mixly\"1191341i04111iMAX7219Mixly300MAX72191LedArray1FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEFALSEFALSETRUEFALSETRUEFALSETRUEFALSEFALSETRUEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEdelay1000MAX72191LedArray2FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUETRUEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/01-函数法SOS.mix b/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/01-函数法SOS.mix new file mode 100644 index 00000000..04c53b02 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/01-函数法SOS.mix @@ -0,0 +1 @@ +用蜂鸣器模拟SOS信号\n蜂鸣器:D3\ndelay500delay500delay5003短i1313HIGHdelay2003LOWdelay2003长i1313HIGHdelay4003LOWdelay200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/02-含参数无返回值呼吸灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/02-含参数无返回值呼吸灯.mix new file mode 100644 index 00000000..1b931a45 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/15-函数/02-含参数无返回值呼吸灯.mix @@ -0,0 +1 @@ +D10接LED\n通过函数的参数,传入呼吸灯一个周期的总时长1000fadebrightness02551100brightnessdelay1000DIVIDE1time1512brightness2550-1100brightnessdelay1000DIVIDE1time1512 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/16-自定义模块/(在2.0下编译报错)01-Factory.mix b/mixly/boards/default_src/arduino_avr/origin/examples/16-自定义模块/(在2.0下编译报错)01-Factory.mix new file mode 100644 index 00000000..a7272601 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/16-自定义模块/(在2.0下编译报错)01-Factory.mix @@ -0,0 +1 @@ +WireTimeLibDS1307RTCSerial9600tmElements_ttmRTC.read(tm)Serialprinttm.HourSerialprint:Serialprinttm.MinuteSerialprint:Serialprinttm.SecondSerialprint Serialprinttm.DaySerialprint:Serialprinttm.MonthSerialprint:SerialprinttmYearToCalendar(tm.Year)Serialprint delay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/01_Light_up_the_on_board_indicator.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/01_Light_up_the_on_board_indicator.mix new file mode 100644 index 00000000..0e2986e7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/01_Light_up_the_on_board_indicator.mix @@ -0,0 +1 @@ +右键点击对应的程序块,点击打开Wiki可获得该块详细介绍指定输出管脚输出高低电平对于UNO低电平为0V,高电平为5V数字输出通常用于各种数字量控制的执行器例如LED,继电器等上传本例将点亮13号管脚的板载指示灯13HIGHdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Y+z6ZSu54K55Ye75a+55bqU55qE56iL5bqP5Z2X77yM54K55Ye75omT5byAV2lraeWPr+iOt+W+l+ivpeWdl+ivpue7huS7i+e7jQogIC8v5oyH5a6a6L6T5Ye6566h6ISa6L6T5Ye66auY5L2O55S15bmzCiAgLy/lr7nkuo5VTk/kvY7nlLXlubPkuLowVu+8jOmrmOeUteW5s+S4ujVWCiAgLy/mlbDlrZfovpPlh7rpgJrluLjnlKjkuo7lkITnp43mlbDlrZfph4/mjqfliLbnmoTmiafooYzlmajkvovlpoJMRUTvvIznu6fnlLXlmajnrYkKICAvL+S4iuS8oOacrOS+i+WwhueCueS6rjEz5Y+3566h6ISa55qE5p2/6L295oyH56S654GvCiAgZGlnaXRhbFdyaXRlKDEzLEhJR0gpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/02_On_board_indicator_flashes.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/02_On_board_indicator_flashes.mix new file mode 100644 index 00000000..0a8f182d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/02_On_board_indicator_flashes.mix @@ -0,0 +1 @@ +小知识:1秒=1000毫秒,1毫秒=1000微秒上传本例13号管脚的板载指示灯将以一秒为周期闪烁改变延时时间观察现象思考本例中的延时函数作用是什么你能同时让两颗灯同时闪烁吗?以不同周期闪烁呢?若不能请思考原因13HIGHdelay100013LOWdelay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5bCP55+l6K+G77yaMeenkj0xMDAw5q+r56eS77yMMeavq+enkj0xMDAw5b6u56eSCiAgLy/kuIrkvKDmnKzkvosxM+WPt+euoeiEmueahOadv+i9veaMh+ekuueBr+WwhuS7peS4gOenkuS4uuWRqOacn+mXqueDgQogIC8v5pS55Y+Y5bu25pe25pe26Ze06KeC5a+f546w6LGhCiAgLy/mgJ3ogIPmnKzkvovkuK3nmoTlu7bml7blh73mlbDkvZznlKjmmK/ku4DkuYgKICAvL+S9oOiDveWQjOaXtuiuqeS4pOmil+eBr+WQjOaXtumXqueDgeWQl++8n+S7peS4jeWQjOWRqOacn+mXqueDgeWRou+8n+iLpeS4jeiDveivt+aAneiAg+WOn+WboAogIGRpZ2l0YWxXcml0ZSgxMyxISUdIKTsKICBkZWxheSgxMDAwKTsKICBkaWdpdGFsV3JpdGUoMTMsTE9XKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/03_Digital_Inputs.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/03_Digital_Inputs.mix new file mode 100644 index 00000000..8ddfd936 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/03_Digital_Inputs.mix @@ -0,0 +1 @@ +上传程序用双公头杜邦线的一端接到数字输入12号管脚,另一端分别间歇接到开发板的GND与5V观察13号板载指示灯的状态变化,同时查看下方的调试窗口观察输出,发现了什么数字输入的作用是什么?返回是是什么?数字输出除了写HIGH与LOW,还可以写入1和0吗?13HIGH12Serialprintln12delay100dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUKTsKICBwaW5Nb2RlKDEzLCBPVVRQVVQpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuIrkvKDnqIvluo8KICAvL+eUqOWPjOWFrOWktOadnOmCpue6v+eahOS4gOerr+aOpeWIsOaVsOWtl+i+k+WFpTEy5Y+3566h6ISa77yM5Y+m5LiA56uv5YiG5Yir6Ze05q2H5o6l5Yiw5byA5Y+R5p2/55qER05E5LiONVYKICAvL+inguWvnzEz5Y+35p2/6L295oyH56S654Gv55qE54q25oCB5Y+Y5YyW77yM5ZCM5pe25p+l55yL5LiL5pa555qE6LCD6K+V56qX5Y+j6KeC5a+f6L6T5Ye677yM5Y+R546w5LqG5LuA5LmICiAgLy/mlbDlrZfovpPlhaXnmoTkvZznlKjmmK/ku4DkuYjvvJ/ov5Tlm57mmK/mmK/ku4DkuYg/5pWw5a2X6L6T5Ye66Zmk5LqG5YaZSElHSOS4jkxPV++8jOi/mOWPr+S7peWGmeWFpTHlkoww5ZCX77yfCiAgZGlnaXRhbFdyaXRlKDEzLGRpZ2l0YWxSZWFkKDEyKSk7CiAgU2VyaWFsLnByaW50bG4oZGlnaXRhbFJlYWQoMTIpKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/04_Pin_output_state_switching.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/04_Pin_output_state_switching.mix new file mode 100644 index 00000000..689b6612 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/04_Pin_output_state_switching.mix @@ -0,0 +1 @@ +下方的“非”为逻辑运算符代表着取反操作,0取反等于1,1取反等于0上传程序观察现象,这种方式相比前面的闪烁方式有何异同?13HIGH13delay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5LiL5pa555qE4oCc6Z2e4oCd5Li66YC76L6R6L+Q566X56ym5Luj6KGo552A5Y+W5Y+N5pON5L2c77yMMOWPluWPjeetieS6jjEsMeWPluWPjeetieS6jjAKICAvL+S4iuS8oOeoi+W6j+inguWvn+eOsOixoe+8jOi/meenjeaWueW8j+ebuOavlOWJjemdoueahOmXqueDgeaWueW8j+acieS9leW8guWQjO+8nwogIGRpZ2l0YWxXcml0ZSgxMywoIWRpZ2l0YWxSZWFkKDEzKSkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/05_PWMAnalog_Output.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/05_PWMAnalog_Output.mix new file mode 100644 index 00000000..7f3bbb2c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/05_PWMAnalog_Output.mix @@ -0,0 +1 @@ +模拟输出可以输出不同占空比的方波,上传下面的例子可以看到LED的亮度与PWM值的变化模拟输出的值范围是0-255思考当输入的值大于255时会发生什么现象?110delay100011100delay100011255delay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5qih5ouf6L6T5Ye65Y+v5Lul6L6T5Ye65LiN5ZCM5Y2g56m65q+U55qE5pa55rOi77yM5LiK5Lyg5LiL6Z2i55qE5L6L5a2Q5Y+v5Lul55yL5YiwTEVE55qE5Lqu5bqm5LiOUFdN5YC855qE5Y+Y5YyWCiAgLy/mqKHmi5/ovpPlh7rnmoTlgLzojIPlm7TmmK8wLTI1NQogIC8v5oCd6ICD5b2T6L6T5YWl55qE5YC85aSn5LqOMjU15pe25Lya5Y+R55Sf5LuA5LmI546w6LGh77yfCiAgYW5hbG9nV3JpdGUoMTEsIDApOwogIGRlbGF5KDEwMDApOwogIGFuYWxvZ1dyaXRlKDExLCAxMDApOwogIGRlbGF5KDEwMDApOwogIGFuYWxvZ1dyaXRlKDExLCAyNTUpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/06_Analog_Inputs.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/06_Analog_Inputs.mix new file mode 100644 index 00000000..3b02edf8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/06_Analog_Inputs.mix @@ -0,0 +1 @@ +模拟输入可以将0-5V的电压映射为0-1023的值上传下列程序观察串口的 输出将电位器连接到模拟输入管脚,模拟输出管脚接LED观察灯光亮度的变化情况LED亮度随着模拟输入值的变化将会怎样变化?Serial115200SerialprintlnA7110A7delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aooeaLn+i+k+WFpeWPr+S7peWwhjAtNVbnmoTnlLXljovmmKDlsITkuLowLTEwMjPnmoTlgLwKICAvL+S4iuS8oOS4i+WIl+eoi+W6j+inguWvn+S4suWPo+eahCDovpPlh7oKICAvL+WwhueUteS9jeWZqOi/nuaOpeWIsOaooeaLn+i+k+WFpeeuoeiEmu+8jOaooeaLn+i+k+WHuueuoeiEmuaOpUxFROinguWvn+eBr+WFieS6ruW6pueahOWPmOWMluaDheWGtQogIC8vTEVE5Lqu5bqm6ZqP552A5qih5ouf6L6T5YWl5YC855qE5Y+Y5YyW5bCG5Lya5oCO5qC35Y+Y5YyW77yfCiAgU2VyaWFsLnByaW50bG4oYW5hbG9nUmVhZChBNykpOwogIGFuYWxvZ1dyaXRlKDExLCBhbmFsb2dSZWFkKEE3KSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/07_Software_analog_output.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/07_Software_analog_output.mix new file mode 100644 index 00000000..1bb5b2bc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/07_Software_analog_output.mix @@ -0,0 +1 @@ +软件模拟输出与硬件模拟输出类似都可以输出PWM信号软件模拟输出可以将任意引脚设置为模拟输出引脚,拓展多路模拟输出110delay100011100delay100011255delay1000取消软件模拟输出可以取消PWM输出,一般不使用11dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L2v5Lu25qih5ouf6L6T5Ye65LiO56Gs5Lu25qih5ouf6L6T5Ye657G75Ly86YO95Y+v5Lul6L6T5Ye6UFdN5L+h5Y+3CiAgLy/ova/ku7bmqKHmi5/ovpPlh7rlj6/ku6XlsIbku7vmhI/lvJXohJrorr7nva7kuLrmqKHmi5/ovpPlh7rlvJXohJrvvIzmi5PlsZXlpJrot6/mqKHmi5/ovpPlh7oKICBhbmFsb2dXcml0ZSgxMSwgMCk7CiAgZGVsYXkoMTAwMCk7CiAgYW5hbG9nV3JpdGUoMTEsIDEwMCk7CiAgZGVsYXkoMTAwMCk7CiAgYW5hbG9nV3JpdGUoMTEsIDI1NSk7CiAgZGVsYXkoMTAwMCk7CgogIC8v5Y+W5raI6L2v5Lu25qih5ouf6L6T5Ye65Y+v5Lul5Y+W5raIUFdN6L6T5Ye677yM5LiA6Iis5LiN5L2/55SoCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/08_Multi_functional_keys.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/08_Multi_functional_keys.mix new file mode 100644 index 00000000..59c15fd8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/08_Multi_functional_keys.mix @@ -0,0 +1 @@ +多功能按键可以使用一系列的按键事件来触发某个程序是否执行下列程序单击可以切换LED的亮灭多功能按键的使用需要先声明动作(单击,双击等)与状态(按键按下的状态)分别改变动作条件,对比不同动作的特点按键未按下时应该固定上拉或者下拉悬空可设置为管脚上拉模式attachClick12HIGH11HIGH11CiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KCk9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WkmuWKn+iDveaMiemUruWPr+S7peS9v+eUqOS4gOezu+WIl+eahOaMiemUruS6i+S7tuadpeinpuWPkeafkOS4queoi+W6j+aYr+WQpuaJp+ihjAogIC8v5LiL5YiX56iL5bqP5Y2V5Ye75Y+v5Lul5YiH5o2iTEVE55qE5Lqu54GtCiAgLy/lpJrlip/og73mjInplK7nmoTkvb/nlKjpnIDopoHlhYjlo7DmmI7liqjkvZzvvIjljZXlh7vvvIzlj4zlh7vnrYnvvInkuI7nirbmgIHvvIjmjInplK7mjInkuIvnmoTnirbmgIHvvIkKICAvL+WIhuWIq+aUueWPmOWKqOS9nOadoeS7tu+8jOWvueavlOS4jeWQjOWKqOS9nOeahOeJueeCuQogIC8v5oyJ6ZSu5pyq5oyJ5LiL5pe25bqU6K+l5Zu65a6a5LiK5ouJ5oiW6ICF5LiL5ouJCiAgLy/mgqznqbrlj6/orr7nva7kuLrnrqHohJrkuIrmi4nmqKHlvI8KCiAgYnV0dG9uMTIudGljaygpOwp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/09_Hardware_Interrupts.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/09_Hardware_Interrupts.mix new file mode 100644 index 00000000..4e4bb755 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/09_Hardware_Interrupts.mix @@ -0,0 +1 @@ +中断不受其他函数影响,中断触发条件有上升沿,下降沿与电平状态改变此处百度了解什么是上升沿,下降沿硬件中断只有2和3管脚支持下列程序中延时函数并不会影响中断函数,因此中断函数是实时的RISING211HIGH11一般不使用取消中断213HIGH13delay1000dm9pZCBhdHRhY2hJbnRlcnJ1cHRfZnVuX1JJU0lOR18yKCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgyLCBJTlBVVF9QVUxMVVApOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgYXR0YWNoSW50ZXJydXB0KGRpZ2l0YWxQaW5Ub0ludGVycnVwdCgyKSxhdHRhY2hJbnRlcnJ1cHRfZnVuX1JJU0lOR18yLFJJU0lORyk7CiAgcGluTW9kZSgxMywgT1VUUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuK3mlq3kuI3lj5flhbbku5blh73mlbDlvbHlk43vvIzkuK3mlq3op6blj5HmnaHku7bmnInkuIrljYfmsr/vvIzkuIvpmY3msr/kuI7nlLXlubPnirbmgIHmlLnlj5gKICAvL+atpOWkhOeZvuW6puS6huino+S7gOS5iOaYr+S4iuWNh+ayv++8jOS4i+mZjeayvwogIC8v56Gs5Lu25Lit5pat5Y+q5pyJMuWSjDPnrqHohJrmlK/mjIEKICAvL+S4i+WIl+eoi+W6j+S4reW7tuaXtuWHveaVsOW5tuS4jeS8muW9seWTjeS4reaWreWHveaVsO+8jOWboOatpOS4reaWreWHveaVsOaYr+WunuaXtueahAoKICAvL+S4gOiIrOS4jeS9v+eUqOWPlua2iOS4reaWrQoKICBkaWdpdGFsV3JpdGUoMTMsKCFkaWdpdGFsUmVhZCgxMykpKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/10_Software_Interruptions.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/10_Software_Interruptions.mix new file mode 100644 index 00000000..b6e88df2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/10_Software_Interruptions.mix @@ -0,0 +1 @@ +软件中断与硬件中断类似作用,但软件中断可以使用任意引脚作为中断引脚RISING1211HIGH11一般不使用取消中断013HIGH13delay1000CiNpbmNsdWRlIDxQaW5DaGFuZ2VJbnQuaD4KCnZvaWQgYXR0YWNoUGluSW50ZXJydXB0X2Z1bl9SSVNJTkdfMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDEyLCBJTlBVVCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBQQ2ludFBvcnQ6OmF0dGFjaEludGVycnVwdCgxMixhdHRhY2hQaW5JbnRlcnJ1cHRfZnVuX1JJU0lOR18xMixSSVNJTkcpOwogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L2v5Lu25Lit5pat5LiO56Gs5Lu25Lit5pat57G75Ly85L2c55So77yM5L2G6L2v5Lu25Lit5pat5Y+v5Lul5L2/55So5Lu75oSP5byV6ISa5L2c5Li65Lit5pat5byV6ISaCgogIC8v5LiA6Iis5LiN5L2/55So5Y+W5raI5Lit5patCgogIGRpZ2l0YWxXcml0ZSgxMywoIWRpZ2l0YWxSZWFkKDEzKSkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/11_Pulse_measurement.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/11_Pulse_measurement.mix new file mode 100644 index 00000000..ca82053d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/11_Pulse_measurement.mix @@ -0,0 +1 @@ +脉冲测量可以返回某个电平状态持续的时间例如下列程序中当12号管脚状态为高时返回该状态持续的时间状态超时返回0利用脉冲测量可以测量速度,频率等思考如何测量PWM的输出频率Serial115200SerialprintlnHIGH12此块相比与脉冲测量多了一个超时状态,状态持续超过设置时间返回 0HIGH121000000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTIsIElOUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ohInlhrLmtYvph4/lj6/ku6Xov5Tlm57mn5DkuKrnlLXlubPnirbmgIHmjIHnu63nmoTml7bpl7QKICAvL+S+i+WmguS4i+WIl+eoi+W6j+S4reW9kzEy5Y+3566h6ISa54q25oCB5Li66auY5pe26L+U5Zue6K+l54q25oCB5oyB57ut55qE5pe26Ze0CiAgLy/nirbmgIHotoXml7bov5Tlm54wCiAgLy/liKnnlKjohInlhrLmtYvph4/lj6/ku6XmtYvph4/pgJ/luqbvvIzpopHnjofnrYkKICAvL+aAneiAg+WmguS9lea1i+mHj1BXTeeahOi+k+WHuumikeeOhwogIFNlcmlhbC5wcmludGxuKHB1bHNlSW4oMTIsIEhJR0gpKTsKCiAgLy/mraTlnZfnm7jmr5TkuI7ohInlhrLmtYvph4/lpJrkuobkuIDkuKrotoXml7bnirbmgIHvvIznirbmgIHmjIHnu63otoXov4forr7nva7ml7bpl7Tov5Tlm54gMAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/12_Pin_up_mode.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/12_Pin_up_mode.mix new file mode 100644 index 00000000..2d6d55bf --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/12_Pin_up_mode.mix @@ -0,0 +1 @@ +管脚上拉模式相当于接上拉电阻,可以给管脚一个初始高电平悬空12号管脚分别启用与禁用上拉输入观察串口状态INPUT_PULLUP12Serial115200Serialprintln1211HIGH12delay100dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUX1BVTExVUCk7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/nrqHohJrkuIrmi4nmqKHlvI/nm7jlvZPkuo7mjqXkuIrmi4nnlLXpmLvvvIzlj6/ku6Xnu5nnrqHohJrkuIDkuKrliJ3lp4vpq5jnlLXlubMKICAvL+aCrOepujEy5Y+3566h6ISa5YiG5Yir5ZCv55So5LiO56aB55So5LiK5ouJ6L6T5YWl6KeC5a+f5Liy5Y+j54q25oCBCgogIFNlcmlhbC5wcmludGxuKGRpZ2l0YWxSZWFkKDEyKSk7CiAgZGlnaXRhbFdyaXRlKDExLGRpZ2l0YWxSZWFkKDEyKSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/13_Serial_Data_Output.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/13_Serial_Data_Output.mix new file mode 100644 index 00000000..6b798e07 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/01_input_and_Output/13_Serial_Data_Output.mix @@ -0,0 +1 @@ +shiftOut通常与移位寄存器一起使用,移位寄存器通常使用74HC595此功能实际运用不多,一般用于拓展输出移位寄存器使用复杂,学习时通常用专用IO拓展芯片拓展阅读 https://blog.jmaker.com.tw/74hc595/MSBFIRST450dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoNCwgT1VUUFVUKTsKICBwaW5Nb2RlKDUsIE9VVFBVVCk7CiAgc2hpZnRPdXQoNCwgNSwgTVNCRklSU1QsIDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3NoaWZ0T3V06YCa5bi45LiO56e75L2N5a+E5a2Y5Zmo5LiA6LW35L2/55So77yM56e75L2N5a+E5a2Y5Zmo6YCa5bi45L2/55SoNzRIQzU5NQogIC8v5q2k5Yqf6IO95a6e6ZmF6L+Q55So5LiN5aSa77yM5LiA6Iis55So5LqO5ouT5bGV6L6T5Ye6CiAgLy/np7vkvY3lr4TlrZjlmajkvb/nlKjlpI3mnYLvvIzlrabkuaDml7bpgJrluLjnlKjkuJPnlKhJT+aLk+WxleiKr+eJhwogIC8v5ouT5bGV6ZiF6K+7IGh0dHBzOi8vYmxvZy5qbWFrZXIuY29tLnR3Lzc0aGM1OTUvCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/01_Stop_the_program.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/01_Stop_the_program.mix new file mode 100644 index 00000000..7e1bfe92 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/01_Stop_the_program.mix @@ -0,0 +1 @@ +RISING1211HIGH11停止程序相当于无限延时下面的程序中加了停止程序,LED将不再闪烁中断程序优先级更高不会受其影响11HIGH11delay1000CiNpbmNsdWRlIDxQaW5DaGFuZ2VJbnQuaD4KCnZvaWQgYXR0YWNoUGluSW50ZXJydXB0X2Z1bl9SSVNJTkdfMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDEyLCBJTlBVVCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBQQ2ludFBvcnQ6OmF0dGFjaEludGVycnVwdCgxMixhdHRhY2hQaW5JbnRlcnJ1cHRfZnVuX1JJU0lOR18xMixSSVNJTkcpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WBnOatoueoi+W6j+ebuOW9k+S6juaXoOmZkOW7tuaXtgogIC8v5LiL6Z2i55qE56iL5bqP5Lit5Yqg5LqG5YGc5q2i56iL5bqP77yMTEVE5bCG5LiN5YaN6Zeq54OBCiAgLy/kuK3mlq3nqIvluo/kvJjlhYjnuqfmm7Tpq5jkuI3kvJrlj5flhbblvbHlk40KICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICBkZWxheSgxMDAwKTsKICB3aGlsZSh0cnVlKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/02_Difference_between_while_and_do_while.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/02_Difference_between_while_and_do_while.mix new file mode 100644 index 00000000..1193b18b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/02_Difference_between_while_and_do_while.mix @@ -0,0 +1 @@ +Serial115200do while会先执行一次程序后判断条件是否成立,条件成立重复执行,反之跳出循环trueSerialprintln1delay1000FALSEwhile会先判断条件是否成立,再选择是否执行程序,条件成立重复执行,反之跳出循环WHILETRUESerialprintln2delay1000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIC8vZG8gd2hpbGXkvJrlhYjmiafooYzkuIDmrKHnqIvluo/lkI7liKTmlq3mnaHku7bmmK/lkKbmiJDnq4vvvIzmnaHku7bmiJDnq4vph43lpI3miafooYzvvIzlj43kuYvot7Plh7rlvqrnjq8KICBkb3sKICAgIFNlcmlhbC5wcmludGxuKCIxIik7CiAgICBkZWxheSgxMDAwKTsKICB9d2hpbGUoZmFsc2UpOwogIC8vd2hpbGXkvJrlhYjliKTmlq3mnaHku7bmmK/lkKbmiJDnq4vvvIzlho3pgInmi6nmmK/lkKbmiafooYznqIvluo/vvIzmnaHku7bmiJDnq4vph43lpI3miafooYzvvIzlj43kuYvot7Plh7rlvqrnjq8KICB3aGlsZSAodHJ1ZSkgewogICAgU2VyaWFsLnByaW50bG4oIjIiKTsKICAgIGRlbGF5KDEwMDApOwogIH0KfQoKdm9pZCBsb29wKCl7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/03_if_elseConditional_Judgment.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/03_if_elseConditional_Judgment.mix new file mode 100644 index 00000000..99bc515a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/03_if_elseConditional_Judgment.mix @@ -0,0 +1 @@ +if else语句会根据条件的不同选择性的执行不同的程序下面的程序当12管脚状态为高时点亮LED,反之熄灭LED1211HIGH11LOWdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL2lmIGVsc2Xor63lj6XkvJrmoLnmja7mnaHku7bnmoTkuI3lkIzpgInmi6nmgKfnmoTmiafooYzkuI3lkIznmoTnqIvluo8KICAvL+S4i+mdoueahOeoi+W6j+W9kzEy566h6ISa54q25oCB5Li66auY5pe254K55LquTEVE77yM5Y+N5LmL54aE54GtTEVECiAgaWYgKGRpZ2l0YWxSZWFkKDEyKSkgewogICAgZGlnaXRhbFdyaXRlKDExLEhJR0gpOwoKICB9IGVsc2UgewogICAgZGlnaXRhbFdyaXRlKDExLExPVyk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/04_switch_Multi_branching_condition_control.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/04_switch_Multi_branching_condition_control.mix new file mode 100644 index 00000000..ab383617 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/04_switch_Multi_branching_condition_control.mix @@ -0,0 +1 @@ +switch为多分枝条件判断语句,不同条件执行不同的程序switch条件只能为整数没有已知条件时才会执行default程序上传程序输入不同数字观察串口输出结果验证swichSerial115200SerialtoInt123Serial0Serialprintln01Serialprintln12Serialprintln2Serialprintln4dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3N3aXRjaOS4uuWkmuWIhuaeneadoeS7tuWIpOaWreivreWPpe+8jOS4jeWQjOadoeS7tuaJp+ihjOS4jeWQjOeahOeoi+W6jwogIC8vc3dpdGNo5p2h5Lu25Y+q6IO95Li65pW05pWwCiAgLy/msqHmnInlt7Lnn6XmnaHku7bml7bmiY3kvJrmiafooYxkZWZhdWx056iL5bqPCiAgLy/kuIrkvKDnqIvluo/ovpPlhaXkuI3lkIzmlbDlrZfop4Llr5/kuLLlj6PovpPlh7rnu5Pmnpzpqozor4Fzd2ljaAogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBzd2l0Y2ggKFN0cmluZyhTZXJpYWwucmVhZFN0cmluZygpKS50b0ludCgpKSB7CiAgICAgY2FzZSAwOgogICAgICBTZXJpYWwucHJpbnRsbigiMCIpOwogICAgICBicmVhazsKICAgICBjYXNlIDE6CiAgICAgIFNlcmlhbC5wcmludGxuKCIxIik7CiAgICAgIGJyZWFrOwogICAgIGNhc2UgMjoKICAgICAgU2VyaWFsLnByaW50bG4oIjIiKTsKICAgICAgYnJlYWs7CiAgICAgZGVmYXVsdDoKICAgICAgU2VyaWFsLnByaW50bG4oIjQiKTsKICAgICAgYnJlYWs7CiAgICB9CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/05_for_Circular_breathing_light.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/05_for_Circular_breathing_light.mix new file mode 100644 index 00000000..27f8dd64 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/05_for_Circular_breathing_light.mix @@ -0,0 +1 @@ +for循环可以指定循环次数重复执行程序下面程序利用for循环实现了呼吸灯的效果注意for循环步长,如果是由小到大则为正数,反之为负数i02551110idelay5i2541-1110idelay5dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8vZm9y5b6q546v5Y+v5Lul5oyH5a6a5b6q546v5qyh5pWw6YeN5aSN5omn6KGM56iL5bqPCiAgLy/kuIvpnaLnqIvluo/liKnnlKhmb3Llvqrnjq/lrp7njrDkuoblkbzlkLjnga/nmoTmlYjmnpwKICAvL+azqOaEj2ZvcuW+queOr+atpemVv++8jOWmguaenOaYr+eUseWwj+WIsOWkp+WImeS4uuato+aVsO+8jOWPjeS5i+S4uui0n+aVsAogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI1NTsgaSA9IGkgKyAoMSkpIHsKICAgIGFuYWxvZ1dyaXRlKDExLCBpKTsKICAgIGRlbGF5KDUpOwogIH0KICBmb3IgKGludCBpID0gMjU0OyBpID49IDE7IGkgPSBpICsgKC0xKSkgewogICAgYW5hbG9nV3JpdGUoMTEsIGkpOwogICAgZGVsYXkoNSk7CiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/06_Jump_out_of_the_loop.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/06_Jump_out_of_the_loop.mix new file mode 100644 index 00000000..5e55d24b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/06_Jump_out_of_the_loop.mix @@ -0,0 +1 @@ +跳出循环可以跳出while循环,do while循环与for循环for循环还可选择跳过某个循环值下面程序当12管脚电平状态为高时跳出循环WHILETRUE11HIGH11delay10012BREAKdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgcGluTW9kZSgxMiwgSU5QVVQpOwogIHdoaWxlICh0cnVlKSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICAgIGRlbGF5KDEwMCk7CiAgICBpZiAoZGlnaXRhbFJlYWQoMTIpKSB7CiAgICAgIGJyZWFrOwoKICAgIH0KICB9Cn0KCnZvaWQgbG9vcCgpewogIC8v6Lez5Ye65b6q546v5Y+v5Lul6Lez5Ye6d2hpbGXlvqrnjq/vvIxkbyB3aGlsZeW+queOr+S4jmZvcuW+queOrwogIC8vZm9y5b6q546v6L+Y5Y+v6YCJ5oup6Lez6L+H5p+Q5Liq5b6q546v5YC8CiAgLy/kuIvpnaLnqIvluo/lvZMxMueuoeiEmueUteW5s+eKtuaAgeS4uumrmOaXtui3s+WHuuW+queOrwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/07_System_runtime.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/07_System_runtime.mix new file mode 100644 index 00000000..2e64ed8e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/07_System_runtime.mix @@ -0,0 +1 @@ +系统运行时间为开发板上电开始运行程序时刻到当前时刻的时间程序开始时间为0上传程序观察串口输出Serial115200Serialprintlnmillisdelay1000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+ezu+e7n+i/kOihjOaXtumXtOS4uuW8gOWPkeadv+S4iueUteW8gOWni+i/kOihjOeoi+W6j+aXtuWIu+WIsOW9k+WJjeaXtuWIu+eahOaXtumXtAogIC8v56iL5bqP5byA5aeL5pe26Ze05Li6MAogIC8v5LiK5Lyg56iL5bqP6KeC5a+f5Liy5Y+j6L6T5Ye6CiAgU2VyaWFsLnByaW50bG4obWlsbGlzKCkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/08_Hardware_Timer.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/08_Hardware_Timer.mix new file mode 100644 index 00000000..f5f84efc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/08_Hardware_Timer.mix @@ -0,0 +1 @@ +硬件定时器会每隔固定时间重复执行某段程序定时器与中断一样优先级更高,不会受延时函数的影响Serial115200500Serialprintlnhello停止定时器一般不用11HIGH11delay1000CiNpbmNsdWRlIDxNc1RpbWVyMi5oPgoKdm9pZCBtc1RpbWVyMl9mdW5jKCkgewogIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgTXNUaW1lcjI6OnNldCg1MDAsIG1zVGltZXIyX2Z1bmMpOwogIE1zVGltZXIyOjpzdGFydCgpOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v56Gs5Lu25a6a5pe25Zmo5Lya5q+P6ZqU5Zu65a6a5pe26Ze06YeN5aSN5omn6KGM5p+Q5q6156iL5bqPCiAgLy/lrprml7blmajkuI7kuK3mlq3kuIDmoLfkvJjlhYjnuqfmm7Tpq5jvvIzkuI3kvJrlj5flu7bml7blh73mlbDnmoTlvbHlk40KCiAgLy/lgZzmraLlrprml7blmajkuIDoiKzkuI3nlKgKCiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CiAgZGVsYXkoMTAwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/09_Simple_Timer.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/09_Simple_Timer.mix new file mode 100644 index 00000000..d51c7630 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/09_Simple_Timer.mix @@ -0,0 +1 @@ +简单定时器与硬件定时器一样都会每隔固定时间重复执行某段程序软件定时器最多可用16个,优先级低会受到延时等阻塞函数的影响1100011HIGH112500SerialprintlnhelloCiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwp9Cgp2b2lkIFNpbXBsZV90aW1lcl8yKCkgewogIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgdGltZXIuc2V0SW50ZXJ2YWwoNTAwTCwgU2ltcGxlX3RpbWVyXzIpOwoKfQoKdm9pZCBsb29wKCl7CiAgLy/nroDljZXlrprml7blmajkuI7noazku7blrprml7blmajkuIDmoLfpg73kvJrmr4/pmpTlm7rlrprml7bpl7Tph43lpI3miafooYzmn5DmrrXnqIvluo8KICAvL+i9r+S7tuWumuaXtuWZqOacgOWkmuWPr+eUqDE25Liq77yM5LyY5YWI57qn5L2O5Lya5Y+X5Yiw5bu25pe2562J6Zi75aGe5Ye95pWw55qE5b2x5ZONCgoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/10_Register_delay_function.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/10_Register_delay_function.mix new file mode 100644 index 00000000..e4337f9c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/10_Register_delay_function.mix @@ -0,0 +1 @@ +注册延时函数与执行延时函数需要成对使用,执行延时函数后会等待指定的时间后执行注册延时函数程序与简单定时器有着相同的限制,优先级低会受到延时等函数影响可以选择注册延时函数重复重复执行的次数Serial115200attachClick12HIGH11HIGH110001210010111LOW2SerialprintlnhelloCiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpPbmVCdXR0b24gYnV0dG9uMTIoMTIsZmFsc2UpOwpTaW1wbGVUaW1lciB0aW1lcjsKCnZvaWQgYXR0YWNoQ2xpY2sxMigpIHsKICBkaWdpdGFsV3JpdGUoMTEsSElHSCk7CiAgdGltZXIuc2V0VGltZXIoMTAwMCwgc3VwZXJfZGVsYXlfZnVuY3Rpb24xLCAxKTsKICB0aW1lci5zZXRUaW1lcigxMDAsIHN1cGVyX2RlbGF5X2Z1bmN0aW9uMiwgMTApOwp9Cgp2b2lkIHN1cGVyX2RlbGF5X2Z1bmN0aW9uMSgpIHsKICBkaWdpdGFsV3JpdGUoMTEsTE9XKTsKfQoKdm9pZCBzdXBlcl9kZWxheV9mdW5jdGlvbjIoKSB7CiAgU2VyaWFsLnByaW50bG4oImhlbGxvIik7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+azqOWGjOW7tuaXtuWHveaVsOS4juaJp+ihjOW7tuaXtuWHveaVsOmcgOimgeaIkOWvueS9v+eUqO+8jOaJp+ihjOW7tuaXtuWHveaVsOWQjuS8muetieW+heaMh+WumueahOaXtumXtOWQjuaJp+ihjOazqOWGjOW7tuaXtuWHveaVsOeoi+W6jwogIC8v5LiO566A5Y2V5a6a5pe25Zmo5pyJ552A55u45ZCM55qE6ZmQ5Yi277yM5LyY5YWI57qn5L2O5Lya5Y+X5Yiw5bu25pe2562J5Ye95pWw5b2x5ZONCiAgLy/lj6/ku6XpgInmi6nms6jlhozlu7bml7blh73mlbDph43lpI3ph43lpI3miafooYznmoTmrKHmlbAKCiAgYnV0dG9uMTIudGljaygpOwoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/11_SCoop_Multi-threaded.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/11_SCoop_Multi-threaded.mix new file mode 100644 index 00000000..d09e8038 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/02_Control/11_SCoop_Multi-threaded.mix @@ -0,0 +1 @@ +SCoop多线程可以简化程序,每个线程程序“互不影响”多线程的前提是同一硬件资源同一时刻只能被一个线程调用,否则会出现一些bug或者板子无限重启使用时应当合理规划程序,避免线程冲突Serial115200111HIGH1110002Serialprintlnhello1000CiNpbmNsdWRlICJTQ29vcC5oIgoKZGVmaW5lVGFzayhzY29vcFRhc2sxKQp2b2lkIHNjb29wVGFzazE6OnNldHVwKCkKewp9CnZvaWQgc2Nvb3BUYXNrMTo6bG9vcCgpCnsKICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICBzbGVlcCgxMDAwKTsKfQoKZGVmaW5lVGFzayhzY29vcFRhc2syKQp2b2lkIHNjb29wVGFzazI6OnNldHVwKCkKewp9CnZvaWQgc2Nvb3BUYXNrMjo6bG9vcCgpCnsKICBTZXJpYWwucHJpbnRsbigiaGVsbG8iKTsKICBzbGVlcCgxMDAwKTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgbXlTQ29vcC5zdGFydCgpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL1NDb29w5aSa57q/56iL5Y+v5Lul566A5YyW56iL5bqP77yM5q+P5Liq57q/56iL56iL5bqP4oCc5LqS5LiN5b2x5ZON4oCdCiAgLy/lpJrnur/nqIvnmoTliY3mj5DmmK/lkIzkuIDnoazku7botYTmupDlkIzkuIDml7bliLvlj6rog73ooqvkuIDkuKrnur/nqIvosIPnlKjvvIzlkKbliJnkvJrlh7rnjrDkuIDkuptidWfmiJbogIXmnb/lrZDml6DpmZDph43lkK8KICAvL+S9v+eUqOaXtuW6lOW9k+WQiOeQhuinhOWIkueoi+W6j++8jOmBv+WFjee6v+eoi+WGsueqgQoKICB5aWVsZCgpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/01_Algebraic_operations.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/01_Algebraic_operations.mix new file mode 100644 index 00000000..d235f56a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/01_Algebraic_operations.mix @@ -0,0 +1 @@ +代数运算百度了解各个运算符Serial115200SerialprintlnADD12SerialprintlnMINUS12SerialprintlnMULTIPLY12SerialprintlnDIVIDE12SerialprintlnQUYU12SerialprintlnPOWER12dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKCgxICsgMikpOwogIFNlcmlhbC5wcmludGxuKCgxIC0gMikpOwogIFNlcmlhbC5wcmludGxuKCgxICogMikpOwogIFNlcmlhbC5wcmludGxuKCgxIC8gMikpOwogIFNlcmlhbC5wcmludGxuKCgobG9uZykgKDEpICUgKGxvbmcpICgyKSkpOwogIFNlcmlhbC5wcmludGxuKChwb3coMSwgMikpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ku6PmlbDov5DnrpcKICAvL+eZvuW6puS6huino+WQhOS4qui/kOeul+espgoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/02_Bit_Operations.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/02_Bit_Operations.mix new file mode 100644 index 00000000..6108df93 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/02_Bit_Operations.mix @@ -0,0 +1 @@ +位运算百度了解二进制与位运算位运算会将其他进制转换为二进制后进行按位运算Serial115200Serialprintln&67Serialprintln|67Serialprintln^67Serialprintln>>67Serialprintln<<67dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKCg2JjcpKTsKICBTZXJpYWwucHJpbnRsbigoNnw3KSk7CiAgU2VyaWFsLnByaW50bG4oKDZeNykpOwogIFNlcmlhbC5wcmludGxuKCg2Pj43KSk7CiAgU2VyaWFsLnByaW50bG4oKDY8PDcpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kvY3ov5DnrpcKICAvL+eZvuW6puS6huino+S6jOi/m+WItuS4juS9jei/kOeulwogIC8v5L2N6L+Q566X5Lya5bCG5YW25LuW6L+b5Yi26L2s5o2i5Li65LqM6L+b5Yi25ZCO6L+b6KGM5oyJ5L2N6L+Q566XCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/03_Trigonometric_functions.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/03_Trigonometric_functions.mix new file mode 100644 index 00000000..472cba1e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/03_Trigonometric_functions.mix @@ -0,0 +1 @@ +三角函数百度了解三角函数,指数函数与对数函数根据自身学过的函数选择功能验证Serial115200SerialprintlnSIN30SerialprintlnSIN30dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChzaW4oMzAgLyAxODAuMCAqIDMuMTQxNTkpKSk7CiAgU2VyaWFsLnByaW50bG4oKHNpbigzMCAvIDE4MC4wICogMy4xNDE1OSkpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuInop5Llh73mlbAKICAvL+eZvuW6puS6huino+S4ieinkuWHveaVsO+8jOaMh+aVsOWHveaVsOS4juWvueaVsOWHveaVsAogIC8v5qC55o2u6Ieq6Lqr5a2m6L+H55qE5Ye95pWw6YCJ5oup5Yqf6IO96aqM6K+BCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/04_Variable_self-adding.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/04_Variable_self-adding.mix new file mode 100644 index 00000000..e7737789 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/04_Variable_self-adding.mix @@ -0,0 +1 @@ +变量自加自减自乘自处global_variateitemint2Serial115200Serialprintlnitem+itemitem1Serialprintlnitem-itemitem1Serialprintlnitem*itemitem1Serialprintlnitem/itemitem1Serialprintlnitem++itemitemSerialprintlnitem--itemitemSerialprintlnitemdm9sYXRpbGUgaW50IGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9IDI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbSA9IGl0ZW0gKyAxOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0gPSBpdGVtIC0gMTsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtID0gaXRlbSAqIDE7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbSA9IGl0ZW0gLyAxOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0rKzsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtLS07CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Y+Y6YeP6Ieq5Yqg6Ieq5YeP6Ieq5LmY6Ieq5aSECgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/05_Common_mathematical_operations(Rounding_etc.).mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/05_Common_mathematical_operations(Rounding_etc.).mix new file mode 100644 index 00000000..8e437e40 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/05_Common_mathematical_operations(Rounding_etc.).mix @@ -0,0 +1 @@ +常见数学运算Serial115200Serialprintlnround6.666Serialprintlnceil6.666Serialprintlnfloor6.666Serialprintlnabs6.666Serialprintlnabs-6.666Serialprintlnsq4Serialprintlnsqrt16dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKHJvdW5kKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oY2VpbCg2LjY2NikpOwogIFNlcmlhbC5wcmludGxuKGZsb29yKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oYWJzKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oYWJzKC02LjY2NikpOwogIFNlcmlhbC5wcmludGxuKHNxKDQpKTsKICBTZXJpYWwucHJpbnRsbihzcXJ0KDE2KSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5bi46KeB5pWw5a2m6L+Q566XCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/06_Get_the_number_of_bytes_occupied_by_different_types_of_data.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/06_Get_the_number_of_bytes_occupied_by_different_types_of_data.mix new file mode 100644 index 00000000..e9f70104 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/06_Get_the_number_of_bytes_occupied_by_different_types_of_data.mix @@ -0,0 +1 @@ +获取不同类型数据占用的字节数Serial115200SerialprintlnintSerialprintlnunsigned intSerialprintlnwordSerialprintlnlongSerialprintlnunsigned longSerialprintlnfloatSerialprintlndoubleSerialprintlnbooleanSerialprintlnbyteSerialprintlncharSerialprintlnunsigned charSerialprintlnStringSerialprintlnuint8_tSerialprintlnuint16_tSerialprintlnuint32_tSerialprintlnuint64_tdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihpbnQpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YodW5zaWduZWQgaW50KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHdvcmQpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YobG9uZykpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1bnNpZ25lZCBsb25nKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGZsb2F0KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGRvdWJsZSkpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihib29sZWFuKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGJ5dGUpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YoY2hhcikpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1bnNpZ25lZCBjaGFyKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKFN0cmluZykpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1aW50OF90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQxNl90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQzMl90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQ2NF90KSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6I635Y+W5LiN5ZCM57G75Z6L5pWw5o2u5Y2g55So55qE5a2X6IqC5pWwCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/07_Maximum_and_minimum_values.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/07_Maximum_and_minimum_values.mix new file mode 100644 index 00000000..351d3aaa --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/07_Maximum_and_minimum_values.mix @@ -0,0 +1 @@ +两数相比去最大值或者最小值Serial115200Serialprintlnmax12Serialprintlnmin12dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKG1heCgxLCAyKSk7CiAgU2VyaWFsLnByaW50bG4obWluKDEsIDIpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuKTmlbDnm7jmr5TljrvmnIDlpKflgLzmiJbogIXmnIDlsI/lgLwKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/08_Get_random_number.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/08_Get_random_number.mix new file mode 100644 index 00000000..e78b79c4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/08_Get_random_number.mix @@ -0,0 +1 @@ +随机数包含最小值不含最大值attachClick12HIGHSerial115200997millisSerialprintln1100CiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KCk9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgcmFuZG9tU2VlZChtaWxsaXMoKSk7CiAgU2VyaWFsLnByaW50bG4oKHJhbmRvbSgxLCAxMDApKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/pmo/mnLrmlbDljIXlkKvmnIDlsI/lgLzkuI3lkKvmnIDlpKflgLwKCiAgYnV0dG9uMTIudGljaygpOwp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/09_Mathematical_constraints.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/09_Mathematical_constraints.mix new file mode 100644 index 00000000..d454c1f5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/09_Mathematical_constraints.mix @@ -0,0 +1 @@ +将模拟输入的值由0-1023约束到0-255110A70255dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WwhuaooeaLn+i+k+WFpeeahOWAvOeUsTAtMTAyM+e6puadn+WIsDAtMjU1CiAgYW5hbG9nV3JpdGUoMTEsIChjb25zdHJhaW4oYW5hbG9nUmVhZChBNyksIDAsIDI1NSkpKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/10_Mathematical_mapping.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/10_Mathematical_mapping.mix new file mode 100644 index 00000000..6b2fa5d1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/03_Mathematics/10_Mathematical_mapping.mix @@ -0,0 +1 @@ +将模拟输入的值由0-1023映射到0-255110map_intA7010230255dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WwhuaooeaLn+i+k+WFpeeahOWAvOeUsTAtMTAyM+aYoOWwhOWIsDAtMjU1CiAgYW5hbG9nV3JpdGUoMTEsIChtYXAoYW5hbG9nUmVhZChBNyksIDAsIDEwMjMsIDAsIDI1NSkpKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/01_Logical_relationships.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/01_Logical_relationships.mix new file mode 100644 index 00000000..f2983ef5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/01_Logical_relationships.mix @@ -0,0 +1 @@ +逻辑关系GTEA750011HIGH11LOWdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+mAu+i+keWFs+ezuwogIGlmIChhbmFsb2dSZWFkKEE3KSA+PSA1MDApIHsKICAgIGRpZ2l0YWxXcml0ZSgxMSxISUdIKTsKCiAgfSBlbHNlIHsKICAgIGRpZ2l0YWxXcml0ZSgxMSxMT1cpOwoKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/02_Logical_operations.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/02_Logical_operations.mix new file mode 100644 index 00000000..5c3ca9d4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/02_Logical_operations.mix @@ -0,0 +1 @@ +逻辑运算,且运算只有两个条件都为真结果才真,或运算只有有一个条件为真就返回真SerialprintlnAND10SerialprintlnAND11SerialprintlnOR10SerialprintlnOR00dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBTZXJpYWwucHJpbnRsbigoMSAmJiAwKSk7CiAgU2VyaWFsLnByaW50bG4oKDEgJiYgMSkpOwogIFNlcmlhbC5wcmludGxuKCgxIHx8IDApKTsKICBTZXJpYWwucHJpbnRsbigoMCB8fCAwKSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6YC76L6R6L+Q566X77yM5LiU6L+Q566X5Y+q5pyJ5Lik5Liq5p2h5Lu26YO95Li655yf57uT5p6c5omN55yf77yM5oiW6L+Q566X5Y+q5pyJ5pyJ5LiA5Liq5p2h5Lu25Li655yf5bCx6L+U5Zue55yfCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/03_Logical_non-operations.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/03_Logical_non-operations.mix new file mode 100644 index 00000000..ae7a6779 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/03_Logical_non-operations.mix @@ -0,0 +1 @@ +逻辑非运算,对输入取反Serial115200Serialprintln12delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTIsIElOUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/pgLvovpHpnZ7ov5DnrpfvvIzlr7novpPlhaXlj5blj40KICBTZXJpYWwucHJpbnRsbigoIWRpZ2l0YWxSZWFkKDEyKSkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/04_Conditional_return_value.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/04_Conditional_return_value.mix new file mode 100644 index 00000000..8c2b2e76 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/04_Logic/04_Conditional_return_value.mix @@ -0,0 +1 @@ +条件返回值,根据条件返回不同的值Serial115200Seriallocal_variate串口输入数字inttoInt123SerialSerialprintlnLTE串口输入数字200输入过小GTE串口输入数字600输入过大输入适合dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+adoeS7tui/lOWbnuWAvO+8jOagueaNruadoeS7tui/lOWbnuS4jeWQjOeahOWAvAogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBpbnQgX0U0X0I4X0IyX0U1XzhGX0EzX0U4X0JFXzkzX0U1Xzg1X0E1X0U2Xzk1X0IwX0U1X0FEXzk3ID0gU3RyaW5nKFNlcmlhbC5yZWFkU3RyaW5nKCkpLnRvSW50KCk7CiAgICBTZXJpYWwucHJpbnRsbigoKF9FNF9COF9CMl9FNV84Rl9BM19FOF9CRV85M19FNV84NV9BNV9FNl85NV9CMF9FNV9BRF85NyA8PSAyMDApPyLovpPlhaXov4flsI8iOigoX0U0X0I4X0IyX0U1XzhGX0EzX0U4X0JFXzkzX0U1Xzg1X0E1X0U2Xzk1X0IwX0U1X0FEXzk3ID49IDYwMCk/Iui+k+WFpei/h+WkpyI6Iui+k+WFpemAguWQiCIpKSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/01_String_Splicing.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/01_String_Splicing.mix new file mode 100644 index 00000000..e32f1bc7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/01_String_Splicing.mix @@ -0,0 +1 @@ +字符串拼接字符串拼接程序块可以拼接不同数据类型的数据组成一个字符串,就像冰糖葫芦一样Serial115200SerialprintlnHellohelloMixlyaSerialprintlnA0Cdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiaGVsbG8iKSArIFN0cmluZygnYScpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIkEiKSArIFN0cmluZygwKSArIFN0cmluZygiQyIpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLmi7zmjqUKICAvL+Wtl+espuS4suaLvOaOpeeoi+W6j+Wdl+WPr+S7peaLvOaOpeS4jeWQjOaVsOaNruexu+Wei+eahOaVsOaNrue7hOaIkOS4gOS4quWtl+espuS4su+8jOWwseWDj+WGsOezluiRq+iKpuS4gOagtwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/02_String_to_integer_or_decimal.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/02_String_to_integer_or_decimal.mix new file mode 100644 index 00000000..cf2c26b0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/02_String_to_integer_or_decimal.mix @@ -0,0 +1 @@ +字符串转整数或小数Serial115200SerialprintlnADD1toInt1231231SerialprintlnADD1toFloat1236.661dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChTdHJpbmcoIjEyMyIpLnRvSW50KCkgKyAxKSk7CiAgU2VyaWFsLnByaW50bG4oKFN0cmluZygiNi42NiIpLnRvRmxvYXQoKSArIDEpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLovazmlbTmlbDmiJblsI/mlbAKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/03_String_Index.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/03_String_Index.mix new file mode 100644 index 00000000..4f02acec --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/03_String_Index.mix @@ -0,0 +1 @@ +返回当前字符串在源字符串中的位置字符串长度0是第一位该块可以判断当前字符串是否属于源字符串若源字符串不包含子字符串返回-1Serial115200SerialSerialprintlnMixlyySerialdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+i/lOWbnuW9k+WJjeWtl+espuS4suWcqOa6kOWtl+espuS4suS4reeahOS9jee9rgogIC8v5a2X56ym5Liy6ZW/5bqmMOaYr+esrOS4gOS9jQogIC8v6K+l5Z2X5Y+v5Lul5Yik5pat5b2T5YmN5a2X56ym5Liy5piv5ZCm5bGe5LqO5rqQ5a2X56ym5LiyCiAgLy/oi6XmupDlrZfnrKbkuLLkuI3ljIXlkKvlrZDlrZfnrKbkuLLov5Tlm54tMQogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIk1peGx5IikuaW5kZXhPZihTdHJpbmcoU2VyaWFsLnJlYWRTdHJpbmcoKSkpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/04_Intercepting_strings.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/04_Intercepting_strings.mix new file mode 100644 index 00000000..ae67627e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/04_Intercepting_strings.mix @@ -0,0 +1 @@ +从源字符串中截取指定长度的字符串改变截取的位置查看串口输出小数保留有效位是截取字符串的一种特例Serial115200Serialprintlnsubstring03Serialprintln6.6662dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuc3Vic3RyaW5nKDAsMykpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZyg2LjY2NiwgMikpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+S7jua6kOWtl+espuS4suS4reaIquWPluaMh+WumumVv+W6pueahOWtl+espuS4sgogIC8v5pS55Y+Y5oiq5Y+W55qE5L2N572u5p+l55yL5Liy5Y+j6L6T5Ye6CiAgLy/lsI/mlbDkv53nlZnmnInmlYjkvY3mmK/miKrlj5blrZfnrKbkuLLnmoTkuIDnp43nibnkvosKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/05_String_conversion_and_replacement.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/05_String_conversion_and_replacement.mix new file mode 100644 index 00000000..97ed38c7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/05_String_conversion_and_replacement.mix @@ -0,0 +1 @@ +字符串转换与替换global_variateitemString helloSerial115200Serialprintlnitem.toUpperCase()StringitemSerialprintlnitem.toLowerCase()StringitemSerialprintlnitemStringitemhQSerialprintlnitemStringitemSerialprintlnitemU3RyaW5nIGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9ICIgICBoZWxsbyI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbS50b1VwcGVyQ2FzZSgpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0udG9Mb3dlckNhc2UoKTsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtLnJlcGxhY2UoImgiLCAiUSIpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0udHJpbSgpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+Wtl+espuS4sui9rOaNouS4juabv+aNogoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/06_String_First_Determination_and_Data_Type_Conversion.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/06_String_First_Determination_and_Data_Type_Conversion.mix new file mode 100644 index 00000000..0530abe0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/06_String_First_Determination_and_Data_Type_Conversion.mix @@ -0,0 +1 @@ +判断源字符串是否由指定的字符串开头或结尾数据类型转换可以将字符串转为其他数据类型Serial115200Serialprintln.startsWithsubstringsubSerialprintln.endsWithsubstringingSerialprintlnLTEint12350dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuc3RhcnRzV2l0aCgic3ViIikpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuZW5kc1dpdGgoImluZyIpKTsKICBTZXJpYWwucHJpbnRsbigoaW50KCIxMjMiKSA8PSA1MCkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WIpOaWrea6kOWtl+espuS4suaYr+WQpueUseaMh+WumueahOWtl+espuS4suW8gOWktOaIlue7k+WwvgogIC8v5pWw5o2u57G75Z6L6L2s5o2i5Y+v5Lul5bCG5a2X56ym5Liy6L2s5Li65YW25LuW5pWw5o2u57G75Z6LCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/07_Character_to_ascii_conversion.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/07_Character_to_ascii_conversion.mix new file mode 100644 index 00000000..21704fd6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/07_Character_to_ascii_conversion.mix @@ -0,0 +1 @@ +字符与ascii码互相转换Serial115200Serialprintln223Serialprintlnadm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKGNoYXIoMjIzKSk7CiAgU2VyaWFsLnByaW50bG4odG9hc2NpaSgnYScpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuI5hc2NpaeeggeS6kuebuOi9rOaNogoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/08_Incremental_conversion.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/08_Incremental_conversion.mix new file mode 100644 index 00000000..63e1a793 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/08_Incremental_conversion.mix @@ -0,0 +1 @@ +进制转换,将一个整数转换为对应的进制得到转换后的字符串Serial115200SerialprintlnBIN20SerialprintlnOCT20SerialprintlnDEC20SerialprintlnHEX20dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygyMCwgQklOKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKDIwLCBPQ1QpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoMjAsIERFQykpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygyMCwgSEVYKSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L+b5Yi26L2s5o2i77yM5bCG5LiA5Liq5pW05pWw6L2s5o2i5Li65a+55bqU55qE6L+b5Yi25b6X5Yiw6L2s5o2i5ZCO55qE5a2X56ym5LiyCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/09_String_length_and_getting_the_specified_position_character.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/09_String_length_and_getting_the_specified_position_character.mix new file mode 100644 index 00000000..b7075233 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/09_String_length_and_getting_the_specified_position_character.mix @@ -0,0 +1 @@ +获取字符串的长度与获取字符串的最后一个字符字符串长度从0开始计算,实际长度比字符数少1global_variateitemStringhelloSerial115200SerialprintlnhelloitemSerialprintlnhelloitem0MINUS1helloitem1U3RyaW5nIGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9ICJoZWxsbyI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKGl0ZW0pLmxlbmd0aCgpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoaXRlbSkuY2hhckF0KChTdHJpbmcoaXRlbSkubGVuZ3RoKCkgLSAxKSkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPluWtl+espuS4sueahOmVv+W6puS4juiOt+WPluWtl+espuS4sueahOacgOWQjuS4gOS4quWtl+espgogIC8v5a2X56ym5Liy6ZW/5bqm5LuOMOW8gOWni+iuoeeul++8jOWunumZhemVv+W6puavlOWtl+espuaVsOWwkTEKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/10_String_relations _and_comparisons.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/10_String_relations _and_comparisons.mix new file mode 100644 index 00000000..e9d4dcc1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/05_Text/10_String_relations _and_comparisons.mix @@ -0,0 +1 @@ +字符串关系与比较字符串关系有等于,开始于和结尾于字符串比较会将组成字符串的每个阿斯克码值相加再减去另一个字符串的值,一般不用Serial115200SerialprintlnequalshellohelloSerialprintlnstartsWithhelloheSerialprintlnendsWithhelloloSerialprintlnAaSerialprintlnAA1dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiaGVsbG8iKS5lcXVhbHMoU3RyaW5nKCJoZWxsbyIpKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCJoZWxsbyIpLnN0YXJ0c1dpdGgoU3RyaW5nKCJoZSIpKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCJoZWxsbyIpLmVuZHNXaXRoKFN0cmluZygibG8iKSkpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiQSIpLmNvbXBhcmVUbyhTdHJpbmcoImEiKSkpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiQSIpLmNvbXBhcmVUbyhTdHJpbmcoIkExIikpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLlhbPns7vkuI7mr5TovoMKICAvL+Wtl+espuS4suWFs+ezu+acieetieS6ju+8jOW8gOWni+S6juWSjOe7k+WwvuS6jgogIC8v5a2X56ym5Liy5q+U6L6D5Lya5bCG57uE5oiQ5a2X56ym5Liy55qE5q+P5Liq6Zi/5pav5YWL56CB5YC855u45Yqg5YaN5YeP5Y675Y+m5LiA5Liq5a2X56ym5Liy55qE5YC877yM5LiA6Iis5LiN55SoCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/01_One-dimensional_array_declaration.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/01_One-dimensional_array_declaration.mix new file mode 100644 index 00000000..dd501659 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/01_One-dimensional_array_declaration.mix @@ -0,0 +1 @@ +数组的声明数组可以存放多个同类型的数据数组有两种声明方式,一种是预定义数据,另一种是定义数据个数对于已确定的数据采用第一种定义方式,对于需要动态加载的采取第二种定义数组声明应避免中文命名Serial115200intmylist012intmylist1100SerialprintlnmylistSerialprintlnmylist1aW50IG15bGlzdFtdPXswLCAxLCAyfTsKCmludCBteWxpc3QxWzEwMF09e307Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKG15bGlzdCkvc2l6ZW9mKG15bGlzdFswXSkpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihteWxpc3QxKS9zaXplb2YobXlsaXN0MVswXSkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aVsOe7hOeahOWjsOaYjgogIC8v5pWw57uE5Y+v5Lul5a2Y5pS+5aSa5Liq5ZCM57G75Z6L55qE5pWw5o2uCiAgLy/mlbDnu4TmnInkuKTnp43lo7DmmI7mlrnlvI/vvIzkuIDnp43mmK/pooTlrprkuYnmlbDmja7vvIzlj6bkuIDnp43mmK/lrprkuYnmlbDmja7kuKrmlbAKICAvL+WvueS6juW3suehruWumueahOaVsOaNrumHh+eUqOesrOS4gOenjeWumuS5ieaWueW8j++8jOWvueS6jumcgOimgeWKqOaAgeWKoOi9veeahOmHh+WPluesrOS6jOenjeWumuS5iQogIC8v5pWw57uE5aOw5piO5bqU6YG/5YWN5Lit5paH5ZG95ZCNCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/02_Array_reading_and_writing.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/02_Array_reading_and_writing.mix new file mode 100644 index 00000000..bb3fe9fc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/02_Array_reading_and_writing.mix @@ -0,0 +1 @@ +数组的读写数组增加不存在的数据项并不会改变数组长度数组数据从0开始作为第一项增加不存在的数据项为有效数据,但不建议使用Serial115200intmylist012mylist38Serialprintlnmylisti031Serialprintlnmylist0iaW50IG15bGlzdFtdPXswLCAxLCAyfTsKCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKICBteWxpc3RbM10gPSA4OwogIFNlcmlhbC5wcmludGxuKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pKTsKICBmb3IgKGludCBpID0gMDsgaSA8PSAzOyBpID0gaSArICgxKSkgewogICAgU2VyaWFsLnByaW50bG4obXlsaXN0W2ldKTsKICB9Cn0KCnZvaWQgbG9vcCgpewogIC8v5pWw57uE55qE6K+75YaZCiAgLy/mlbDnu4Tlop7liqDkuI3lrZjlnKjnmoTmlbDmja7pobnlubbkuI3kvJrmlLnlj5jmlbDnu4Tplb/luqYKICAvL+aVsOe7hOaVsOaNruS7jjDlvIDlp4vkvZzkuLrnrKzkuIDpobkKICAvL+WinuWKoOS4jeWtmOWcqOeahOaVsOaNrumhueS4uuacieaViOaVsOaNru+8jOS9huS4jeW7uuiuruS9v+eUqAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/03_Array_circular_shift.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/03_Array_circular_shift.mix new file mode 100644 index 00000000..f0fe6442 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/03_Array_circular_shift.mix @@ -0,0 +1 @@ +数组循环移位(仅对一维数组有效)将数组首位相连看做一个整体左移位与右移位相当于逆时针转动与顺时针转动Serial115200intmylist012i021Serialprintlnmylist0iint0mylisti021Serialprintlnmylist0iint1mylisti021Serialprintlnmylist0iaW50IG15bGlzdFtdPXswLCAxLCAyfTsKCnZvaWQgYXJyYXlfbGVmdF9sb29wKCkgewogIGludCBpdGVtID0wOwogIGl0ZW0gPSBteWxpc3RbKGludCkoMCldOwogIGZvciAoaW50IGkgPSAoMik7IGkgPD0gKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pKTsgaSA9IGkgKyAoMSkpIHsKICAgIG15bGlzdFsoaW50KSgoaSAtIDEpIC0gMSldID0gbXlsaXN0WyhpbnQpKGkgLSAxKV07CiAgfQogIG15bGlzdFsoaW50KShzaXplb2YobXlsaXN0KS9zaXplb2YobXlsaXN0WzBdKSAtIDEpXSA9IGl0ZW07Cn0KCnZvaWQgYXJyYXlfcmlnaHRfbG9vcCgpIHsKICBpbnQgaXRlbSA9MDsKICBpdGVtID0gbXlsaXN0WyhpbnQpKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pIC0gMSldOwogIGZvciAoaW50IGkgPSAoc2l6ZW9mKG15bGlzdCkvc2l6ZW9mKG15bGlzdFswXSkpOyBpID49ICgxKTsgaSA9IGkgKyAoLTEpKSB7CiAgICBteWxpc3RbKGludCkoKGkgKyAxKSAtIDEpXSA9IG15bGlzdFsoaW50KShpIC0gMSldOwogIH0KICBteWxpc3RbKGludCkoMCldID0gaXRlbTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI7IGkgPSBpICsgKDEpKSB7CiAgICBTZXJpYWwucHJpbnRsbihteWxpc3RbaV0pOwogIH0KICBhcnJheV9sZWZ0X2xvb3AoKTsKICBmb3IgKGludCBpID0gMDsgaSA8PSAyOyBpID0gaSArICgxKSkgewogICAgU2VyaWFsLnByaW50bG4obXlsaXN0W2ldKTsKICB9CiAgYXJyYXlfcmlnaHRfbG9vcCgpOwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI7IGkgPSBpICsgKDEpKSB7CiAgICBTZXJpYWwucHJpbnRsbihteWxpc3RbaV0pOwogIH0KfQoKdm9pZCBsb29wKCl7CiAgLy/mlbDnu4Tlvqrnjq/np7vkvY3vvIjku4Xlr7nkuIDnu7TmlbDnu4TmnInmlYjvvIkKICAvL+WwhuaVsOe7hOmmluS9jeebuOi/nueci+WBmuS4gOS4quaVtOS9k+W3puenu+S9jeS4juWPs+enu+S9jeebuOW9k+S6jumAhuaXtumSiOi9rOWKqOS4jumhuuaXtumSiOi9rOWKqAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/04_Two-dimensional_array_declaration.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/04_Two-dimensional_array_declaration.mix new file mode 100644 index 00000000..16f38c0a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/04_Two-dimensional_array_declaration.mix @@ -0,0 +1 @@ +二维数组的声明二维数组可以看做是一维数组的集合就像方队一样,由行和列构成,每个人(元素)共同构成了方队(二维数组)Serial115200intmylist012123234234intarray22{0,0},{0,0}SerialprintlnmylistrowSerialprintlnmylistcolSerialprintlnarrayrowSerialprintlnarraycolaW50IG15bGlzdFs0XVszXSA9IHsKICB7MCwgMSwgMn0sCiAgezEsIDIsIDN9LAogIHsyLCAzLCA0fSwKICB7MiwgMywgNH0KfTsKaW50IGFycmF5WzJdWzJdPXt7MCwwfSx7MCwwfX07CgoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChzaXplb2YobXlsaXN0KSAvIHNpemVvZihteWxpc3RbMF0pKSk7CiAgU2VyaWFsLnByaW50bG4oKHNpemVvZihteWxpc3RbMF0pIC8gc2l6ZW9mKG15bGlzdFswXVswXSkpKTsKICBTZXJpYWwucHJpbnRsbigoc2l6ZW9mKGFycmF5KSAvIHNpemVvZihhcnJheVswXSkpKTsKICBTZXJpYWwucHJpbnRsbigoc2l6ZW9mKGFycmF5WzBdKSAvIHNpemVvZihhcnJheVswXVswXSkpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuoznu7TmlbDnu4TnmoTlo7DmmI4KICAvL+S6jOe7tOaVsOe7hOWPr+S7peeci+WBmuaYr+S4gOe7tOaVsOe7hOeahOmbhuWQiAogIC8v5bCx5YOP5pa56Zif5LiA5qC377yM55Sx6KGM5ZKM5YiX5p6E5oiQ77yM5q+P5Liq5Lq677yI5YWD57Sg77yJ5YWx5ZCM5p6E5oiQ5LqG5pa56Zif77yI5LqM57u05pWw57uE77yJCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/05_Two-dimensional_array_reading_and_writing.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/05_Two-dimensional_array_reading_and_writing.mix new file mode 100644 index 00000000..39ee5a5a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/06_Arrays/05_Two-dimensional_array_reading_and_writing.mix @@ -0,0 +1 @@ +二维数组的读写二维数组的使用需要知道行与列Serial115200intmylist012123mylist00666i011j021Serialprintmylist0i0jSerialprint SerialprintlnaW50IG15bGlzdFsyXVszXSA9IHsKICB7MCwgMSwgMn0sCiAgezEsIDIsIDN9Cn07Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgbXlsaXN0WzBdWzBdID0gNjY2OwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDE7IGkgPSBpICsgKDEpKSB7CiAgICBmb3IgKGludCBqID0gMDsgaiA8PSAyOyBqID0gaiArICgxKSkgewogICAgICBTZXJpYWwucHJpbnQobXlsaXN0W2ldW2pdKTsKICAgICAgU2VyaWFsLnByaW50KCIgICAgIik7CiAgICB9CiAgICBTZXJpYWwucHJpbnRsbigiIik7CiAgfQp9Cgp2b2lkIGxvb3AoKXsKICAvL+S6jOe7tOaVsOe7hOeahOivu+WGmQogIC8v5LqM57u05pWw57uE55qE5L2/55So6ZyA6KaB55+l6YGT6KGM5LiO5YiXCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/07_Variables/01_Difference_between_variable_declaration_and_use.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/07_Variables/01_Difference_between_variable_declaration_and_use.mix new file mode 100644 index 00000000..4d059364 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/07_Variables/01_Difference_between_variable_declaration_and_use.mix @@ -0,0 +1 @@ +变量使用需要先声明数据类型变量分为全局变量与局部变量全局变量整个程序全局调用,局部变量只对当前函数有效全局变量整个程序全局调用,局部变量只对当前函数有效,例如这里声明了两个同名变量item&#10;其中主循环loop里声明的是局部变量,同名局部变量会覆盖全局变量Serial115200global_variateitemint123Serialprintlnitemitem888Serialprintlnitemlocal_variateitemint666Serialprintlnitemdm9sYXRpbGUgaW50IGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgaXRlbSA9IDEyMzsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lj5jph4/kvb/nlKjpnIDopoHlhYjlo7DmmI7mlbDmja7nsbvlnosKICAvL+WPmOmHj+WIhuS4uuWFqOWxgOWPmOmHj+S4juWxgOmDqOWPmOmHjwogIC8v5YWo5bGA5Y+Y6YeP5pW05Liq56iL5bqP5YWo5bGA6LCD55So77yM5bGA6YOo5Y+Y6YeP5Y+q5a+55b2T5YmN5Ye95pWw5pyJ5pWICiAgLy/lhajlsYDlj5jph4/mlbTkuKrnqIvluo/lhajlsYDosIPnlKjvvIzlsYDpg6jlj5jph4/lj6rlr7nlvZPliY3lh73mlbDmnInmlYjvvIzkvovlpoLov5nph4zlo7DmmI7kuobkuKTkuKrlkIzlkI3lj5jph49pdGVtCiAgLy/lhbbkuK3kuLvlvqrnjq9sb29w6YeM5aOw5piO55qE5piv5bGA6YOo5Y+Y6YeP77yM5ZCM5ZCN5bGA6YOo5Y+Y6YeP5Lya6KaG55uW5YWo5bGA5Y+Y6YePCgogIGl0ZW0gPSA4ODg7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaW50IGl0ZW0gPSA2NjY7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgd2hpbGUodHJ1ZSk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/01_no-return-value-no-parameter_function.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/01_no-return-value-no-parameter_function.mix new file mode 100644 index 00000000..703cd879 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/01_no-return-value-no-parameter_function.mix @@ -0,0 +1 @@ +无返回值无参数函数声明函数使用可以简化程序,对于需要重复执行&#10;的程序一般需要封装为函数delay1000切换状态11HIGH11dm9pZCBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aXoOi/lOWbnuWAvOaXoOWPguaVsOWHveaVsOWjsOaYjgogIC8v5Ye95pWw5L2/55So5Y+v5Lul566A5YyW56iL5bqP77yM5a+55LqO6ZyA6KaB6YeN5aSN5omn6KGMCiAgLy/nmoTnqIvluo/kuIDoiKzpnIDopoHlsIHoo4XkuLrlh73mlbAKICBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/02_no-return-value_function_with_parameters.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/02_no-return-value_function_with_parameters.mix new file mode 100644 index 00000000..43676283 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/02_no-return-value_function_with_parameters.mix @@ -0,0 +1 @@ +时间无返回值带参数函数声明函数使用可以简化程序,对于需要重复执行&#10;的程序一般需要封装为函数500切换状态11HIGH11delay1000时间dm9pZCBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoaW50IF9FNl85N19CNl9FOV85N19CNCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwogIGRlbGF5KF9FNl85N19CNl9FOV85N19CNCk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aXoOi/lOWbnuWAvOW4puWPguaVsOWHveaVsOWjsOaYjgogIC8v5Ye95pWw5L2/55So5Y+v5Lul566A5YyW56iL5bqP77yM5a+55LqO6ZyA6KaB6YeN5aSN5omn6KGMCiAgLy/nmoTnqIvluo/kuIDoiKzpnIDopoHlsIHoo4XkuLrlh73mlbAKICBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoNTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/03_Function_declaration_with_return_value_and_parameters.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/03_Function_declaration_with_return_value_and_parameters.mix new file mode 100644 index 00000000..d1bf345b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/03_Function_declaration_with_return_value_and_parameters.mix @@ -0,0 +1 @@ +数字1数字2带返回值带参数函数声明下面程序判断串口输入的数与100的关系SerialSerialprintln100toInt123Serial数字大小判断Stringlocal_variateitemStringEQ数字1数字2item两数相等GT数字1数字2item数字1大item数字2大itemU3RyaW5nIF9FNl85NV9CMF9FNV9BRF85N19FNV9BNF9BN19FNV9CMF84Rl9FNV84OF9BNF9FNl85Nl9BRChpbnQgX0U2Xzk1X0IwX0U1X0FEXzk3MSwgaW50IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICBTdHJpbmcgaXRlbSA9ICIiOwogIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID09IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICAgIGl0ZW0gPSAi5Lik5pWw55u4562JIjsKCiAgfSBlbHNlIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID4gX0U2Xzk1X0IwX0U1X0FEXzk3MikgewogICAgaXRlbSA9ICLmlbDlrZcx5aSnIjsKICB9IGVsc2UgewogICAgaXRlbSA9ICLmlbDlrZcy5aSnIjsKCiAgfQogIHJldHVybiBpdGVtOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+W4pui/lOWbnuWAvOW4puWPguaVsOWHveaVsOWjsOaYjgogIC8v5LiL6Z2i56iL5bqP5Yik5pat5Liy5Y+j6L6T5YWl55qE5pWw5LiOMTAw55qE5YWz57O7CiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIFNlcmlhbC5wcmludGxuKChfRTZfOTVfQjBfRTVfQURfOTdfRTVfQTRfQTdfRTVfQjBfOEZfRTVfODhfQTRfRTZfOTZfQUQoMTAwLCBTdHJpbmcoU2VyaWFsLnJlYWRTdHJpbmcoKSkudG9JbnQoKSkpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/04_Multiple_return_value_function_declaration_with_parameters.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/04_Multiple_return_value_function_declaration_with_parameters.mix new file mode 100644 index 00000000..76a9631b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/08_Function/04_Multiple_return_value_function_declaration_with_parameters.mix @@ -0,0 +1 @@ +数字1数字2多返回值带参数函数声明下面程序判断串口输入的数与100的关系SerialSerialprintln100toInt123Serial数字大小判断StringEQ数字1数字2两数相等GT数字1数字2数字1大数字2大U3RyaW5nIF9FNl85NV9CMF9FNV9BRF85N19FNV9BNF9BN19FNV9CMF84Rl9FNV84OF9BNF9FNl85Nl9BRChpbnQgX0U2Xzk1X0IwX0U1X0FEXzk3MSwgaW50IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICBpZiAoX0U2Xzk1X0IwX0U1X0FEXzk3MSA9PSBfRTZfOTVfQjBfRTVfQURfOTcyKSB7CiAgICByZXR1cm4gIuS4pOaVsOebuOetiSI7CiAgfQogIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID4gX0U2Xzk1X0IwX0U1X0FEXzk3MikgewogICAgcmV0dXJuICLmlbDlrZcx5aSnIjsKICB9CiAgcmV0dXJuICLmlbDlrZcy5aSnIjsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lpJrov5Tlm57lgLzluKblj4LmlbDlh73mlbDlo7DmmI4KICAvL+S4i+mdoueoi+W6j+WIpOaWreS4suWPo+i+k+WFpeeahOaVsOS4jjEwMOeahOWFs+ezuwogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBTZXJpYWwucHJpbnRsbigoX0U2Xzk1X0IwX0U1X0FEXzk3X0U1X0E0X0E3X0U1X0IwXzhGX0U1Xzg4X0E0X0U2Xzk2X0FEKDEwMCwgU3RyaW5nKFNlcmlhbC5yZWFkU3RyaW5nKCkpLnRvSW50KCkpKSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/01_Serial_printout.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/01_Serial_printout.mix new file mode 100644 index 00000000..62fb30c6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/01_Serial_printout.mix @@ -0,0 +1 @@ +串口通讯需要满足波特率相同原始打印打印数字时输出是是阿斯克码字符,输入字符串时输出原字符串串口打印可以选择换行与否,为了数据可视化一般我们采用换行打印串口可以将10进制数或者其他进制数,转换为对应进制后,以字符串形式打印出来上传下列程序,更改不同波特率观察串口输出随机更改输出为字符串,字符等观察,寻找其规律串口初始化需要一点时间,因此延时一秒打印Serial9600delay1000Serial55SerialprintlnSerialprintln55SerialprintlnHEX055SerialprintlnBIN055SerialprintlnOCT055SerialprintlnDEC055dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBkZWxheSgxMDAwKTsKICBTZXJpYWwud3JpdGUoNTUpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBTZXJpYWwucHJpbnRsbig1NSk7CiAgU2VyaWFsLnByaW50bG4oNTUsSEVYKTsKICBTZXJpYWwucHJpbnRsbig1NSxCSU4pOwogIFNlcmlhbC5wcmludGxuKDU1LE9DVCk7CiAgU2VyaWFsLnByaW50bG4oNTUsREVDKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6PpgJrorq/pnIDopoHmu6HotrPms6Lnibnnjofnm7jlkIwKICAvL+WOn+Wni+aJk+WNsOaJk+WNsOaVsOWtl+aXtui+k+WHuuaYr+aYr+mYv+aWr+WFi+eggeWtl+espu+8jOi+k+WFpeWtl+espuS4suaXtui+k+WHuuWOn+Wtl+espuS4sgogIC8v5Liy5Y+j5omT5Y2w5Y+v5Lul6YCJ5oup5o2i6KGM5LiO5ZCm77yM5Li65LqG5pWw5o2u5Y+v6KeG5YyW5LiA6Iis5oiR5Lus6YeH55So5o2i6KGM5omT5Y2wCiAgLy/kuLLlj6Plj6/ku6XlsIYxMOi/m+WItuaVsOaIluiAheWFtuS7lui/m+WItuaVsO+8jOi9rOaNouS4uuWvueW6lOi/m+WItuWQju+8jOS7peWtl+espuS4suW9ouW8j+aJk+WNsOWHuuadpQogIC8v5LiK5Lyg5LiL5YiX56iL5bqP77yM5pu05pS55LiN5ZCM5rOi54m5546H6KeC5a+f5Liy5Y+j6L6T5Ye6CiAgLy/pmo/mnLrmm7TmlLnovpPlh7rkuLrlrZfnrKbkuLLvvIzlrZfnrKbnrYnop4Llr5/vvIzlr7vmib7lhbbop4TlvosKICAvL+S4suWPo+WIneWni+WMlumcgOimgeS4gOeCueaXtumXtO+8jOWboOatpOW7tuaXtuS4gOenkuaJk+WNsAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_1.mix new file mode 100644 index 00000000..099d0af7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_1.mix @@ -0,0 +1 @@ +串口发送方式改为no上传下列程序,观察串口数据的输入与输出时间差是多少Serial9600Seriallocal_variate时间unsigned longmillisSerialprintlnSerialSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5LiK5Lyg5LiL5YiX56iL5bqP77yM6KeC5a+f5Liy5Y+j5pWw5o2u55qE6L6T5YWl5LiO6L6T5Ye65pe26Ze05beu5piv5aSa5bCRCgogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICB1bnNpZ25lZCBsb25nIF9FNl85N19CNl9FOV85N19CNCA9IG1pbGxpcygpOwogICAgU2VyaWFsLnByaW50bG4oU2VyaWFsLnJlYWRTdHJpbmcoKSk7CiAgICBTZXJpYWwucHJpbnRsbigobWlsbGlzKCkgLSBfRTZfOTdfQjZfRTlfOTdfQjQpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_2.mix new file mode 100644 index 00000000..bdadac30 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_2.mix @@ -0,0 +1 @@ +串口发送方式改为no分别上传一个带a结尾和不带a结尾的字符串,观察时间差异Serial9600Seriallocal_variate时间unsigned longmillisSerialprintlnSerialaSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5YiG5Yir5LiK5Lyg5LiA5Liq5bimYee7k+WwvuWSjOS4jeW4pmHnu5PlsL7nmoTlrZfnrKbkuLLvvIzop4Llr5/ml7bpl7Tlt67lvIIKCiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIHVuc2lnbmVkIGxvbmcgX0U2Xzk3X0I2X0U5Xzk3X0I0ID0gbWlsbGlzKCk7CiAgICBTZXJpYWwucHJpbnRsbihTZXJpYWwucmVhZFN0cmluZ1VudGlsKCdhJykpOwogICAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0KSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_3.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_3.mix new file mode 100644 index 00000000..451821c6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_3.mix @@ -0,0 +1 @@ +串口发送方式改为no串口直接读取的是阿斯克码值,因此需要转为可视字符上传程序寻找与前两次串口读取的差异Serial9600Seriallocal_variate时间unsigned longmillisSerialprintln223SerialreadSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5Liy5Y+j55u05o6l6K+75Y+W55qE5piv6Zi/5pav5YWL56CB5YC877yM5Zug5q2k6ZyA6KaB6L2s5Li65Y+v6KeG5a2X56ymCiAgLy/kuIrkvKDnqIvluo/lr7vmib7kuI7liY3kuKTmrKHkuLLlj6Por7vlj5bnmoTlt67lvIIKCiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIHVuc2lnbmVkIGxvbmcgX0U2Xzk3X0I2X0U5Xzk3X0I0ID0gbWlsbGlzKCk7CiAgICBTZXJpYWwucHJpbnRsbihjaGFyKFNlcmlhbC5yZWFkKCkpKTsKICAgIFNlcmlhbC5wcmludGxuKChtaWxsaXMoKSAtIF9FNl85N19CNl9FOV85N19CNCkpOwoKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_4.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_4.mix new file mode 100644 index 00000000..1bc3895d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/02_Serial_input_4.mix @@ -0,0 +1 @@ +串口发送方式改为no思考此种方式接收串口数据的优点延时2毫秒能删除吗?改一改试试吧Serial9600串口输入Stringlocal_variate串口数据StringWHILETRUESerial串口数据Hello串口数据Mixly223Serialreaddelay2串口数据Seriallocal_variate时间unsigned longmillisSerialprintlnSerialprintlnMINUS1millis1时间U3RyaW5nIF9FNF9COF9CMl9FNV84Rl9BM19FOF9CRV85M19FNV84NV9BNSgpIHsKICBTdHJpbmcgX0U0X0I4X0IyX0U1XzhGX0EzX0U2Xzk1X0IwX0U2XzhEX0FFID0gIiI7CiAgd2hpbGUgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIF9FNF9COF9CMl9FNV84Rl9BM19FNl85NV9CMF9FNl84RF9BRSA9IFN0cmluZyhfRTRfQjhfQjJfRTVfOEZfQTNfRTZfOTVfQjBfRTZfOERfQUUpICsgU3RyaW5nKGNoYXIoU2VyaWFsLnJlYWQoKSkpOwogICAgZGVsYXkoMik7CiAgfQogIHJldHVybiBfRTRfQjhfQjJfRTVfOEZfQTNfRTZfOTVfQjBfRTZfOERfQUU7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Liy5Y+j5Y+R6YCB5pa55byP5pS55Li6bm8KICAvL+aAneiAg+atpOenjeaWueW8j+aOpeaUtuS4suWPo+aVsOaNrueahOS8mOeCuQogIC8v5bu25pe2Muavq+enkuiDveWIoOmZpOWQl++8n+aUueS4gOaUueivleivleWQpwoKICBpZiAoU2VyaWFsLmF2YWlsYWJsZSgpID4gMCkgewogICAgdW5zaWduZWQgbG9uZyBfRTZfOTdfQjZfRTlfOTdfQjQgPSBtaWxsaXMoKTsKICAgIFNlcmlhbC5wcmludGxuKChfRTRfQjhfQjJfRTVfOEZfQTNfRThfQkVfOTNfRTVfODVfQTUoKSkpOwogICAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0KSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/03_Serial_port_send_wait.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/03_Serial_port_send_wait.mix new file mode 100644 index 00000000..44976760 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/03_Serial_port_send_wait.mix @@ -0,0 +1 @@ +Serial.flush()函数不具备清空缓存区的作用,其主要作用是串口发送数据时等待,&#10;直到串口数据发送完例如下面程序都发送了同一个字符串,各自打印的时间不一致可说明若要清空缓存区请重复读取串口,直到串口数据为空Serial9600local_variate时间1unsigned longmillisSerialprintlnhelloSerialprintlnMINUS1millis1时间1local_variate时间2unsigned longmillisSerialprintlnhelloSerialSerialprintlnMINUS1millis1时间2dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICB1bnNpZ25lZCBsb25nIF9FNl85N19CNl9FOV85N19CNDEgPSBtaWxsaXMoKTsKICBTZXJpYWwucHJpbnRsbigiaGVsbG8iKTsKICBTZXJpYWwucHJpbnRsbigobWlsbGlzKCkgLSBfRTZfOTdfQjZfRTlfOTdfQjQxKSk7CiAgdW5zaWduZWQgbG9uZyBfRTZfOTdfQjZfRTlfOTdfQjQyID0gbWlsbGlzKCk7CiAgU2VyaWFsLnByaW50bG4oImhlbGxvIik7CiAgU2VyaWFsLmZsdXNoKCk7CiAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0MikpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL1NlcmlhbC5mbHVzaCgp5Ye95pWw5LiN5YW35aSH5riF56m657yT5a2Y5Yy655qE5L2c55So77yM5YW25Li76KaB5L2c55So5piv5Liy5Y+j5Y+R6YCB5pWw5o2u5pe2562J5b6F77yMCiAgLy/nm7TliLDkuLLlj6PmlbDmja7lj5HpgIHlrowKICAvL+S+i+WmguS4i+mdoueoi+W6j+mDveWPkemAgeS6huWQjOS4gOS4quWtl+espuS4su+8jOWQhOiHquaJk+WNsOeahOaXtumXtOS4jeS4gOiHtOWPr+ivtOaYjgogIC8v6Iul6KaB5riF56m657yT5a2Y5Yy66K+36YeN5aSN6K+75Y+W5Liy5Y+j77yM55u05Yiw5Liy5Y+j5pWw5o2u5Li656m6Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/04_Serial_Interrupt.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/04_Serial_Interrupt.mix new file mode 100644 index 00000000..fc8b32de --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/04_Serial_Interrupt.mix @@ -0,0 +1 @@ +此处的串口中断并非是真正的串口中断,上传下面程序查看结果可知串口中断会在loop函数执行完运行一次 ,会受到其他函数的影响,一般不使用此功能Serial9600SerialSerialprintlnSerialdelay5000dm9pZCBzZXJpYWxFdmVudCgpIHsKICBTZXJpYWwucHJpbnRsbihTZXJpYWwucmVhZFN0cmluZygpKTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/mraTlpITnmoTkuLLlj6PkuK3mlq3lubbpnZ7mmK/nnJ/mraPnmoTkuLLlj6PkuK3mlq3vvIzkuIrkvKDkuIvpnaLnqIvluo/mn6XnnIvnu5Pmnpzlj6/nn6UKICAvL+S4suWPo+S4reaWreS8muWcqGxvb3Dlh73mlbDmiafooYzlrozov5DooYzkuIDmrKEg77yM5Lya5Y+X5Yiw5YW25LuW5Ye95pWw55qE5b2x5ZON77yM5LiA6Iis5LiN5L2/55So5q2k5Yqf6IO9CgogIGRlbGF5KDUwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/05_Use_of_soft_serial_port.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/05_Use_of_soft_serial_port.mix new file mode 100644 index 00000000..2803f01b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/09_Serial_port/05_Use_of_soft_serial_port.mix @@ -0,0 +1 @@ +硬件串口在程序上传时会被占用,若外接其他模块可能会导致无法 上传程序&#10;因此一般不做额外用途,仅用来调试程序,当我们要使用其他串口类模块时,&#10;一般使用软串口,软串口能将任意数字输出引脚当做串口来使用,例如下列程序&#10;定义了2和3为软串口,,软串口每隔一秒发送一个数据,硬件串口收到数据时打印&#10;该数据,同时11号管脚LED切换状态。串口通讯波特率必须一致,软串口能使用的波特率一般不超过115200,超过可能导致&#10;异常,用一根双公头杜邦线接入3与RX(0)引脚,观察现象用另一块板子上传相同程序,分别把己方的3号管脚接入对方的RX,观察现象&#10;注意把两块板子的GND连接到一起说说软串口与硬件串口的区别mySerial23mySerial9600SerialSerialprintlnSeriala11HIGH1111000mySerialprint1aCiNpbmNsdWRlIDxTb2Z0d2FyZVNlcmlhbC5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KClNvZnR3YXJlU2VyaWFsIG15U2VyaWFsKDIsMyk7ClNpbXBsZVRpbWVyIHRpbWVyOwoKdm9pZCBTaW1wbGVfdGltZXJfMSgpIHsKICBteVNlcmlhbC5wcmludCgiMWEiKTsKfQoKdm9pZCBzZXR1cCgpewogIG15U2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwogIHRpbWVyLnNldEludGVydmFsKDEwMDBMLCBTaW1wbGVfdGltZXJfMSk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL+ehrOS7tuS4suWPo+WcqOeoi+W6j+S4iuS8oOaXtuS8muiiq+WNoOeUqO+8jOiLpeWkluaOpeWFtuS7luaooeWdl+WPr+iDveS8muWvvOiHtOaXoOazlSDkuIrkvKDnqIvluo8KICAvL+WboOatpOS4gOiIrOS4jeWBmumineWklueUqOmAlO+8jOS7heeUqOadpeiwg+ivleeoi+W6j++8jOW9k+aIkeS7rOimgeS9v+eUqOWFtuS7luS4suWPo+exu+aooeWdl+aXtu+8jAogIC8v5LiA6Iis5L2/55So6L2v5Liy5Y+j77yM6L2v5Liy5Y+j6IO95bCG5Lu75oSP5pWw5a2X6L6T5Ye65byV6ISa5b2T5YGa5Liy5Y+j5p2l5L2/55So77yM5L6L5aaC5LiL5YiX56iL5bqPCiAgLy/lrprkuYnkuoYy5ZKMM+S4uui9r+S4suWPo++8jO+8jOi9r+S4suWPo+avj+malOS4gOenkuWPkemAgeS4gOS4quaVsOaNru+8jOehrOS7tuS4suWPo+aUtuWIsOaVsOaNruaXtuaJk+WNsAogIC8v6K+l5pWw5o2u77yM5ZCM5pe2MTHlj7fnrqHohJpMRUTliIfmjaLnirbmgIHjgIIKICAvL+S4suWPo+mAmuiur+azoueJueeOh+W/hemhu+S4gOiHtO+8jOi9r+S4suWPo+iDveS9v+eUqOeahOazoueJueeOh+S4gOiIrOS4jei2hei/hzExNTIwMO+8jOi2hei/h+WPr+iDveWvvOiHtAogIC8v5byC5bi477yM55So5LiA5qC55Y+M5YWs5aS05p2c6YKm57q/5o6l5YWlM+S4jlJY77yIMO+8ieW8leiEmu+8jOinguWvn+eOsOixoQogIC8v55So5Y+m5LiA5Z2X5p2/5a2Q5LiK5Lyg55u45ZCM56iL5bqP77yM5YiG5Yir5oqK5bex5pa555qEM+WPt+euoeiEmuaOpeWFpeWvueaWueeahFJY77yM6KeC5a+f546w6LGhCiAgLy/ms6jmhI/miorkuKTlnZfmnb/lrZDnmoRHTkTov57mjqXliLDkuIDotbcKICAvL+ivtOivtOi9r+S4suWPo+S4juehrOS7tuS4suWPo+eahOWMuuWIqwoKICBpZiAoU2VyaWFsLmF2YWlsYWJsZSgpID4gMCkgewogICAgU2VyaWFsLnByaW50bG4oU2VyaWFsLnJlYWRTdHJpbmdVbnRpbCgnYScpKTsKICAgIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwoKICB9CgogIHRpbWVyLnJ1bigpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/01_Ultrasonic_distance_measurement.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/01_Ultrasonic_distance_measurement.mix new file mode 100644 index 00000000..6bf10386 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/01_Ultrasonic_distance_measurement.mix @@ -0,0 +1 @@ +超声波测距注意超声波模块的使用电平,某些型号有逻辑电平&#10;要求,如3.3V,5V等,按要求使用Serialprintln23delay100ZmxvYXQgY2hlY2tkaXN0YW5jZV8yXzMoKSB7CiAgZGlnaXRhbFdyaXRlKDIsIExPVyk7CiAgZGVsYXlNaWNyb3NlY29uZHMoMik7CiAgZGlnaXRhbFdyaXRlKDIsIEhJR0gpOwogIGRlbGF5TWljcm9zZWNvbmRzKDEwKTsKICBkaWdpdGFsV3JpdGUoMiwgTE9XKTsKICBmbG9hdCBkaXN0YW5jZSA9IHB1bHNlSW4oMywgSElHSCkgLyA1OC4wMDsKICBkZWxheSgxMCk7CiAgcmV0dXJuIGRpc3RhbmNlOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgyLCBPVVRQVVQpOwogIHBpbk1vZGUoMywgSU5QVVQpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/otoXlo7Dms6LmtYvot50KICAvL+azqOaEj+i2heWjsOazouaooeWdl+eahOS9v+eUqOeUteW5s++8jOafkOS6m+Wei+WPt+aciemAu+i+keeUteW5swogIC8v6KaB5rGC77yM5aaCMy4zVu+8jDVW562J77yM5oyJ6KaB5rGC5L2/55SoCiAgU2VyaWFsLnByaW50bG4oY2hlY2tkaXN0YW5jZV8yXzMoKSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/02_Get_DHT11_temperature_and_humidity.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/02_Get_DHT11_temperature_and_humidity.mix new file mode 100644 index 00000000..0c0beea7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/02_Get_DHT11_temperature_and_humidity.mix @@ -0,0 +1 @@ +获取温湿度Serialprintln112temperatureSerialprintln112humiditySerialprintlndelay100CiNpbmNsdWRlIDxESFQuaD4KCkRIVCBkaHQyKDIsIDExKTsKCnZvaWQgc2V0dXAoKXsKICAgZGh0Mi5iZWdpbigpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5bmuKnmub/luqYKICBTZXJpYWwucHJpbnRsbihkaHQyLnJlYWRUZW1wZXJhdHVyZSgpKTsKICBTZXJpYWwucHJpbnRsbihkaHQyLnJlYWRIdW1pZGl0eSgpKTsKICBTZXJpYWwucHJpbnRsbigiIik7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/03_get_LM35_temperature.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/03_get_LM35_temperature.mix new file mode 100644 index 00000000..8a3f0d88 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/03_get_LM35_temperature.mix @@ -0,0 +1 @@ +获取LM35温度SerialprintlnA0delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5ZMTTM15rip5bqmCiAgU2VyaWFsLnByaW50bG4oYW5hbG9nUmVhZChBMCkqMC40ODgpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/04_Get_DS18B20_temperature.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/04_Get_DS18B20_temperature.mix new file mode 100644 index 00000000..335625c0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/04_Get_DS18B20_temperature.mix @@ -0,0 +1 @@ +获取DS18B20温度Serialprintln20delay100CiNpbmNsdWRlIDxPbmVXaXJlLmg+CiNpbmNsdWRlIDxEYWxsYXNUZW1wZXJhdHVyZS5oPgoKT25lV2lyZSBvbmVXaXJlXzIoMik7CkRhbGxhc1RlbXBlcmF0dXJlIHNlbnNvcnNfMigmb25lV2lyZV8yKTsKRGV2aWNlQWRkcmVzcyBpbnNpZGVUaGVybW9tZXRlcjsKCmZsb2F0IGRzMThiMjBfMl9nZXRUZW1wKGludCB3KSB7CiAgc2Vuc29yc18yLnJlcXVlc3RUZW1wZXJhdHVyZXMoKTsKICBpZih3PT0wKSB7CiAgICByZXR1cm4gc2Vuc29yc18yLmdldFRlbXBDKGluc2lkZVRoZXJtb21ldGVyKTsKICB9CiAgZWxzZSB7CiAgICByZXR1cm4gc2Vuc29yc18yLmdldFRlbXBGKGluc2lkZVRoZXJtb21ldGVyKTsKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBzZW5zb3JzXzIuZ2V0QWRkcmVzcyhpbnNpZGVUaGVybW9tZXRlciwgMCk7CiAgc2Vuc29yc18yLnNldFJlc29sdXRpb24oaW5zaWRlVGhlcm1vbWV0ZXIsIDkpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5ZEUzE4QjIw5rip5bqmCiAgU2VyaWFsLnByaW50bG4oZHMxOGIyMF8yX2dldFRlbXAoMCkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/05_Get_BME280_parameters.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/05_Get_BME280_parameters.mix new file mode 100644 index 00000000..73bd5cac --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/05_Get_BME280_parameters.mix @@ -0,0 +1 @@ +获取BME280参数使用默认iic接口,工具分类查看开发板IO图查看对应接口SerialprintlnbmereadTemperature()0x77SerialprintlnbmereadHumidity()0x77SerialprintlnbmereadPressure()0x77SerialprintlnbmereadAltitude(SEALEVELPRESSURE_HPA)0x77Serialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxTUEkuaD4KI2luY2x1ZGUgPEFkYWZydWl0X1NlbnNvci5oPgojaW5jbHVkZSA8QWRhZnJ1aXRfQk1FMjgwLmg+CiNkZWZpbmUgU0VBTEVWRUxQUkVTU1VSRV9IUEEgKDEwMTMuMjUpCgpBZGFmcnVpdF9CTUUyODAgYm1lOwoKdm9pZCBzZXR1cCgpewogIHVuc2lnbmVkIHN0YXR1czsKICBzdGF0dXMgPSBibWUuYmVnaW4oMHg3Nyk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPlkJNRTI4MOWPguaVsAogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBTZXJpYWwucHJpbnRsbihibWUucmVhZFRlbXBlcmF0dXJlKCkpOwogIFNlcmlhbC5wcmludGxuKGJtZS5yZWFkSHVtaWRpdHkoKSk7CiAgU2VyaWFsLnByaW50bG4oYm1lLnJlYWRQcmVzc3VyZSgpKTsKICBTZXJpYWwucHJpbnRsbihibWUucmVhZEFsdGl0dWRlKFNFQUxFVkVMUFJFU1NVUkVfSFBBKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/06_get_SHT20_temperature_and_humidity.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/06_get_SHT20_temperature_and_humidity.mix new file mode 100644 index 00000000..0736fbe3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/06_get_SHT20_temperature_and_humidity.mix @@ -0,0 +1 @@ +获取SHT20温湿度使用默认iic接口,工具分类查看开发板IO图查看对应接口Serialprintlnsht20.readTemperature()Serialprintlnsht20.readHumidity()Serialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxERlJvYm90X1NIVDIwLmg+CgpERlJvYm90X1NIVDIwIHNodDIwOwoKdm9pZCBzZXR1cCgpewogIHNodDIwLmluaXRTSFQyMCgpOwogIHNodDIwLmNoZWNrU0hUMjAoKTsKCiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPllNIVDIw5rip5rm/5bqmCiAgLy/kvb/nlKjpu5jorqRpaWPmjqXlj6PvvIzlt6XlhbfliIbnsbvmn6XnnIvlvIDlj5Hmnb9JT+Wbvuafpeeci+WvueW6lOaOpeWPowogIFNlcmlhbC5wcmludGxuKHNodDIwLnJlYWRUZW1wZXJhdHVyZSgpKTsKICBTZXJpYWwucHJpbnRsbihzaHQyMC5yZWFkSHVtaWRpdHkoKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/07_BMLX90614_Infrared_temperature_measurement.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/07_BMLX90614_Infrared_temperature_measurement.mix new file mode 100644 index 00000000..c8cdcf3d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/07_BMLX90614_Infrared_temperature_measurement.mix @@ -0,0 +1 @@ +BMLX90614红外温度测量使用默认iic接口,工具分类查看开发板IO图查看对应接口0x5ASerialprintlnreadObjectTempCdelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxBZGFmcnVpdF9NTFg5MDYxNC5oPgoKQWRhZnJ1aXRfTUxYOTA2MTQgTUxYID0gQWRhZnJ1aXRfTUxYOTA2MTQoMHg1QSk7Cgp2b2lkIHNldHVwKCl7CiAgTUxYLmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL0JNTFg5MDYxNOe6ouWklua4qeW6pua1i+mHjwogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBTZXJpYWwucHJpbnRsbihNTFgucmVhZE9iamVjdFRlbXBDKCkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/08_tcs34725_color_extraction.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/08_tcs34725_color_extraction.mix new file mode 100644 index 00000000..7734e6be --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/08_tcs34725_color_extraction.mix @@ -0,0 +1 @@ +tcs34725颜色提取使用默认iic接口,工具分类查看开发板IO图查看对应接口Serialprintlntcs34725.getRedToGamma()Serialprintlntcs34725.getGreenToGamma()Serialprintlntcs34725.getBlueToGamma()Serialprintlndelay100CiNpbmNsdWRlIDxERlJvYm90X1RDUzM0NzI1Lmg+CgpERlJvYm90X1RDUzM0NzI1IHRjczM0NzI1OwoKdm9pZCBzZXR1cCgpewogIHRjczM0NzI1LmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3RjczM0NzI16aKc6Imy5o+Q5Y+WCiAgLy/kvb/nlKjpu5jorqRpaWPmjqXlj6PvvIzlt6XlhbfliIbnsbvmn6XnnIvlvIDlj5Hmnb9JT+Wbvuafpeeci+WvueW6lOaOpeWPowogIFNlcmlhbC5wcmludGxuKHRjczM0NzI1LmdldFJlZFRvR2FtbWEoKSk7CiAgU2VyaWFsLnByaW50bG4odGNzMzQ3MjUuZ2V0R3JlZW5Ub0dhbW1hKCkpOwogIFNlcmlhbC5wcmludGxuKHRjczM0NzI1LmdldEJsdWVUb0dhbW1hKCkpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/09_tcs230_color_extraction.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/09_tcs230_color_extraction.mix new file mode 100644 index 00000000..915b8ce0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/09_tcs230_color_extraction.mix @@ -0,0 +1 @@ +tcs230颜色提取234567SerialprintlnRSerialprintlnGSerialprintlnBSerialprintlndelay100I2RlZmluZSB0Y3MyMzBfUzAgMgojZGVmaW5lIHRjczIzMF9TMSAzCiNkZWZpbmUgdGNzMjMwX1MyIDQKI2RlZmluZSB0Y3MyMzBfUzMgNQojZGVmaW5lIHRjczIzMF9zZW5zb3JPdXQgNwojZGVmaW5lIHRjczIzMF9MRUQgNgoKLy9UQ1MyMzDpopzoibLkvKDmhJ/lmajojrflj5ZSR0LlgLwKaW50IHRjczIzMF9HZXRjb2xvcihjaGFyIGRhdGEpCnsKICBpbnQgZnJlcXVlbmN5ID0gMDsKICBzd2l0Y2goZGF0YSkKICB7CiAgICBjYXNlICdSJzoKICAgIHsKICAgICAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMixMT1cpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IHB1bHNlSW4odGNzMjMwX3NlbnNvck91dCwgTE9XKTsKICAgICAgZnJlcXVlbmN5ID0gbWFwKGZyZXF1ZW5jeSwgMjUsIDcyLCAyNTUsIDApOwogICAgICBicmVhazsKICAgIH0KICAgIGNhc2UgJ0cnOgogICAgewogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MyLEhJR0gpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLEhJR0gpOwogICAgICBmcmVxdWVuY3kgPSBwdWxzZUluKHRjczIzMF9zZW5zb3JPdXQsIExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IG1hcChmcmVxdWVuY3ksIDMwLCA5MCwgMjU1LCAwKTsKICAgICAgYnJlYWs7CiAgICB9CiAgICBjYXNlICdCJzoKICAgIHsKICAgICAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMixMT1cpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLEhJR0gpOwogICAgICBmcmVxdWVuY3kgPSBwdWxzZUluKHRjczIzMF9zZW5zb3JPdXQsIExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IG1hcChmcmVxdWVuY3ksIDI1LCA3MCwgMjU1LCAwKTsKICAgICAgYnJlYWs7CiAgICB9CiAgICBkZWZhdWx0OgogICAgICByZXR1cm4gLTE7CiAgfQogIGlmIChmcmVxdWVuY3kgPCAwKQogICAgZnJlcXVlbmN5ID0gMDsKICBpZiAoZnJlcXVlbmN5ID4gMjU1KQogICAgZnJlcXVlbmN5ID0gMjU1OwogIHJldHVybiBmcmVxdWVuY3k7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKHRjczIzMF9TMCwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMSwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMiwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMywgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9MRUQsIE9VVFBVVCk7CiAgcGluTW9kZSh0Y3MyMzBfc2Vuc29yT3V0LCBJTlBVVCk7CiAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMCxISUdIKTsKICBkaWdpdGFsV3JpdGUodGNzMjMwX1MxLExPVyk7CiAgZGlnaXRhbFdyaXRlKHRjczIzMF9MRUQsSElHSCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3RjczIzMOminOiJsuaPkOWPlgogIFNlcmlhbC5wcmludGxuKHRjczIzMF9HZXRjb2xvcignUicpKTsKICBTZXJpYWwucHJpbnRsbih0Y3MyMzBfR2V0Y29sb3IoJ0cnKSk7CiAgU2VyaWFsLnByaW50bG4odGNzMjMwX0dldGNvbG9yKCdCJykpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/10_MPU6050_Gyroscope.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/10_MPU6050_Gyroscope.mix new file mode 100644 index 00000000..1a3313a5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/10_MPU6050_Gyroscope.mix @@ -0,0 +1 @@ +MPU6050陀螺仪使用默认iic接口,工具分类查看开发板IO图查看对应接口1100SerialprintlngetAccX()SerialprintlngetAccY()SerialprintlngetAccZ()SerialprintlngetAngleX()SerialprintlngetAngleY()SerialprintlngetAngleZ()SerialprintlngetTemp()SerialprintlnCiNpbmNsdWRlIDxNUFU2MDUwX3RvY2tuLmg+CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKTVBVNjA1MCBtcHU2MDUwKFdpcmUpOwpTaW1wbGVUaW1lciB0aW1lcjsKCnZvaWQgU2ltcGxlX3RpbWVyXzEoKSB7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBY2NYKCkpOwogIFNlcmlhbC5wcmludGxuKG1wdTYwNTAuZ2V0QWNjWSgpKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldEFjY1ooKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVgoKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVkoKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVooKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRUZW1wKCkpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKfQoKdm9pZCBzZXR1cCgpewogIFdpcmUuYmVnaW4oKTsKICBtcHU2MDUwLmJlZ2luKCk7CiAgbXB1NjA1MC5jYWxjR3lyb09mZnNldHModHJ1ZSk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIHRpbWVyLnNldEludGVydmFsKDEwMEwsIFNpbXBsZV90aW1lcl8xKTsKCn0KCnZvaWQgbG9vcCgpewogIC8vTVBVNjA1MOmZgOieuuS7qgogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBtcHU2MDUwLnVwZGF0ZSgpOwoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/11_MPU9250_acceleration_sensor.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/11_MPU9250_acceleration_sensor.mix new file mode 100644 index 00000000..2d39d842 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/10_Sensors/11_MPU9250_acceleration_sensor.mix @@ -0,0 +1 @@ +MPU9250加速度传感器使用默认iic接口,工具分类查看开发板IO图查看对应接口SerialprintlnaSerialprintlnbSerialprintlncSerialprintlndSerialprintlneSerialprintlnfSerialprintlngSerialprintlnhSerialprintlniSerialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxGYUJvOUF4aXNfTVBVOTI1MC5oPgoKRmFCbzlBeGlzIGZhYm9fOWF4aXM7CiBmbG9hdCBheCxheSxheixneCxneSxneixteCxteSxtejsKCnZvaWQgc2V0dXAoKXsKICBmYWJvXzlheGlzLmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL01QVTkyNTDliqDpgJ/luqbkvKDmhJ/lmagKICAvL+S9v+eUqOm7mOiupGlpY+aOpeWPo++8jOW3peWFt+WIhuexu+afpeeci+W8gOWPkeadv0lP5Zu+5p+l55yL5a+55bqU5o6l5Y+jCiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkQWNjZWxYKCkpOwogIFNlcmlhbC5wcmludGxuKGZhYm9fOWF4aXMucmVhZEFjY2VsWSgpKTsKICBTZXJpYWwucHJpbnRsbihmYWJvXzlheGlzLnJlYWRBY2NlbFooKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1goKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1koKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1ooKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkTWFnbmV0WCgpKTsKICBTZXJpYWwucHJpbnRsbihmYWJvXzlheGlzLnJlYWRNYWduZXRZKCkpOwogIFNlcmlhbC5wcmludGxuKGZhYm9fOWF4aXMucmVhZE1hZ25ldFooKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/01_Infrared_data_reception.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/01_Infrared_data_reception.mix new file mode 100644 index 00000000..ad63e666 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/01_Infrared_data_reception.mix @@ -0,0 +1 @@ +红外接收,接收的数据为16进制数字,可以通过串口打印获取其编码与数据&#10;通过对比接收到的数据是否等于某一数值执行某一程序,例如下方通过接收特定&#10;数字切换LED状态ir_item9SerialprintlnHEXir_itemEQir_item0xFFA25D11HIGH11CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKbG9uZyBpcl9pdGVtOwpJUnJlY3YgaXJyZWN2XzkoOSk7CmRlY29kZV9yZXN1bHRzIHJlc3VsdHNfOTsKCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBpcnJlY3ZfOS5lbmFibGVJUkluKCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v57qi5aSW5o6l5pS277yM5o6l5pS255qE5pWw5o2u5Li6MTbov5vliLbmlbDlrZfvvIzlj6/ku6XpgJrov4fkuLLlj6PmiZPljbDojrflj5blhbbnvJbnoIHkuI7mlbDmja4KICAvL+mAmui/h+WvueavlOaOpeaUtuWIsOeahOaVsOaNruaYr+WQpuetieS6juafkOS4gOaVsOWAvOaJp+ihjOafkOS4gOeoi+W6j++8jOS+i+WmguS4i+aWuemAmui/h+aOpeaUtueJueWumgogIC8v5pWw5a2X5YiH5o2iTEVE54q25oCBCiAgaWYgKGlycmVjdl85LmRlY29kZSgmcmVzdWx0c185KSkgewogICAgaXJfaXRlbT1yZXN1bHRzXzkudmFsdWU7CiAgICBTdHJpbmcgdHlwZT0iVU5LTk9XTiI7CiAgICBTdHJpbmcgdHlwZWxpc3RbMThdPXsiVU5VU0VEIiwgIlJDNSIsICJSQzYiLCAiTkVDIiwgIlNPTlkiLCAiUEFOQVNPTklDIiwgIkpWQyIsICJTQU1TVU5HIiwgIldIWU5URVIiLCAiQUlXQV9SQ19UNTAxIiwgIkxHIiwgIlNBTllPIiwgIk1JVFNVQklTSEkiLCAiRElTSCIsICJTSEFSUCIsICJERU5PTiIsICJQUk9OVE8iLCAiTEVHT19QRiJ9OwogICAgaWYocmVzdWx0c185LmRlY29kZV90eXBlPj0xJiZyZXN1bHRzXzkuZGVjb2RlX3R5cGU8PTE3KXsKICAgICAgdHlwZT10eXBlbGlzdFtyZXN1bHRzXzkuZGVjb2RlX3R5cGVdOwogICAgfQogICAgU2VyaWFsLnByaW50bG4oIklSIFRZUEU6Iit0eXBlKyIgICIpOwogICAgU2VyaWFsLnByaW50bG4oaXJfaXRlbSxIRVgpOwogICAgaWYgKGlyX2l0ZW0gPT0gMHhGRkEyNUQpIHsKICAgICAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CgogICAgfQogICAgaXJyZWN2XzkucmVzdW1lKCk7CiAgfSBlbHNlIHsKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/02_Infrared_data_transmission.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/02_Infrared_data_transmission.mix new file mode 100644 index 00000000..7688a61f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/02_Infrared_data_transmission.mix @@ -0,0 +1 @@ +红外数据发送,,对已知编码与数据的红外信号进行 发送,例如将&#10;上一例红外接收,编写如下程序可让一块板子控制另一块板子比特数一般默认ir_item9SerialprintlnHEXir_itemEQir_item0xFFA25D11HIGH1111000NEC30xFFA25D32CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpJUnNlbmQgaXJzZW5kOwoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlyc2VuZC5zZW5kTkVDKDB4RkZBMjVELDMyKTsKfQoKdm9pZCBzZXR1cCgpewogIHRpbWVyLnNldEludGVydmFsKDEwMDBMLCBTaW1wbGVfdGltZXJfMSk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL+e6ouWkluaVsOaNruWPkemAge+8jO+8jOWvueW3suefpee8lueggeS4juaVsOaNrueahOe6ouWkluS/oeWPt+i/m+ihjCDlj5HpgIHvvIzkvovlpoLlsIYKICAvL+S4iuS4gOS+i+e6ouWkluaOpeaUtu+8jOe8luWGmeWmguS4i+eoi+W6j+WPr+iuqeS4gOWdl+adv+WtkOaOp+WItuWPpuS4gOWdl+adv+WtkAogIC8v5q+U54m55pWw5LiA6Iis6buY6K6kCgogIHRpbWVyLnJ1bigpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/03_Infrared_data_simulation_transceiver.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/03_Infrared_data_simulation_transceiver.mix new file mode 100644 index 00000000..a342c1d2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/13_Communication/03_Infrared_data_simulation_transceiver.mix @@ -0,0 +1 @@ +红外解码与发送案例2&#10;一些特殊设备如空调电视等,我们可以先获取编码,仅上传一次按下&#10;普通红外按键,串口打印其接收的数组,记录下该数组长度与数据,即可通过&#10;红外数据发送器模拟红外信号控制其他设备比特数一般默认上传一次后禁用91获取编码后启用10003904,9350,4450,700,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,1600,650,1600,650,1600,700,1550,700,1550,700,1550,700,1600,650,1600,650,1600,650,550,600,1650,600,550,600,550,600,550,600,1650,600,550,600,550,600,1650,650,500,650,1600,650,1650,600,1650,600,550,600,1650,6006838CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpJUnNlbmQgaXJzZW5kOwoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIHVuc2lnbmVkIGludCBidWZfcmF3WzY4XT17OTA0LDkzNTAsNDQ1MCw3MDAsNTAwLDY1MCw1MDAsNjUwLDUwMCw2NTAsNTAwLDY1MCw1MDAsNjUwLDUwMCw2NTAsNTAwLDY1MCw1MDAsNjUwLDE2MDAsNjUwLDE2MDAsNjUwLDE2MDAsNzAwLDE1NTAsNzAwLDE1NTAsNzAwLDE1NTAsNzAwLDE2MDAsNjUwLDE2MDAsNjUwLDE2MDAsNjUwLDU1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCw1NTAsNjAwLDU1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCw1NTAsNjAwLDE2NTAsNjUwLDUwMCw2NTAsMTYwMCw2NTAsMTY1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCwxNjUwLDYwMH07CiAgaXJzZW5kLnNlbmRSYXcoYnVmX3Jhdyw2OCwzOCk7Cn0KCnZvaWQgc2V0dXAoKXsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgLy/nuqLlpJbop6PnoIHkuI7lj5HpgIHmoYjkvosyCiAgLy/kuIDkupvnibnmrororr7lpIflpoLnqbrosIPnlLXop4bnrYnvvIzmiJHku6zlj6/ku6XlhYjojrflj5bnvJbnoIHvvIzku4XkuIrkvKDkuIDmrKHmjInkuIsKICAvL+aZrumAmue6ouWkluaMiemUru+8jOS4suWPo+aJk+WNsOWFtuaOpeaUtueahOaVsOe7hO+8jOiusOW9leS4i+ivpeaVsOe7hOmVv+W6puS4juaVsOaNru+8jOWNs+WPr+mAmui/hwogIC8v57qi5aSW5pWw5o2u5Y+R6YCB5Zmo5qih5ouf57qi5aSW5L+h5Y+35o6n5Yi25YW25LuW6K6+5aSHCiAgLy/mr5TnibnmlbDkuIDoiKzpu5jorqQKCiAgLy8g6I635Y+W57yW56CB5ZCO5ZCv55SoCiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/01_SD_card_read_test.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/01_SD_card_read_test.mix new file mode 100644 index 00000000..d274d083 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/01_SD_card_read_test.mix @@ -0,0 +1 @@ +打印SD卡参数与读写测试SD卡拥有超大的存储容量,一般用来保存检测传感器数据与系统参数&#10;如温湿度数据等,通常保存的数据要加上时间戳1112134SerialprintlnSerialprintlnvolume.blocksPerCluster()*volume.clusterCount()/2/1024/1024.0fileName.txtSerialprintlnfileName.txtfileName.txthello worldTRUEfileName.txtCiNpbmNsdWRlIDxTRC5oPgojaW5jbHVkZSA8U1BJLmg+CgpTZDJDYXJkIGNhcmQ7ClNkVm9sdW1lIHZvbHVtZTsKU2RGaWxlIHJvb3Q7CkZpbGUgZGF0YWZpbGU7ClN0cmluZyBTRF9jYXJkX3JlYWRpbmcoU3RyaW5nIHBhdGgpIHsKZGF0YWZpbGUgPSBTRC5vcGVuKHBhdGgpOwogU3RyaW5nIHNkX2RhdGEgPSAiIjsKIHdoaWxlIChkYXRhZmlsZS5hdmFpbGFibGUoKSkgewogIHNkX2RhdGEgPSBTdHJpbmcoc2RfZGF0YSkgKyBTdHJpbmcoY2hhcihkYXRhZmlsZS5yZWFkKCkpKTsKIH0KICByZXR1cm4gc2RfZGF0YTsKfQoKdm9pZCBzZXR1cCgpewogIFNELmJlZ2luKDQpOwogIGNhcmQuaW5pdChTUElfSEFMRl9TUEVFRCwgNCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIHZvbHVtZS5pbml0KGNhcmQpOwogIFNlcmlhbC5wcmludGxuKGNhcmQudHlwZSgpKTsKICBTZXJpYWwucHJpbnRsbih2b2x1bWUuYmxvY2tzUGVyQ2x1c3RlcigpKnZvbHVtZS5jbHVzdGVyQ291bnQoKS8yLzEwMjQvMTAyNC4wKTsKICByb290Lm9wZW5Sb290KHZvbHVtZSk7CiAgcm9vdC5scyhMU19SIHwgTFNfREFURSB8IExTX1NJWkUpO2lmIChTRC5leGlzdHMoImZpbGVOYW1lLnR4dCIpKSB7CiAgICBTZXJpYWwucHJpbnRsbihTRF9jYXJkX3JlYWRpbmcoImZpbGVOYW1lLnR4dCIpKTsKCiAgfQogIGRhdGFmaWxlID0gU0Qub3BlbigiZmlsZU5hbWUudHh0IiwgRklMRV9XUklURSk7CiAgaWYoZGF0YWZpbGUpewogIAlkYXRhZmlsZS5wcmludCgiaGVsbG8gd29ybGQiKTsKICAJZGF0YWZpbGUucHJpbnRsbigiIik7CiAgCWRhdGFmaWxlLmNsb3NlKCk7CiAgfQp9Cgp2b2lkIGxvb3AoKXsKICAvL+aJk+WNsFNE5Y2h5Y+C5pWw5LiO6K+75YaZ5rWL6K+VCiAgLy9TROWNoeaLpeaciei2heWkp+eahOWtmOWCqOWuuemHj++8jOS4gOiIrOeUqOadpeS/neWtmOajgOa1i+S8oOaEn+WZqOaVsOaNruS4juezu+e7n+WPguaVsAogIC8v5aaC5rip5rm/5bqm5pWw5o2u562J77yM6YCa5bi45L+d5a2Y55qE5pWw5o2u6KaB5Yqg5LiK5pe26Ze05oizCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/02_EEPROM_power_down_storage.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/02_EEPROM_power_down_storage.mix new file mode 100644 index 00000000..8e5e0531 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0_simple_tutorial/14_Storage/02_EEPROM_power_down_storage.mix @@ -0,0 +1 @@ +EEPROM记录LED状态,初始化恢复断电前的状态EEPROM有写入次数寿命,不适合频繁的写入数据不同开发板EEPROM存储空间有所不同,UNO与Nano&#10;的EEPROM为1KB(地址0-1023),Mega为4KB不同数据类型存储占用的字节空间不同,使用多个时并不能&#10;简单的把地址理解为变量存储区需结合数据类型做判断global_variateledbooleanTRUE0ledled11HIGH11LOWattachClick12HIGH11HIGH1111ledTRUEledFALSE00ledCiNpbmNsdWRlIDxFRVBST00uaD4KI2luY2x1ZGUgPE9uZUJ1dHRvbi5oPgoKdm9sYXRpbGUgYm9vbGVhbiBsZWQ7Ck9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CiAgaWYgKGRpZ2l0YWxSZWFkKDExKSkgewogICAgbGVkID0gdHJ1ZTsKCiAgfSBlbHNlIHsKICAgIGxlZCA9IGZhbHNlOwoKICB9CiAgRUVQUk9NLnB1dCgwLCBsZWQpOwp9Cgp2b2lkIHNldHVwKCl7CiAgbGVkID0gdHJ1ZTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwogIEVFUFJPTS5nZXQoMCwgbGVkKTsKICBpZiAobGVkKSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsSElHSCk7CgogIH0gZWxzZSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsTE9XKTsKCiAgfQogIGJ1dHRvbjEyLmF0dGFjaENsaWNrKGF0dGFjaENsaWNrMTIpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL0VFUFJPTeiusOW9lUxFROeKtuaAge+8jOWIneWni+WMluaBouWkjeaWreeUteWJjeeahOeKtuaAgQogIC8vRUVQUk9N5pyJ5YaZ5YWl5qyh5pWw5a+/5ZG977yM5LiN6YCC5ZCI6aKR57mB55qE5YaZ5YWl5pWw5o2uCiAgLy/kuI3lkIzlvIDlj5Hmnb9FRVBST03lrZjlgqjnqbrpl7TmnInmiYDkuI3lkIzvvIxVTk/kuI5OYW5vCiAgLy/nmoRFRVBST03kuLoxS0LvvIjlnLDlnYAwLTEwMjPvvInvvIxNZWdh5Li6NEtCCiAgLy/kuI3lkIzmlbDmja7nsbvlnovlrZjlgqjljaDnlKjnmoTlrZfoioLnqbrpl7TkuI3lkIzvvIzkvb/nlKjlpJrkuKrml7blubbkuI3og70KICAvL+eugOWNleeahOaKiuWcsOWdgOeQhuino+S4uuWPmOmHj+WtmOWCqOWMuumcgOe7k+WQiOaVsOaNruexu+Wei+WBmuWIpOaWrQoKICBidXR0b24xMi50aWNrKCk7Cn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/01-点亮板载指示灯13.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/01-点亮板载指示灯13.mix new file mode 100644 index 00000000..0e2986e7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/01-点亮板载指示灯13.mix @@ -0,0 +1 @@ +右键点击对应的程序块,点击打开Wiki可获得该块详细介绍指定输出管脚输出高低电平对于UNO低电平为0V,高电平为5V数字输出通常用于各种数字量控制的执行器例如LED,继电器等上传本例将点亮13号管脚的板载指示灯13HIGHdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Y+z6ZSu54K55Ye75a+55bqU55qE56iL5bqP5Z2X77yM54K55Ye75omT5byAV2lraeWPr+iOt+W+l+ivpeWdl+ivpue7huS7i+e7jQogIC8v5oyH5a6a6L6T5Ye6566h6ISa6L6T5Ye66auY5L2O55S15bmzCiAgLy/lr7nkuo5VTk/kvY7nlLXlubPkuLowVu+8jOmrmOeUteW5s+S4ujVWCiAgLy/mlbDlrZfovpPlh7rpgJrluLjnlKjkuo7lkITnp43mlbDlrZfph4/mjqfliLbnmoTmiafooYzlmajkvovlpoJMRUTvvIznu6fnlLXlmajnrYkKICAvL+S4iuS8oOacrOS+i+WwhueCueS6rjEz5Y+3566h6ISa55qE5p2/6L295oyH56S654GvCiAgZGlnaXRhbFdyaXRlKDEzLEhJR0gpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/02-板载指示灯13闪烁.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/02-板载指示灯13闪烁.mix new file mode 100644 index 00000000..0a8f182d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/02-板载指示灯13闪烁.mix @@ -0,0 +1 @@ +小知识:1秒=1000毫秒,1毫秒=1000微秒上传本例13号管脚的板载指示灯将以一秒为周期闪烁改变延时时间观察现象思考本例中的延时函数作用是什么你能同时让两颗灯同时闪烁吗?以不同周期闪烁呢?若不能请思考原因13HIGHdelay100013LOWdelay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5bCP55+l6K+G77yaMeenkj0xMDAw5q+r56eS77yMMeavq+enkj0xMDAw5b6u56eSCiAgLy/kuIrkvKDmnKzkvosxM+WPt+euoeiEmueahOadv+i9veaMh+ekuueBr+WwhuS7peS4gOenkuS4uuWRqOacn+mXqueDgQogIC8v5pS55Y+Y5bu25pe25pe26Ze06KeC5a+f546w6LGhCiAgLy/mgJ3ogIPmnKzkvovkuK3nmoTlu7bml7blh73mlbDkvZznlKjmmK/ku4DkuYgKICAvL+S9oOiDveWQjOaXtuiuqeS4pOmil+eBr+WQjOaXtumXqueDgeWQl++8n+S7peS4jeWQjOWRqOacn+mXqueDgeWRou+8n+iLpeS4jeiDveivt+aAneiAg+WOn+WboAogIGRpZ2l0YWxXcml0ZSgxMyxISUdIKTsKICBkZWxheSgxMDAwKTsKICBkaWdpdGFsV3JpdGUoMTMsTE9XKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/03-数字输入.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/03-数字输入.mix new file mode 100644 index 00000000..8ddfd936 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/03-数字输入.mix @@ -0,0 +1 @@ +上传程序用双公头杜邦线的一端接到数字输入12号管脚,另一端分别间歇接到开发板的GND与5V观察13号板载指示灯的状态变化,同时查看下方的调试窗口观察输出,发现了什么数字输入的作用是什么?返回是是什么?数字输出除了写HIGH与LOW,还可以写入1和0吗?13HIGH12Serialprintln12delay100dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUKTsKICBwaW5Nb2RlKDEzLCBPVVRQVVQpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuIrkvKDnqIvluo8KICAvL+eUqOWPjOWFrOWktOadnOmCpue6v+eahOS4gOerr+aOpeWIsOaVsOWtl+i+k+WFpTEy5Y+3566h6ISa77yM5Y+m5LiA56uv5YiG5Yir6Ze05q2H5o6l5Yiw5byA5Y+R5p2/55qER05E5LiONVYKICAvL+inguWvnzEz5Y+35p2/6L295oyH56S654Gv55qE54q25oCB5Y+Y5YyW77yM5ZCM5pe25p+l55yL5LiL5pa555qE6LCD6K+V56qX5Y+j6KeC5a+f6L6T5Ye677yM5Y+R546w5LqG5LuA5LmICiAgLy/mlbDlrZfovpPlhaXnmoTkvZznlKjmmK/ku4DkuYjvvJ/ov5Tlm57mmK/mmK/ku4DkuYg/5pWw5a2X6L6T5Ye66Zmk5LqG5YaZSElHSOS4jkxPV++8jOi/mOWPr+S7peWGmeWFpTHlkoww5ZCX77yfCiAgZGlnaXRhbFdyaXRlKDEzLGRpZ2l0YWxSZWFkKDEyKSk7CiAgU2VyaWFsLnByaW50bG4oZGlnaXRhbFJlYWQoMTIpKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/04-管脚输出状态切换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/04-管脚输出状态切换.mix new file mode 100644 index 00000000..689b6612 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/04-管脚输出状态切换.mix @@ -0,0 +1 @@ +下方的“非”为逻辑运算符代表着取反操作,0取反等于1,1取反等于0上传程序观察现象,这种方式相比前面的闪烁方式有何异同?13HIGH13delay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5LiL5pa555qE4oCc6Z2e4oCd5Li66YC76L6R6L+Q566X56ym5Luj6KGo552A5Y+W5Y+N5pON5L2c77yMMOWPluWPjeetieS6jjEsMeWPluWPjeetieS6jjAKICAvL+S4iuS8oOeoi+W6j+inguWvn+eOsOixoe+8jOi/meenjeaWueW8j+ebuOavlOWJjemdoueahOmXqueDgeaWueW8j+acieS9leW8guWQjO+8nwogIGRpZ2l0YWxXcml0ZSgxMywoIWRpZ2l0YWxSZWFkKDEzKSkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/05-PWM模拟输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/05-PWM模拟输出.mix new file mode 100644 index 00000000..7f3bbb2c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/05-PWM模拟输出.mix @@ -0,0 +1 @@ +模拟输出可以输出不同占空比的方波,上传下面的例子可以看到LED的亮度与PWM值的变化模拟输出的值范围是0-255思考当输入的值大于255时会发生什么现象?110delay100011100delay100011255delay1000dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5qih5ouf6L6T5Ye65Y+v5Lul6L6T5Ye65LiN5ZCM5Y2g56m65q+U55qE5pa55rOi77yM5LiK5Lyg5LiL6Z2i55qE5L6L5a2Q5Y+v5Lul55yL5YiwTEVE55qE5Lqu5bqm5LiOUFdN5YC855qE5Y+Y5YyWCiAgLy/mqKHmi5/ovpPlh7rnmoTlgLzojIPlm7TmmK8wLTI1NQogIC8v5oCd6ICD5b2T6L6T5YWl55qE5YC85aSn5LqOMjU15pe25Lya5Y+R55Sf5LuA5LmI546w6LGh77yfCiAgYW5hbG9nV3JpdGUoMTEsIDApOwogIGRlbGF5KDEwMDApOwogIGFuYWxvZ1dyaXRlKDExLCAxMDApOwogIGRlbGF5KDEwMDApOwogIGFuYWxvZ1dyaXRlKDExLCAyNTUpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/06-模拟输入.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/06-模拟输入.mix new file mode 100644 index 00000000..3b02edf8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/06-模拟输入.mix @@ -0,0 +1 @@ +模拟输入可以将0-5V的电压映射为0-1023的值上传下列程序观察串口的 输出将电位器连接到模拟输入管脚,模拟输出管脚接LED观察灯光亮度的变化情况LED亮度随着模拟输入值的变化将会怎样变化?Serial115200SerialprintlnA7110A7delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aooeaLn+i+k+WFpeWPr+S7peWwhjAtNVbnmoTnlLXljovmmKDlsITkuLowLTEwMjPnmoTlgLwKICAvL+S4iuS8oOS4i+WIl+eoi+W6j+inguWvn+S4suWPo+eahCDovpPlh7oKICAvL+WwhueUteS9jeWZqOi/nuaOpeWIsOaooeaLn+i+k+WFpeeuoeiEmu+8jOaooeaLn+i+k+WHuueuoeiEmuaOpUxFROinguWvn+eBr+WFieS6ruW6pueahOWPmOWMluaDheWGtQogIC8vTEVE5Lqu5bqm6ZqP552A5qih5ouf6L6T5YWl5YC855qE5Y+Y5YyW5bCG5Lya5oCO5qC35Y+Y5YyW77yfCiAgU2VyaWFsLnByaW50bG4oYW5hbG9nUmVhZChBNykpOwogIGFuYWxvZ1dyaXRlKDExLCBhbmFsb2dSZWFkKEE3KSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/07-软件模拟输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/07-软件模拟输出.mix new file mode 100644 index 00000000..1bb5b2bc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/07-软件模拟输出.mix @@ -0,0 +1 @@ +软件模拟输出与硬件模拟输出类似都可以输出PWM信号软件模拟输出可以将任意引脚设置为模拟输出引脚,拓展多路模拟输出110delay100011100delay100011255delay1000取消软件模拟输出可以取消PWM输出,一般不使用11dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L2v5Lu25qih5ouf6L6T5Ye65LiO56Gs5Lu25qih5ouf6L6T5Ye657G75Ly86YO95Y+v5Lul6L6T5Ye6UFdN5L+h5Y+3CiAgLy/ova/ku7bmqKHmi5/ovpPlh7rlj6/ku6XlsIbku7vmhI/lvJXohJrorr7nva7kuLrmqKHmi5/ovpPlh7rlvJXohJrvvIzmi5PlsZXlpJrot6/mqKHmi5/ovpPlh7oKICBhbmFsb2dXcml0ZSgxMSwgMCk7CiAgZGVsYXkoMTAwMCk7CiAgYW5hbG9nV3JpdGUoMTEsIDEwMCk7CiAgZGVsYXkoMTAwMCk7CiAgYW5hbG9nV3JpdGUoMTEsIDI1NSk7CiAgZGVsYXkoMTAwMCk7CgogIC8v5Y+W5raI6L2v5Lu25qih5ouf6L6T5Ye65Y+v5Lul5Y+W5raIUFdN6L6T5Ye677yM5LiA6Iis5LiN5L2/55SoCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/08-多功能按键.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/08-多功能按键.mix new file mode 100644 index 00000000..59c15fd8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/08-多功能按键.mix @@ -0,0 +1 @@ +多功能按键可以使用一系列的按键事件来触发某个程序是否执行下列程序单击可以切换LED的亮灭多功能按键的使用需要先声明动作(单击,双击等)与状态(按键按下的状态)分别改变动作条件,对比不同动作的特点按键未按下时应该固定上拉或者下拉悬空可设置为管脚上拉模式attachClick12HIGH11HIGH11CiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KCk9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WkmuWKn+iDveaMiemUruWPr+S7peS9v+eUqOS4gOezu+WIl+eahOaMiemUruS6i+S7tuadpeinpuWPkeafkOS4queoi+W6j+aYr+WQpuaJp+ihjAogIC8v5LiL5YiX56iL5bqP5Y2V5Ye75Y+v5Lul5YiH5o2iTEVE55qE5Lqu54GtCiAgLy/lpJrlip/og73mjInplK7nmoTkvb/nlKjpnIDopoHlhYjlo7DmmI7liqjkvZzvvIjljZXlh7vvvIzlj4zlh7vnrYnvvInkuI7nirbmgIHvvIjmjInplK7mjInkuIvnmoTnirbmgIHvvIkKICAvL+WIhuWIq+aUueWPmOWKqOS9nOadoeS7tu+8jOWvueavlOS4jeWQjOWKqOS9nOeahOeJueeCuQogIC8v5oyJ6ZSu5pyq5oyJ5LiL5pe25bqU6K+l5Zu65a6a5LiK5ouJ5oiW6ICF5LiL5ouJCiAgLy/mgqznqbrlj6/orr7nva7kuLrnrqHohJrkuIrmi4nmqKHlvI8KCiAgYnV0dG9uMTIudGljaygpOwp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/09-硬件中断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/09-硬件中断.mix new file mode 100644 index 00000000..4e4bb755 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/09-硬件中断.mix @@ -0,0 +1 @@ +中断不受其他函数影响,中断触发条件有上升沿,下降沿与电平状态改变此处百度了解什么是上升沿,下降沿硬件中断只有2和3管脚支持下列程序中延时函数并不会影响中断函数,因此中断函数是实时的RISING211HIGH11一般不使用取消中断213HIGH13delay1000dm9pZCBhdHRhY2hJbnRlcnJ1cHRfZnVuX1JJU0lOR18yKCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgyLCBJTlBVVF9QVUxMVVApOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgYXR0YWNoSW50ZXJydXB0KGRpZ2l0YWxQaW5Ub0ludGVycnVwdCgyKSxhdHRhY2hJbnRlcnJ1cHRfZnVuX1JJU0lOR18yLFJJU0lORyk7CiAgcGluTW9kZSgxMywgT1VUUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuK3mlq3kuI3lj5flhbbku5blh73mlbDlvbHlk43vvIzkuK3mlq3op6blj5HmnaHku7bmnInkuIrljYfmsr/vvIzkuIvpmY3msr/kuI7nlLXlubPnirbmgIHmlLnlj5gKICAvL+atpOWkhOeZvuW6puS6huino+S7gOS5iOaYr+S4iuWNh+ayv++8jOS4i+mZjeayvwogIC8v56Gs5Lu25Lit5pat5Y+q5pyJMuWSjDPnrqHohJrmlK/mjIEKICAvL+S4i+WIl+eoi+W6j+S4reW7tuaXtuWHveaVsOW5tuS4jeS8muW9seWTjeS4reaWreWHveaVsO+8jOWboOatpOS4reaWreWHveaVsOaYr+WunuaXtueahAoKICAvL+S4gOiIrOS4jeS9v+eUqOWPlua2iOS4reaWrQoKICBkaWdpdGFsV3JpdGUoMTMsKCFkaWdpdGFsUmVhZCgxMykpKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/10-软件中断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/10-软件中断.mix new file mode 100644 index 00000000..b6e88df2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/10-软件中断.mix @@ -0,0 +1 @@ +软件中断与硬件中断类似作用,但软件中断可以使用任意引脚作为中断引脚RISING1211HIGH11一般不使用取消中断013HIGH13delay1000CiNpbmNsdWRlIDxQaW5DaGFuZ2VJbnQuaD4KCnZvaWQgYXR0YWNoUGluSW50ZXJydXB0X2Z1bl9SSVNJTkdfMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDEyLCBJTlBVVCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBQQ2ludFBvcnQ6OmF0dGFjaEludGVycnVwdCgxMixhdHRhY2hQaW5JbnRlcnJ1cHRfZnVuX1JJU0lOR18xMixSSVNJTkcpOwogIHBpbk1vZGUoMTMsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L2v5Lu25Lit5pat5LiO56Gs5Lu25Lit5pat57G75Ly85L2c55So77yM5L2G6L2v5Lu25Lit5pat5Y+v5Lul5L2/55So5Lu75oSP5byV6ISa5L2c5Li65Lit5pat5byV6ISaCgogIC8v5LiA6Iis5LiN5L2/55So5Y+W5raI5Lit5patCgogIGRpZ2l0YWxXcml0ZSgxMywoIWRpZ2l0YWxSZWFkKDEzKSkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/11-脉冲测量.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/11-脉冲测量.mix new file mode 100644 index 00000000..ca82053d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/11-脉冲测量.mix @@ -0,0 +1 @@ +脉冲测量可以返回某个电平状态持续的时间例如下列程序中当12号管脚状态为高时返回该状态持续的时间状态超时返回0利用脉冲测量可以测量速度,频率等思考如何测量PWM的输出频率Serial115200SerialprintlnHIGH12此块相比与脉冲测量多了一个超时状态,状态持续超过设置时间返回 0HIGH121000000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTIsIElOUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ohInlhrLmtYvph4/lj6/ku6Xov5Tlm57mn5DkuKrnlLXlubPnirbmgIHmjIHnu63nmoTml7bpl7QKICAvL+S+i+WmguS4i+WIl+eoi+W6j+S4reW9kzEy5Y+3566h6ISa54q25oCB5Li66auY5pe26L+U5Zue6K+l54q25oCB5oyB57ut55qE5pe26Ze0CiAgLy/nirbmgIHotoXml7bov5Tlm54wCiAgLy/liKnnlKjohInlhrLmtYvph4/lj6/ku6XmtYvph4/pgJ/luqbvvIzpopHnjofnrYkKICAvL+aAneiAg+WmguS9lea1i+mHj1BXTeeahOi+k+WHuumikeeOhwogIFNlcmlhbC5wcmludGxuKHB1bHNlSW4oMTIsIEhJR0gpKTsKCiAgLy/mraTlnZfnm7jmr5TkuI7ohInlhrLmtYvph4/lpJrkuobkuIDkuKrotoXml7bnirbmgIHvvIznirbmgIHmjIHnu63otoXov4forr7nva7ml7bpl7Tov5Tlm54gMAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/12-管脚上拉模式.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/12-管脚上拉模式.mix new file mode 100644 index 00000000..2d6d55bf --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/12-管脚上拉模式.mix @@ -0,0 +1 @@ +管脚上拉模式相当于接上拉电阻,可以给管脚一个初始高电平悬空12号管脚分别启用与禁用上拉输入观察串口状态INPUT_PULLUP12Serial115200Serialprintln1211HIGH12delay100dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUX1BVTExVUCk7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/nrqHohJrkuIrmi4nmqKHlvI/nm7jlvZPkuo7mjqXkuIrmi4nnlLXpmLvvvIzlj6/ku6Xnu5nnrqHohJrkuIDkuKrliJ3lp4vpq5jnlLXlubMKICAvL+aCrOepujEy5Y+3566h6ISa5YiG5Yir5ZCv55So5LiO56aB55So5LiK5ouJ6L6T5YWl6KeC5a+f5Liy5Y+j54q25oCBCgogIFNlcmlhbC5wcmludGxuKGRpZ2l0YWxSZWFkKDEyKSk7CiAgZGlnaXRhbFdyaXRlKDExLGRpZ2l0YWxSZWFkKDEyKSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/13-串行数据输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/13-串行数据输出.mix new file mode 100644 index 00000000..6b798e07 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/01-输入输出/13-串行数据输出.mix @@ -0,0 +1 @@ +shiftOut通常与移位寄存器一起使用,移位寄存器通常使用74HC595此功能实际运用不多,一般用于拓展输出移位寄存器使用复杂,学习时通常用专用IO拓展芯片拓展阅读 https://blog.jmaker.com.tw/74hc595/MSBFIRST450dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoNCwgT1VUUFVUKTsKICBwaW5Nb2RlKDUsIE9VVFBVVCk7CiAgc2hpZnRPdXQoNCwgNSwgTVNCRklSU1QsIDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3NoaWZ0T3V06YCa5bi45LiO56e75L2N5a+E5a2Y5Zmo5LiA6LW35L2/55So77yM56e75L2N5a+E5a2Y5Zmo6YCa5bi45L2/55SoNzRIQzU5NQogIC8v5q2k5Yqf6IO95a6e6ZmF6L+Q55So5LiN5aSa77yM5LiA6Iis55So5LqO5ouT5bGV6L6T5Ye6CiAgLy/np7vkvY3lr4TlrZjlmajkvb/nlKjlpI3mnYLvvIzlrabkuaDml7bpgJrluLjnlKjkuJPnlKhJT+aLk+WxleiKr+eJhwogIC8v5ouT5bGV6ZiF6K+7IGh0dHBzOi8vYmxvZy5qbWFrZXIuY29tLnR3Lzc0aGM1OTUvCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/01-停止程序.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/01-停止程序.mix new file mode 100644 index 00000000..7e1bfe92 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/01-停止程序.mix @@ -0,0 +1 @@ +RISING1211HIGH11停止程序相当于无限延时下面的程序中加了停止程序,LED将不再闪烁中断程序优先级更高不会受其影响11HIGH11delay1000CiNpbmNsdWRlIDxQaW5DaGFuZ2VJbnQuaD4KCnZvaWQgYXR0YWNoUGluSW50ZXJydXB0X2Z1bl9SSVNJTkdfMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDEyLCBJTlBVVCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBQQ2ludFBvcnQ6OmF0dGFjaEludGVycnVwdCgxMixhdHRhY2hQaW5JbnRlcnJ1cHRfZnVuX1JJU0lOR18xMixSSVNJTkcpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WBnOatoueoi+W6j+ebuOW9k+S6juaXoOmZkOW7tuaXtgogIC8v5LiL6Z2i55qE56iL5bqP5Lit5Yqg5LqG5YGc5q2i56iL5bqP77yMTEVE5bCG5LiN5YaN6Zeq54OBCiAgLy/kuK3mlq3nqIvluo/kvJjlhYjnuqfmm7Tpq5jkuI3kvJrlj5flhbblvbHlk40KICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICBkZWxheSgxMDAwKTsKICB3aGlsZSh0cnVlKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/02-while与do while区别.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/02-while与do while区别.mix new file mode 100644 index 00000000..1193b18b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/02-while与do while区别.mix @@ -0,0 +1 @@ +Serial115200do while会先执行一次程序后判断条件是否成立,条件成立重复执行,反之跳出循环trueSerialprintln1delay1000FALSEwhile会先判断条件是否成立,再选择是否执行程序,条件成立重复执行,反之跳出循环WHILETRUESerialprintln2delay1000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIC8vZG8gd2hpbGXkvJrlhYjmiafooYzkuIDmrKHnqIvluo/lkI7liKTmlq3mnaHku7bmmK/lkKbmiJDnq4vvvIzmnaHku7bmiJDnq4vph43lpI3miafooYzvvIzlj43kuYvot7Plh7rlvqrnjq8KICBkb3sKICAgIFNlcmlhbC5wcmludGxuKCIxIik7CiAgICBkZWxheSgxMDAwKTsKICB9d2hpbGUoZmFsc2UpOwogIC8vd2hpbGXkvJrlhYjliKTmlq3mnaHku7bmmK/lkKbmiJDnq4vvvIzlho3pgInmi6nmmK/lkKbmiafooYznqIvluo/vvIzmnaHku7bmiJDnq4vph43lpI3miafooYzvvIzlj43kuYvot7Plh7rlvqrnjq8KICB3aGlsZSAodHJ1ZSkgewogICAgU2VyaWFsLnByaW50bG4oIjIiKTsKICAgIGRlbGF5KDEwMDApOwogIH0KfQoKdm9pZCBsb29wKCl7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/03-if else条件判断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/03-if else条件判断.mix new file mode 100644 index 00000000..99bc515a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/03-if else条件判断.mix @@ -0,0 +1 @@ +if else语句会根据条件的不同选择性的执行不同的程序下面的程序当12管脚状态为高时点亮LED,反之熄灭LED1211HIGH11LOWdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTIsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL2lmIGVsc2Xor63lj6XkvJrmoLnmja7mnaHku7bnmoTkuI3lkIzpgInmi6nmgKfnmoTmiafooYzkuI3lkIznmoTnqIvluo8KICAvL+S4i+mdoueahOeoi+W6j+W9kzEy566h6ISa54q25oCB5Li66auY5pe254K55LquTEVE77yM5Y+N5LmL54aE54GtTEVECiAgaWYgKGRpZ2l0YWxSZWFkKDEyKSkgewogICAgZGlnaXRhbFdyaXRlKDExLEhJR0gpOwoKICB9IGVsc2UgewogICAgZGlnaXRhbFdyaXRlKDExLExPVyk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/04-switch多分枝条件控制.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/04-switch多分枝条件控制.mix new file mode 100644 index 00000000..ab383617 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/04-switch多分枝条件控制.mix @@ -0,0 +1 @@ +switch为多分枝条件判断语句,不同条件执行不同的程序switch条件只能为整数没有已知条件时才会执行default程序上传程序输入不同数字观察串口输出结果验证swichSerial115200SerialtoInt123Serial0Serialprintln01Serialprintln12Serialprintln2Serialprintln4dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3N3aXRjaOS4uuWkmuWIhuaeneadoeS7tuWIpOaWreivreWPpe+8jOS4jeWQjOadoeS7tuaJp+ihjOS4jeWQjOeahOeoi+W6jwogIC8vc3dpdGNo5p2h5Lu25Y+q6IO95Li65pW05pWwCiAgLy/msqHmnInlt7Lnn6XmnaHku7bml7bmiY3kvJrmiafooYxkZWZhdWx056iL5bqPCiAgLy/kuIrkvKDnqIvluo/ovpPlhaXkuI3lkIzmlbDlrZfop4Llr5/kuLLlj6PovpPlh7rnu5Pmnpzpqozor4Fzd2ljaAogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBzd2l0Y2ggKFN0cmluZyhTZXJpYWwucmVhZFN0cmluZygpKS50b0ludCgpKSB7CiAgICAgY2FzZSAwOgogICAgICBTZXJpYWwucHJpbnRsbigiMCIpOwogICAgICBicmVhazsKICAgICBjYXNlIDE6CiAgICAgIFNlcmlhbC5wcmludGxuKCIxIik7CiAgICAgIGJyZWFrOwogICAgIGNhc2UgMjoKICAgICAgU2VyaWFsLnByaW50bG4oIjIiKTsKICAgICAgYnJlYWs7CiAgICAgZGVmYXVsdDoKICAgICAgU2VyaWFsLnByaW50bG4oIjQiKTsKICAgICAgYnJlYWs7CiAgICB9CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/05-for循环呼吸灯.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/05-for循环呼吸灯.mix new file mode 100644 index 00000000..27f8dd64 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/05-for循环呼吸灯.mix @@ -0,0 +1 @@ +for循环可以指定循环次数重复执行程序下面程序利用for循环实现了呼吸灯的效果注意for循环步长,如果是由小到大则为正数,反之为负数i02551110idelay5i2541-1110idelay5dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8vZm9y5b6q546v5Y+v5Lul5oyH5a6a5b6q546v5qyh5pWw6YeN5aSN5omn6KGM56iL5bqPCiAgLy/kuIvpnaLnqIvluo/liKnnlKhmb3Llvqrnjq/lrp7njrDkuoblkbzlkLjnga/nmoTmlYjmnpwKICAvL+azqOaEj2ZvcuW+queOr+atpemVv++8jOWmguaenOaYr+eUseWwj+WIsOWkp+WImeS4uuato+aVsO+8jOWPjeS5i+S4uui0n+aVsAogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI1NTsgaSA9IGkgKyAoMSkpIHsKICAgIGFuYWxvZ1dyaXRlKDExLCBpKTsKICAgIGRlbGF5KDUpOwogIH0KICBmb3IgKGludCBpID0gMjU0OyBpID49IDE7IGkgPSBpICsgKC0xKSkgewogICAgYW5hbG9nV3JpdGUoMTEsIGkpOwogICAgZGVsYXkoNSk7CiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/06-跳出循环.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/06-跳出循环.mix new file mode 100644 index 00000000..5e55d24b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/06-跳出循环.mix @@ -0,0 +1 @@ +跳出循环可以跳出while循环,do while循环与for循环for循环还可选择跳过某个循环值下面程序当12管脚电平状态为高时跳出循环WHILETRUE11HIGH11delay10012BREAKdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgcGluTW9kZSgxMiwgSU5QVVQpOwogIHdoaWxlICh0cnVlKSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICAgIGRlbGF5KDEwMCk7CiAgICBpZiAoZGlnaXRhbFJlYWQoMTIpKSB7CiAgICAgIGJyZWFrOwoKICAgIH0KICB9Cn0KCnZvaWQgbG9vcCgpewogIC8v6Lez5Ye65b6q546v5Y+v5Lul6Lez5Ye6d2hpbGXlvqrnjq/vvIxkbyB3aGlsZeW+queOr+S4jmZvcuW+queOrwogIC8vZm9y5b6q546v6L+Y5Y+v6YCJ5oup6Lez6L+H5p+Q5Liq5b6q546v5YC8CiAgLy/kuIvpnaLnqIvluo/lvZMxMueuoeiEmueUteW5s+eKtuaAgeS4uumrmOaXtui3s+WHuuW+queOrwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/07-系统运行时间.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/07-系统运行时间.mix new file mode 100644 index 00000000..2e64ed8e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/07-系统运行时间.mix @@ -0,0 +1 @@ +系统运行时间为开发板上电开始运行程序时刻到当前时刻的时间程序开始时间为0上传程序观察串口输出Serial115200Serialprintlnmillisdelay1000dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+ezu+e7n+i/kOihjOaXtumXtOS4uuW8gOWPkeadv+S4iueUteW8gOWni+i/kOihjOeoi+W6j+aXtuWIu+WIsOW9k+WJjeaXtuWIu+eahOaXtumXtAogIC8v56iL5bqP5byA5aeL5pe26Ze05Li6MAogIC8v5LiK5Lyg56iL5bqP6KeC5a+f5Liy5Y+j6L6T5Ye6CiAgU2VyaWFsLnByaW50bG4obWlsbGlzKCkpOwogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/08-硬件定时器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/08-硬件定时器.mix new file mode 100644 index 00000000..f5f84efc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/08-硬件定时器.mix @@ -0,0 +1 @@ +硬件定时器会每隔固定时间重复执行某段程序定时器与中断一样优先级更高,不会受延时函数的影响Serial115200500Serialprintlnhello停止定时器一般不用11HIGH11delay1000CiNpbmNsdWRlIDxNc1RpbWVyMi5oPgoKdm9pZCBtc1RpbWVyMl9mdW5jKCkgewogIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgTXNUaW1lcjI6OnNldCg1MDAsIG1zVGltZXIyX2Z1bmMpOwogIE1zVGltZXIyOjpzdGFydCgpOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v56Gs5Lu25a6a5pe25Zmo5Lya5q+P6ZqU5Zu65a6a5pe26Ze06YeN5aSN5omn6KGM5p+Q5q6156iL5bqPCiAgLy/lrprml7blmajkuI7kuK3mlq3kuIDmoLfkvJjlhYjnuqfmm7Tpq5jvvIzkuI3kvJrlj5flu7bml7blh73mlbDnmoTlvbHlk40KCiAgLy/lgZzmraLlrprml7blmajkuIDoiKzkuI3nlKgKCiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CiAgZGVsYXkoMTAwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/09-简单定时器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/09-简单定时器.mix new file mode 100644 index 00000000..d51c7630 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/09-简单定时器.mix @@ -0,0 +1 @@ +简单定时器与硬件定时器一样都会每隔固定时间重复执行某段程序软件定时器最多可用16个,优先级低会受到延时等阻塞函数的影响1100011HIGH112500SerialprintlnhelloCiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwp9Cgp2b2lkIFNpbXBsZV90aW1lcl8yKCkgewogIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgdGltZXIuc2V0SW50ZXJ2YWwoNTAwTCwgU2ltcGxlX3RpbWVyXzIpOwoKfQoKdm9pZCBsb29wKCl7CiAgLy/nroDljZXlrprml7blmajkuI7noazku7blrprml7blmajkuIDmoLfpg73kvJrmr4/pmpTlm7rlrprml7bpl7Tph43lpI3miafooYzmn5DmrrXnqIvluo8KICAvL+i9r+S7tuWumuaXtuWZqOacgOWkmuWPr+eUqDE25Liq77yM5LyY5YWI57qn5L2O5Lya5Y+X5Yiw5bu25pe2562J6Zi75aGe5Ye95pWw55qE5b2x5ZONCgoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/10-注册延时函数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/10-注册延时函数.mix new file mode 100644 index 00000000..e4337f9c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/10-注册延时函数.mix @@ -0,0 +1 @@ +注册延时函数与执行延时函数需要成对使用,执行延时函数后会等待指定的时间后执行注册延时函数程序与简单定时器有着相同的限制,优先级低会受到延时等函数影响可以选择注册延时函数重复重复执行的次数Serial115200attachClick12HIGH11HIGH110001210010111LOW2SerialprintlnhelloCiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpPbmVCdXR0b24gYnV0dG9uMTIoMTIsZmFsc2UpOwpTaW1wbGVUaW1lciB0aW1lcjsKCnZvaWQgYXR0YWNoQ2xpY2sxMigpIHsKICBkaWdpdGFsV3JpdGUoMTEsSElHSCk7CiAgdGltZXIuc2V0VGltZXIoMTAwMCwgc3VwZXJfZGVsYXlfZnVuY3Rpb24xLCAxKTsKICB0aW1lci5zZXRUaW1lcigxMDAsIHN1cGVyX2RlbGF5X2Z1bmN0aW9uMiwgMTApOwp9Cgp2b2lkIHN1cGVyX2RlbGF5X2Z1bmN0aW9uMSgpIHsKICBkaWdpdGFsV3JpdGUoMTEsTE9XKTsKfQoKdm9pZCBzdXBlcl9kZWxheV9mdW5jdGlvbjIoKSB7CiAgU2VyaWFsLnByaW50bG4oImhlbGxvIik7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+azqOWGjOW7tuaXtuWHveaVsOS4juaJp+ihjOW7tuaXtuWHveaVsOmcgOimgeaIkOWvueS9v+eUqO+8jOaJp+ihjOW7tuaXtuWHveaVsOWQjuS8muetieW+heaMh+WumueahOaXtumXtOWQjuaJp+ihjOazqOWGjOW7tuaXtuWHveaVsOeoi+W6jwogIC8v5LiO566A5Y2V5a6a5pe25Zmo5pyJ552A55u45ZCM55qE6ZmQ5Yi277yM5LyY5YWI57qn5L2O5Lya5Y+X5Yiw5bu25pe2562J5Ye95pWw5b2x5ZONCiAgLy/lj6/ku6XpgInmi6nms6jlhozlu7bml7blh73mlbDph43lpI3ph43lpI3miafooYznmoTmrKHmlbAKCiAgYnV0dG9uMTIudGljaygpOwoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/11-SCoop多线程.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/11-SCoop多线程.mix new file mode 100644 index 00000000..d09e8038 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/02-控制/11-SCoop多线程.mix @@ -0,0 +1 @@ +SCoop多线程可以简化程序,每个线程程序“互不影响”多线程的前提是同一硬件资源同一时刻只能被一个线程调用,否则会出现一些bug或者板子无限重启使用时应当合理规划程序,避免线程冲突Serial115200111HIGH1110002Serialprintlnhello1000CiNpbmNsdWRlICJTQ29vcC5oIgoKZGVmaW5lVGFzayhzY29vcFRhc2sxKQp2b2lkIHNjb29wVGFzazE6OnNldHVwKCkKewp9CnZvaWQgc2Nvb3BUYXNrMTo6bG9vcCgpCnsKICBkaWdpdGFsV3JpdGUoMTEsKCFkaWdpdGFsUmVhZCgxMSkpKTsKICBzbGVlcCgxMDAwKTsKfQoKZGVmaW5lVGFzayhzY29vcFRhc2syKQp2b2lkIHNjb29wVGFzazI6OnNldHVwKCkKewp9CnZvaWQgc2Nvb3BUYXNrMjo6bG9vcCgpCnsKICBTZXJpYWwucHJpbnRsbigiaGVsbG8iKTsKICBzbGVlcCgxMDAwKTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTEsIE9VVFBVVCk7CiAgbXlTQ29vcC5zdGFydCgpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL1NDb29w5aSa57q/56iL5Y+v5Lul566A5YyW56iL5bqP77yM5q+P5Liq57q/56iL56iL5bqP4oCc5LqS5LiN5b2x5ZON4oCdCiAgLy/lpJrnur/nqIvnmoTliY3mj5DmmK/lkIzkuIDnoazku7botYTmupDlkIzkuIDml7bliLvlj6rog73ooqvkuIDkuKrnur/nqIvosIPnlKjvvIzlkKbliJnkvJrlh7rnjrDkuIDkuptidWfmiJbogIXmnb/lrZDml6DpmZDph43lkK8KICAvL+S9v+eUqOaXtuW6lOW9k+WQiOeQhuinhOWIkueoi+W6j++8jOmBv+WFjee6v+eoi+WGsueqgQoKICB5aWVsZCgpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/01-代数运算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/01-代数运算.mix new file mode 100644 index 00000000..d235f56a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/01-代数运算.mix @@ -0,0 +1 @@ +代数运算百度了解各个运算符Serial115200SerialprintlnADD12SerialprintlnMINUS12SerialprintlnMULTIPLY12SerialprintlnDIVIDE12SerialprintlnQUYU12SerialprintlnPOWER12dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKCgxICsgMikpOwogIFNlcmlhbC5wcmludGxuKCgxIC0gMikpOwogIFNlcmlhbC5wcmludGxuKCgxICogMikpOwogIFNlcmlhbC5wcmludGxuKCgxIC8gMikpOwogIFNlcmlhbC5wcmludGxuKCgobG9uZykgKDEpICUgKGxvbmcpICgyKSkpOwogIFNlcmlhbC5wcmludGxuKChwb3coMSwgMikpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ku6PmlbDov5DnrpcKICAvL+eZvuW6puS6huino+WQhOS4qui/kOeul+espgoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/02-位运算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/02-位运算.mix new file mode 100644 index 00000000..6108df93 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/02-位运算.mix @@ -0,0 +1 @@ +位运算百度了解二进制与位运算位运算会将其他进制转换为二进制后进行按位运算Serial115200Serialprintln&67Serialprintln|67Serialprintln^67Serialprintln>>67Serialprintln<<67dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKCg2JjcpKTsKICBTZXJpYWwucHJpbnRsbigoNnw3KSk7CiAgU2VyaWFsLnByaW50bG4oKDZeNykpOwogIFNlcmlhbC5wcmludGxuKCg2Pj43KSk7CiAgU2VyaWFsLnByaW50bG4oKDY8PDcpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kvY3ov5DnrpcKICAvL+eZvuW6puS6huino+S6jOi/m+WItuS4juS9jei/kOeulwogIC8v5L2N6L+Q566X5Lya5bCG5YW25LuW6L+b5Yi26L2s5o2i5Li65LqM6L+b5Yi25ZCO6L+b6KGM5oyJ5L2N6L+Q566XCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/03-三角函数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/03-三角函数.mix new file mode 100644 index 00000000..472cba1e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/03-三角函数.mix @@ -0,0 +1 @@ +三角函数百度了解三角函数,指数函数与对数函数根据自身学过的函数选择功能验证Serial115200SerialprintlnSIN30SerialprintlnSIN30dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChzaW4oMzAgLyAxODAuMCAqIDMuMTQxNTkpKSk7CiAgU2VyaWFsLnByaW50bG4oKHNpbigzMCAvIDE4MC4wICogMy4xNDE1OSkpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuInop5Llh73mlbAKICAvL+eZvuW6puS6huino+S4ieinkuWHveaVsO+8jOaMh+aVsOWHveaVsOS4juWvueaVsOWHveaVsAogIC8v5qC55o2u6Ieq6Lqr5a2m6L+H55qE5Ye95pWw6YCJ5oup5Yqf6IO96aqM6K+BCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/04-变量自加.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/04-变量自加.mix new file mode 100644 index 00000000..e7737789 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/04-变量自加.mix @@ -0,0 +1 @@ +变量自加自减自乘自处global_variateitemint2Serial115200Serialprintlnitem+itemitem1Serialprintlnitem-itemitem1Serialprintlnitem*itemitem1Serialprintlnitem/itemitem1Serialprintlnitem++itemitemSerialprintlnitem--itemitemSerialprintlnitemdm9sYXRpbGUgaW50IGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9IDI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbSA9IGl0ZW0gKyAxOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0gPSBpdGVtIC0gMTsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtID0gaXRlbSAqIDE7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbSA9IGl0ZW0gLyAxOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0rKzsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtLS07CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Y+Y6YeP6Ieq5Yqg6Ieq5YeP6Ieq5LmY6Ieq5aSECgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/05-常见数学运算(四舍五入等).mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/05-常见数学运算(四舍五入等).mix new file mode 100644 index 00000000..8e437e40 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/05-常见数学运算(四舍五入等).mix @@ -0,0 +1 @@ +常见数学运算Serial115200Serialprintlnround6.666Serialprintlnceil6.666Serialprintlnfloor6.666Serialprintlnabs6.666Serialprintlnabs-6.666Serialprintlnsq4Serialprintlnsqrt16dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKHJvdW5kKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oY2VpbCg2LjY2NikpOwogIFNlcmlhbC5wcmludGxuKGZsb29yKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oYWJzKDYuNjY2KSk7CiAgU2VyaWFsLnByaW50bG4oYWJzKC02LjY2NikpOwogIFNlcmlhbC5wcmludGxuKHNxKDQpKTsKICBTZXJpYWwucHJpbnRsbihzcXJ0KDE2KSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5bi46KeB5pWw5a2m6L+Q566XCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/06-获取不同类型数据占用的字节数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/06-获取不同类型数据占用的字节数.mix new file mode 100644 index 00000000..e9f70104 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/06-获取不同类型数据占用的字节数.mix @@ -0,0 +1 @@ +获取不同类型数据占用的字节数Serial115200SerialprintlnintSerialprintlnunsigned intSerialprintlnwordSerialprintlnlongSerialprintlnunsigned longSerialprintlnfloatSerialprintlndoubleSerialprintlnbooleanSerialprintlnbyteSerialprintlncharSerialprintlnunsigned charSerialprintlnStringSerialprintlnuint8_tSerialprintlnuint16_tSerialprintlnuint32_tSerialprintlnuint64_tdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihpbnQpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YodW5zaWduZWQgaW50KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHdvcmQpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YobG9uZykpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1bnNpZ25lZCBsb25nKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGZsb2F0KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGRvdWJsZSkpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihib29sZWFuKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKGJ5dGUpKTsKICBTZXJpYWwucHJpbnRsbihzaXplb2YoY2hhcikpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1bnNpZ25lZCBjaGFyKSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKFN0cmluZykpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZih1aW50OF90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQxNl90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQzMl90KSk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKHVpbnQ2NF90KSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6I635Y+W5LiN5ZCM57G75Z6L5pWw5o2u5Y2g55So55qE5a2X6IqC5pWwCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/07-最大值与最小值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/07-最大值与最小值.mix new file mode 100644 index 00000000..351d3aaa --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/07-最大值与最小值.mix @@ -0,0 +1 @@ +两数相比去最大值或者最小值Serial115200Serialprintlnmax12Serialprintlnmin12dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKG1heCgxLCAyKSk7CiAgU2VyaWFsLnByaW50bG4obWluKDEsIDIpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuKTmlbDnm7jmr5TljrvmnIDlpKflgLzmiJbogIXmnIDlsI/lgLwKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/08-获取随机数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/08-获取随机数.mix new file mode 100644 index 00000000..e78b79c4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/08-获取随机数.mix @@ -0,0 +1 @@ +随机数包含最小值不含最大值attachClick12HIGHSerial115200997millisSerialprintln1100CiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KCk9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgcmFuZG9tU2VlZChtaWxsaXMoKSk7CiAgU2VyaWFsLnByaW50bG4oKHJhbmRvbSgxLCAxMDApKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBidXR0b24xMi5hdHRhY2hDbGljayhhdHRhY2hDbGljazEyKTsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/pmo/mnLrmlbDljIXlkKvmnIDlsI/lgLzkuI3lkKvmnIDlpKflgLwKCiAgYnV0dG9uMTIudGljaygpOwp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/09-数学约束.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/09-数学约束.mix new file mode 100644 index 00000000..d454c1f5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/09-数学约束.mix @@ -0,0 +1 @@ +将模拟输入的值由0-1023约束到0-255110A70255dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WwhuaooeaLn+i+k+WFpeeahOWAvOeUsTAtMTAyM+e6puadn+WIsDAtMjU1CiAgYW5hbG9nV3JpdGUoMTEsIChjb25zdHJhaW4oYW5hbG9nUmVhZChBNyksIDAsIDI1NSkpKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/10-数学映射.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/10-数学映射.mix new file mode 100644 index 00000000..6b2fa5d1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/03-数学/10-数学映射.mix @@ -0,0 +1 @@ +将模拟输入的值由0-1023映射到0-255110map_intA7010230255dm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WwhuaooeaLn+i+k+WFpeeahOWAvOeUsTAtMTAyM+aYoOWwhOWIsDAtMjU1CiAgYW5hbG9nV3JpdGUoMTEsIChtYXAoYW5hbG9nUmVhZChBNyksIDAsIDEwMjMsIDAsIDI1NSkpKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/01-逻辑关系.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/01-逻辑关系.mix new file mode 100644 index 00000000..f2983ef5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/01-逻辑关系.mix @@ -0,0 +1 @@ +逻辑关系GTEA750011HIGH11LOWdm9pZCBzZXR1cCgpewogIHBpbk1vZGUoQTcsIElOUFVUKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+mAu+i+keWFs+ezuwogIGlmIChhbmFsb2dSZWFkKEE3KSA+PSA1MDApIHsKICAgIGRpZ2l0YWxXcml0ZSgxMSxISUdIKTsKCiAgfSBlbHNlIHsKICAgIGRpZ2l0YWxXcml0ZSgxMSxMT1cpOwoKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/02-逻辑运算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/02-逻辑运算.mix new file mode 100644 index 00000000..5c3ca9d4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/02-逻辑运算.mix @@ -0,0 +1 @@ +逻辑运算,且运算只有两个条件都为真结果才真,或运算只有有一个条件为真就返回真SerialprintlnAND10SerialprintlnAND11SerialprintlnOR10SerialprintlnOR00dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBTZXJpYWwucHJpbnRsbigoMSAmJiAwKSk7CiAgU2VyaWFsLnByaW50bG4oKDEgJiYgMSkpOwogIFNlcmlhbC5wcmludGxuKCgxIHx8IDApKTsKICBTZXJpYWwucHJpbnRsbigoMCB8fCAwKSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6YC76L6R6L+Q566X77yM5LiU6L+Q566X5Y+q5pyJ5Lik5Liq5p2h5Lu26YO95Li655yf57uT5p6c5omN55yf77yM5oiW6L+Q566X5Y+q5pyJ5pyJ5LiA5Liq5p2h5Lu25Li655yf5bCx6L+U5Zue55yfCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/03-逻辑非运算.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/03-逻辑非运算.mix new file mode 100644 index 00000000..ae7a6779 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/03-逻辑非运算.mix @@ -0,0 +1 @@ +逻辑非运算,对输入取反Serial115200Serialprintln12delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIHBpbk1vZGUoMTIsIElOUFVUKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/pgLvovpHpnZ7ov5DnrpfvvIzlr7novpPlhaXlj5blj40KICBTZXJpYWwucHJpbnRsbigoIWRpZ2l0YWxSZWFkKDEyKSkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/04-条件返回值.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/04-条件返回值.mix new file mode 100644 index 00000000..8c2b2e76 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/04-逻辑/04-条件返回值.mix @@ -0,0 +1 @@ +条件返回值,根据条件返回不同的值Serial115200Seriallocal_variate串口输入数字inttoInt123SerialSerialprintlnLTE串口输入数字200输入过小GTE串口输入数字600输入过大输入适合dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+adoeS7tui/lOWbnuWAvO+8jOagueaNruadoeS7tui/lOWbnuS4jeWQjOeahOWAvAogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBpbnQgX0U0X0I4X0IyX0U1XzhGX0EzX0U4X0JFXzkzX0U1Xzg1X0E1X0U2Xzk1X0IwX0U1X0FEXzk3ID0gU3RyaW5nKFNlcmlhbC5yZWFkU3RyaW5nKCkpLnRvSW50KCk7CiAgICBTZXJpYWwucHJpbnRsbigoKF9FNF9COF9CMl9FNV84Rl9BM19FOF9CRV85M19FNV84NV9BNV9FNl85NV9CMF9FNV9BRF85NyA8PSAyMDApPyLovpPlhaXov4flsI8iOigoX0U0X0I4X0IyX0U1XzhGX0EzX0U4X0JFXzkzX0U1Xzg1X0E1X0U2Xzk1X0IwX0U1X0FEXzk3ID49IDYwMCk/Iui+k+WFpei/h+WkpyI6Iui+k+WFpemAguWQiCIpKSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/01-字符串拼接.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/01-字符串拼接.mix new file mode 100644 index 00000000..e32f1bc7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/01-字符串拼接.mix @@ -0,0 +1 @@ +字符串拼接字符串拼接程序块可以拼接不同数据类型的数据组成一个字符串,就像冰糖葫芦一样Serial115200SerialprintlnHellohelloMixlyaSerialprintlnA0Cdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiaGVsbG8iKSArIFN0cmluZygnYScpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIkEiKSArIFN0cmluZygwKSArIFN0cmluZygiQyIpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLmi7zmjqUKICAvL+Wtl+espuS4suaLvOaOpeeoi+W6j+Wdl+WPr+S7peaLvOaOpeS4jeWQjOaVsOaNruexu+Wei+eahOaVsOaNrue7hOaIkOS4gOS4quWtl+espuS4su+8jOWwseWDj+WGsOezluiRq+iKpuS4gOagtwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/02-字符串转整数或小数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/02-字符串转整数或小数.mix new file mode 100644 index 00000000..cf2c26b0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/02-字符串转整数或小数.mix @@ -0,0 +1 @@ +字符串转整数或小数Serial115200SerialprintlnADD1toInt1231231SerialprintlnADD1toFloat1236.661dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChTdHJpbmcoIjEyMyIpLnRvSW50KCkgKyAxKSk7CiAgU2VyaWFsLnByaW50bG4oKFN0cmluZygiNi42NiIpLnRvRmxvYXQoKSArIDEpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLovazmlbTmlbDmiJblsI/mlbAKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/03-字符串索引.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/03-字符串索引.mix new file mode 100644 index 00000000..4f02acec --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/03-字符串索引.mix @@ -0,0 +1 @@ +返回当前字符串在源字符串中的位置字符串长度0是第一位该块可以判断当前字符串是否属于源字符串若源字符串不包含子字符串返回-1Serial115200SerialSerialprintlnMixlyySerialdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+i/lOWbnuW9k+WJjeWtl+espuS4suWcqOa6kOWtl+espuS4suS4reeahOS9jee9rgogIC8v5a2X56ym5Liy6ZW/5bqmMOaYr+esrOS4gOS9jQogIC8v6K+l5Z2X5Y+v5Lul5Yik5pat5b2T5YmN5a2X56ym5Liy5piv5ZCm5bGe5LqO5rqQ5a2X56ym5LiyCiAgLy/oi6XmupDlrZfnrKbkuLLkuI3ljIXlkKvlrZDlrZfnrKbkuLLov5Tlm54tMQogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIk1peGx5IikuaW5kZXhPZihTdHJpbmcoU2VyaWFsLnJlYWRTdHJpbmcoKSkpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/04-截取字符串.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/04-截取字符串.mix new file mode 100644 index 00000000..ae67627e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/04-截取字符串.mix @@ -0,0 +1 @@ +从源字符串中截取指定长度的字符串改变截取的位置查看串口输出小数保留有效位是截取字符串的一种特例Serial115200Serialprintlnsubstring03Serialprintln6.6662dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuc3Vic3RyaW5nKDAsMykpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZyg2LjY2NiwgMikpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+S7jua6kOWtl+espuS4suS4reaIquWPluaMh+WumumVv+W6pueahOWtl+espuS4sgogIC8v5pS55Y+Y5oiq5Y+W55qE5L2N572u5p+l55yL5Liy5Y+j6L6T5Ye6CiAgLy/lsI/mlbDkv53nlZnmnInmlYjkvY3mmK/miKrlj5blrZfnrKbkuLLnmoTkuIDnp43nibnkvosKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/05-字符串转换与替换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/05-字符串转换与替换.mix new file mode 100644 index 00000000..97ed38c7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/05-字符串转换与替换.mix @@ -0,0 +1 @@ +字符串转换与替换global_variateitemString helloSerial115200Serialprintlnitem.toUpperCase()StringitemSerialprintlnitem.toLowerCase()StringitemSerialprintlnitemStringitemhQSerialprintlnitemStringitemSerialprintlnitemU3RyaW5nIGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9ICIgICBoZWxsbyI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaXRlbS50b1VwcGVyQ2FzZSgpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0udG9Mb3dlckNhc2UoKTsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKICBpdGVtLnJlcGxhY2UoImgiLCAiUSIpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwogIGl0ZW0udHJpbSgpOwogIFNlcmlhbC5wcmludGxuKGl0ZW0pOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+Wtl+espuS4sui9rOaNouS4juabv+aNogoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/06-字符串首位判断与数据类型转换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/06-字符串首位判断与数据类型转换.mix new file mode 100644 index 00000000..0530abe0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/06-字符串首位判断与数据类型转换.mix @@ -0,0 +1 @@ +判断源字符串是否由指定的字符串开头或结尾数据类型转换可以将字符串转为其他数据类型Serial115200Serialprintln.startsWithsubstringsubSerialprintln.endsWithsubstringingSerialprintlnLTEint12350dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuc3RhcnRzV2l0aCgic3ViIikpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygic3Vic3RyaW5nIikuZW5kc1dpdGgoImluZyIpKTsKICBTZXJpYWwucHJpbnRsbigoaW50KCIxMjMiKSA8PSA1MCkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+WIpOaWrea6kOWtl+espuS4suaYr+WQpueUseaMh+WumueahOWtl+espuS4suW8gOWktOaIlue7k+WwvgogIC8v5pWw5o2u57G75Z6L6L2s5o2i5Y+v5Lul5bCG5a2X56ym5Liy6L2s5Li65YW25LuW5pWw5o2u57G75Z6LCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/07-字符与ascii码互相转换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/07-字符与ascii码互相转换.mix new file mode 100644 index 00000000..21704fd6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/07-字符与ascii码互相转换.mix @@ -0,0 +1 @@ +字符与ascii码互相转换Serial115200Serialprintln223Serialprintlnadm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKGNoYXIoMjIzKSk7CiAgU2VyaWFsLnByaW50bG4odG9hc2NpaSgnYScpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuI5hc2NpaeeggeS6kuebuOi9rOaNogoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/08-进制转换.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/08-进制转换.mix new file mode 100644 index 00000000..63e1a793 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/08-进制转换.mix @@ -0,0 +1 @@ +进制转换,将一个整数转换为对应的进制得到转换后的字符串Serial115200SerialprintlnBIN20SerialprintlnOCT20SerialprintlnDEC20SerialprintlnHEX20dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygyMCwgQklOKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKDIwLCBPQ1QpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoMjAsIERFQykpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygyMCwgSEVYKSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6L+b5Yi26L2s5o2i77yM5bCG5LiA5Liq5pW05pWw6L2s5o2i5Li65a+55bqU55qE6L+b5Yi25b6X5Yiw6L2s5o2i5ZCO55qE5a2X56ym5LiyCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/09-字符串长度与获取指定位置字符.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/09-字符串长度与获取指定位置字符.mix new file mode 100644 index 00000000..b7075233 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/09-字符串长度与获取指定位置字符.mix @@ -0,0 +1 @@ +获取字符串的长度与获取字符串的最后一个字符字符串长度从0开始计算,实际长度比字符数少1global_variateitemStringhelloSerial115200SerialprintlnhelloitemSerialprintlnhelloitem0MINUS1helloitem1U3RyaW5nIGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgaXRlbSA9ICJoZWxsbyI7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKGl0ZW0pLmxlbmd0aCgpKTsKICBTZXJpYWwucHJpbnRsbihTdHJpbmcoaXRlbSkuY2hhckF0KChTdHJpbmcoaXRlbSkubGVuZ3RoKCkgLSAxKSkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPluWtl+espuS4sueahOmVv+W6puS4juiOt+WPluWtl+espuS4sueahOacgOWQjuS4gOS4quWtl+espgogIC8v5a2X56ym5Liy6ZW/5bqm5LuOMOW8gOWni+iuoeeul++8jOWunumZhemVv+W6puavlOWtl+espuaVsOWwkTEKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/10-字符串关系与比较.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/10-字符串关系与比较.mix new file mode 100644 index 00000000..e9d4dcc1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/05-文本/10-字符串关系与比较.mix @@ -0,0 +1 @@ +字符串关系与比较字符串关系有等于,开始于和结尾于字符串比较会将组成字符串的每个阿斯克码值相加再减去另一个字符串的值,一般不用Serial115200SerialprintlnequalshellohelloSerialprintlnstartsWithhelloheSerialprintlnendsWithhelloloSerialprintlnAaSerialprintlnAA1dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiaGVsbG8iKS5lcXVhbHMoU3RyaW5nKCJoZWxsbyIpKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCJoZWxsbyIpLnN0YXJ0c1dpdGgoU3RyaW5nKCJoZSIpKSk7CiAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCJoZWxsbyIpLmVuZHNXaXRoKFN0cmluZygibG8iKSkpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiQSIpLmNvbXBhcmVUbyhTdHJpbmcoImEiKSkpOwogIFNlcmlhbC5wcmludGxuKFN0cmluZygiQSIpLmNvbXBhcmVUbyhTdHJpbmcoIkExIikpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lrZfnrKbkuLLlhbPns7vkuI7mr5TovoMKICAvL+Wtl+espuS4suWFs+ezu+acieetieS6ju+8jOW8gOWni+S6juWSjOe7k+WwvuS6jgogIC8v5a2X56ym5Liy5q+U6L6D5Lya5bCG57uE5oiQ5a2X56ym5Liy55qE5q+P5Liq6Zi/5pav5YWL56CB5YC855u45Yqg5YaN5YeP5Y675Y+m5LiA5Liq5a2X56ym5Liy55qE5YC877yM5LiA6Iis5LiN55SoCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/01-一维数组声明.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/01-一维数组声明.mix new file mode 100644 index 00000000..dd501659 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/01-一维数组声明.mix @@ -0,0 +1 @@ +数组的声明数组可以存放多个同类型的数据数组有两种声明方式,一种是预定义数据,另一种是定义数据个数对于已确定的数据采用第一种定义方式,对于需要动态加载的采取第二种定义数组声明应避免中文命名Serial115200intmylist012intmylist1100SerialprintlnmylistSerialprintlnmylist1aW50IG15bGlzdFtdPXswLCAxLCAyfTsKCmludCBteWxpc3QxWzEwMF09e307Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgU2VyaWFsLnByaW50bG4oc2l6ZW9mKG15bGlzdCkvc2l6ZW9mKG15bGlzdFswXSkpOwogIFNlcmlhbC5wcmludGxuKHNpemVvZihteWxpc3QxKS9zaXplb2YobXlsaXN0MVswXSkpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aVsOe7hOeahOWjsOaYjgogIC8v5pWw57uE5Y+v5Lul5a2Y5pS+5aSa5Liq5ZCM57G75Z6L55qE5pWw5o2uCiAgLy/mlbDnu4TmnInkuKTnp43lo7DmmI7mlrnlvI/vvIzkuIDnp43mmK/pooTlrprkuYnmlbDmja7vvIzlj6bkuIDnp43mmK/lrprkuYnmlbDmja7kuKrmlbAKICAvL+WvueS6juW3suehruWumueahOaVsOaNrumHh+eUqOesrOS4gOenjeWumuS5ieaWueW8j++8jOWvueS6jumcgOimgeWKqOaAgeWKoOi9veeahOmHh+WPluesrOS6jOenjeWumuS5iQogIC8v5pWw57uE5aOw5piO5bqU6YG/5YWN5Lit5paH5ZG95ZCNCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/02-数组读写.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/02-数组读写.mix new file mode 100644 index 00000000..bb3fe9fc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/02-数组读写.mix @@ -0,0 +1 @@ +数组的读写数组增加不存在的数据项并不会改变数组长度数组数据从0开始作为第一项增加不存在的数据项为有效数据,但不建议使用Serial115200intmylist012mylist38Serialprintlnmylisti031Serialprintlnmylist0iaW50IG15bGlzdFtdPXswLCAxLCAyfTsKCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oMTE1MjAwKTsKICBteWxpc3RbM10gPSA4OwogIFNlcmlhbC5wcmludGxuKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pKTsKICBmb3IgKGludCBpID0gMDsgaSA8PSAzOyBpID0gaSArICgxKSkgewogICAgU2VyaWFsLnByaW50bG4obXlsaXN0W2ldKTsKICB9Cn0KCnZvaWQgbG9vcCgpewogIC8v5pWw57uE55qE6K+75YaZCiAgLy/mlbDnu4Tlop7liqDkuI3lrZjlnKjnmoTmlbDmja7pobnlubbkuI3kvJrmlLnlj5jmlbDnu4Tplb/luqYKICAvL+aVsOe7hOaVsOaNruS7jjDlvIDlp4vkvZzkuLrnrKzkuIDpobkKICAvL+WinuWKoOS4jeWtmOWcqOeahOaVsOaNrumhueS4uuacieaViOaVsOaNru+8jOS9huS4jeW7uuiuruS9v+eUqAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/03-数组循环移位.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/03-数组循环移位.mix new file mode 100644 index 00000000..f0fe6442 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/03-数组循环移位.mix @@ -0,0 +1 @@ +数组循环移位(仅对一维数组有效)将数组首位相连看做一个整体左移位与右移位相当于逆时针转动与顺时针转动Serial115200intmylist012i021Serialprintlnmylist0iint0mylisti021Serialprintlnmylist0iint1mylisti021Serialprintlnmylist0iaW50IG15bGlzdFtdPXswLCAxLCAyfTsKCnZvaWQgYXJyYXlfbGVmdF9sb29wKCkgewogIGludCBpdGVtID0wOwogIGl0ZW0gPSBteWxpc3RbKGludCkoMCldOwogIGZvciAoaW50IGkgPSAoMik7IGkgPD0gKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pKTsgaSA9IGkgKyAoMSkpIHsKICAgIG15bGlzdFsoaW50KSgoaSAtIDEpIC0gMSldID0gbXlsaXN0WyhpbnQpKGkgLSAxKV07CiAgfQogIG15bGlzdFsoaW50KShzaXplb2YobXlsaXN0KS9zaXplb2YobXlsaXN0WzBdKSAtIDEpXSA9IGl0ZW07Cn0KCnZvaWQgYXJyYXlfcmlnaHRfbG9vcCgpIHsKICBpbnQgaXRlbSA9MDsKICBpdGVtID0gbXlsaXN0WyhpbnQpKHNpemVvZihteWxpc3QpL3NpemVvZihteWxpc3RbMF0pIC0gMSldOwogIGZvciAoaW50IGkgPSAoc2l6ZW9mKG15bGlzdCkvc2l6ZW9mKG15bGlzdFswXSkpOyBpID49ICgxKTsgaSA9IGkgKyAoLTEpKSB7CiAgICBteWxpc3RbKGludCkoKGkgKyAxKSAtIDEpXSA9IG15bGlzdFsoaW50KShpIC0gMSldOwogIH0KICBteWxpc3RbKGludCkoMCldID0gaXRlbTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI7IGkgPSBpICsgKDEpKSB7CiAgICBTZXJpYWwucHJpbnRsbihteWxpc3RbaV0pOwogIH0KICBhcnJheV9sZWZ0X2xvb3AoKTsKICBmb3IgKGludCBpID0gMDsgaSA8PSAyOyBpID0gaSArICgxKSkgewogICAgU2VyaWFsLnByaW50bG4obXlsaXN0W2ldKTsKICB9CiAgYXJyYXlfcmlnaHRfbG9vcCgpOwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDI7IGkgPSBpICsgKDEpKSB7CiAgICBTZXJpYWwucHJpbnRsbihteWxpc3RbaV0pOwogIH0KfQoKdm9pZCBsb29wKCl7CiAgLy/mlbDnu4Tlvqrnjq/np7vkvY3vvIjku4Xlr7nkuIDnu7TmlbDnu4TmnInmlYjvvIkKICAvL+WwhuaVsOe7hOmmluS9jeebuOi/nueci+WBmuS4gOS4quaVtOS9k+W3puenu+S9jeS4juWPs+enu+S9jeebuOW9k+S6jumAhuaXtumSiOi9rOWKqOS4jumhuuaXtumSiOi9rOWKqAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/04-二维数组声明.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/04-二维数组声明.mix new file mode 100644 index 00000000..16f38c0a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/04-二维数组声明.mix @@ -0,0 +1 @@ +二维数组的声明二维数组可以看做是一维数组的集合就像方队一样,由行和列构成,每个人(元素)共同构成了方队(二维数组)Serial115200intmylist012123234234intarray22{0,0},{0,0}SerialprintlnmylistrowSerialprintlnmylistcolSerialprintlnarrayrowSerialprintlnarraycolaW50IG15bGlzdFs0XVszXSA9IHsKICB7MCwgMSwgMn0sCiAgezEsIDIsIDN9LAogIHsyLCAzLCA0fSwKICB7MiwgMywgNH0KfTsKaW50IGFycmF5WzJdWzJdPXt7MCwwfSx7MCwwfX07CgoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFNlcmlhbC5wcmludGxuKChzaXplb2YobXlsaXN0KSAvIHNpemVvZihteWxpc3RbMF0pKSk7CiAgU2VyaWFsLnByaW50bG4oKHNpemVvZihteWxpc3RbMF0pIC8gc2l6ZW9mKG15bGlzdFswXVswXSkpKTsKICBTZXJpYWwucHJpbnRsbigoc2l6ZW9mKGFycmF5KSAvIHNpemVvZihhcnJheVswXSkpKTsKICBTZXJpYWwucHJpbnRsbigoc2l6ZW9mKGFycmF5WzBdKSAvIHNpemVvZihhcnJheVswXVswXSkpKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuoznu7TmlbDnu4TnmoTlo7DmmI4KICAvL+S6jOe7tOaVsOe7hOWPr+S7peeci+WBmuaYr+S4gOe7tOaVsOe7hOeahOmbhuWQiAogIC8v5bCx5YOP5pa56Zif5LiA5qC377yM55Sx6KGM5ZKM5YiX5p6E5oiQ77yM5q+P5Liq5Lq677yI5YWD57Sg77yJ5YWx5ZCM5p6E5oiQ5LqG5pa56Zif77yI5LqM57u05pWw57uE77yJCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/05-二维数组读写.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/05-二维数组读写.mix new file mode 100644 index 00000000..39ee5a5a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/06-数组/05-二维数组读写.mix @@ -0,0 +1 @@ +二维数组的读写二维数组的使用需要知道行与列Serial115200intmylist012123mylist00666i011j021Serialprintmylist0i0jSerialprint SerialprintlnaW50IG15bGlzdFsyXVszXSA9IHsKICB7MCwgMSwgMn0sCiAgezEsIDIsIDN9Cn07Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgbXlsaXN0WzBdWzBdID0gNjY2OwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDE7IGkgPSBpICsgKDEpKSB7CiAgICBmb3IgKGludCBqID0gMDsgaiA8PSAyOyBqID0gaiArICgxKSkgewogICAgICBTZXJpYWwucHJpbnQobXlsaXN0W2ldW2pdKTsKICAgICAgU2VyaWFsLnByaW50KCIgICAgIik7CiAgICB9CiAgICBTZXJpYWwucHJpbnRsbigiIik7CiAgfQp9Cgp2b2lkIGxvb3AoKXsKICAvL+S6jOe7tOaVsOe7hOeahOivu+WGmQogIC8v5LqM57u05pWw57uE55qE5L2/55So6ZyA6KaB55+l6YGT6KGM5LiO5YiXCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/07-变量/01-变量声明与使用区别.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/07-变量/01-变量声明与使用区别.mix new file mode 100644 index 00000000..4d059364 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/07-变量/01-变量声明与使用区别.mix @@ -0,0 +1 @@ +变量使用需要先声明数据类型变量分为全局变量与局部变量全局变量整个程序全局调用,局部变量只对当前函数有效全局变量整个程序全局调用,局部变量只对当前函数有效,例如这里声明了两个同名变量item&#10;其中主循环loop里声明的是局部变量,同名局部变量会覆盖全局变量Serial115200global_variateitemint123Serialprintlnitemitem888Serialprintlnitemlocal_variateitemint666Serialprintlnitemdm9sYXRpbGUgaW50IGl0ZW07Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDExNTIwMCk7CiAgaXRlbSA9IDEyMzsKICBTZXJpYWwucHJpbnRsbihpdGVtKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lj5jph4/kvb/nlKjpnIDopoHlhYjlo7DmmI7mlbDmja7nsbvlnosKICAvL+WPmOmHj+WIhuS4uuWFqOWxgOWPmOmHj+S4juWxgOmDqOWPmOmHjwogIC8v5YWo5bGA5Y+Y6YeP5pW05Liq56iL5bqP5YWo5bGA6LCD55So77yM5bGA6YOo5Y+Y6YeP5Y+q5a+55b2T5YmN5Ye95pWw5pyJ5pWICiAgLy/lhajlsYDlj5jph4/mlbTkuKrnqIvluo/lhajlsYDosIPnlKjvvIzlsYDpg6jlj5jph4/lj6rlr7nlvZPliY3lh73mlbDmnInmlYjvvIzkvovlpoLov5nph4zlo7DmmI7kuobkuKTkuKrlkIzlkI3lj5jph49pdGVtCiAgLy/lhbbkuK3kuLvlvqrnjq9sb29w6YeM5aOw5piO55qE5piv5bGA6YOo5Y+Y6YeP77yM5ZCM5ZCN5bGA6YOo5Y+Y6YeP5Lya6KaG55uW5YWo5bGA5Y+Y6YePCgogIGl0ZW0gPSA4ODg7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgaW50IGl0ZW0gPSA2NjY7CiAgU2VyaWFsLnByaW50bG4oaXRlbSk7CiAgd2hpbGUodHJ1ZSk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/01-无返回值无参数函数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/01-无返回值无参数函数.mix new file mode 100644 index 00000000..703cd879 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/01-无返回值无参数函数.mix @@ -0,0 +1 @@ +无返回值无参数函数声明函数使用可以简化程序,对于需要重复执行&#10;的程序一般需要封装为函数delay1000切换状态11HIGH11dm9pZCBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aXoOi/lOWbnuWAvOaXoOWPguaVsOWHveaVsOWjsOaYjgogIC8v5Ye95pWw5L2/55So5Y+v5Lul566A5YyW56iL5bqP77yM5a+55LqO6ZyA6KaB6YeN5aSN5omn6KGMCiAgLy/nmoTnqIvluo/kuIDoiKzpnIDopoHlsIHoo4XkuLrlh73mlbAKICBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoKTsKICBkZWxheSgxMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/02-无返回值带参数函数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/02-无返回值带参数函数.mix new file mode 100644 index 00000000..43676283 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/02-无返回值带参数函数.mix @@ -0,0 +1 @@ +时间无返回值带参数函数声明函数使用可以简化程序,对于需要重复执行&#10;的程序一般需要封装为函数500切换状态11HIGH11delay1000时间dm9pZCBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoaW50IF9FNl85N19CNl9FOV85N19CNCkgewogIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwogIGRlbGF5KF9FNl85N19CNl9FOV85N19CNCk7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+aXoOi/lOWbnuWAvOW4puWPguaVsOWHveaVsOWjsOaYjgogIC8v5Ye95pWw5L2/55So5Y+v5Lul566A5YyW56iL5bqP77yM5a+55LqO6ZyA6KaB6YeN5aSN5omn6KGMCiAgLy/nmoTnqIvluo/kuIDoiKzpnIDopoHlsIHoo4XkuLrlh73mlbAKICBfRTVfODhfODdfRTZfOERfQTJfRTdfOEFfQjZfRTZfODBfODEoNTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/03-带返回值带参数函数声明.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/03-带返回值带参数函数声明.mix new file mode 100644 index 00000000..d1bf345b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/03-带返回值带参数函数声明.mix @@ -0,0 +1 @@ +数字1数字2带返回值带参数函数声明下面程序判断串口输入的数与100的关系SerialSerialprintln100toInt123Serial数字大小判断Stringlocal_variateitemStringEQ数字1数字2item两数相等GT数字1数字2item数字1大item数字2大itemU3RyaW5nIF9FNl85NV9CMF9FNV9BRF85N19FNV9BNF9BN19FNV9CMF84Rl9FNV84OF9BNF9FNl85Nl9BRChpbnQgX0U2Xzk1X0IwX0U1X0FEXzk3MSwgaW50IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICBTdHJpbmcgaXRlbSA9ICIiOwogIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID09IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICAgIGl0ZW0gPSAi5Lik5pWw55u4562JIjsKCiAgfSBlbHNlIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID4gX0U2Xzk1X0IwX0U1X0FEXzk3MikgewogICAgaXRlbSA9ICLmlbDlrZcx5aSnIjsKICB9IGVsc2UgewogICAgaXRlbSA9ICLmlbDlrZcy5aSnIjsKCiAgfQogIHJldHVybiBpdGVtOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+W4pui/lOWbnuWAvOW4puWPguaVsOWHveaVsOWjsOaYjgogIC8v5LiL6Z2i56iL5bqP5Yik5pat5Liy5Y+j6L6T5YWl55qE5pWw5LiOMTAw55qE5YWz57O7CiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIFNlcmlhbC5wcmludGxuKChfRTZfOTVfQjBfRTVfQURfOTdfRTVfQTRfQTdfRTVfQjBfOEZfRTVfODhfQTRfRTZfOTZfQUQoMTAwLCBTdHJpbmcoU2VyaWFsLnJlYWRTdHJpbmcoKSkudG9JbnQoKSkpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/04-多返回值带参数函数声明.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/04-多返回值带参数函数声明.mix new file mode 100644 index 00000000..76a9631b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/08-函数/04-多返回值带参数函数声明.mix @@ -0,0 +1 @@ +数字1数字2多返回值带参数函数声明下面程序判断串口输入的数与100的关系SerialSerialprintln100toInt123Serial数字大小判断StringEQ数字1数字2两数相等GT数字1数字2数字1大数字2大U3RyaW5nIF9FNl85NV9CMF9FNV9BRF85N19FNV9BNF9BN19FNV9CMF84Rl9FNV84OF9BNF9FNl85Nl9BRChpbnQgX0U2Xzk1X0IwX0U1X0FEXzk3MSwgaW50IF9FNl85NV9CMF9FNV9BRF85NzIpIHsKICBpZiAoX0U2Xzk1X0IwX0U1X0FEXzk3MSA9PSBfRTZfOTVfQjBfRTVfQURfOTcyKSB7CiAgICByZXR1cm4gIuS4pOaVsOebuOetiSI7CiAgfQogIGlmIChfRTZfOTVfQjBfRTVfQURfOTcxID4gX0U2Xzk1X0IwX0U1X0FEXzk3MikgewogICAgcmV0dXJuICLmlbDlrZcx5aSnIjsKICB9CiAgcmV0dXJuICLmlbDlrZcy5aSnIjsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/lpJrov5Tlm57lgLzluKblj4LmlbDlh73mlbDlo7DmmI4KICAvL+S4i+mdoueoi+W6j+WIpOaWreS4suWPo+i+k+WFpeeahOaVsOS4jjEwMOeahOWFs+ezuwogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICBTZXJpYWwucHJpbnRsbigoX0U2Xzk1X0IwX0U1X0FEXzk3X0U1X0E0X0E3X0U1X0IwXzhGX0U1Xzg4X0E0X0U2Xzk2X0FEKDEwMCwgU3RyaW5nKFNlcmlhbC5yZWFkU3RyaW5nKCkpLnRvSW50KCkpKSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/01-串口打印输出.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/01-串口打印输出.mix new file mode 100644 index 00000000..62fb30c6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/01-串口打印输出.mix @@ -0,0 +1 @@ +串口通讯需要满足波特率相同原始打印打印数字时输出是是阿斯克码字符,输入字符串时输出原字符串串口打印可以选择换行与否,为了数据可视化一般我们采用换行打印串口可以将10进制数或者其他进制数,转换为对应进制后,以字符串形式打印出来上传下列程序,更改不同波特率观察串口输出随机更改输出为字符串,字符等观察,寻找其规律串口初始化需要一点时间,因此延时一秒打印Serial9600delay1000Serial55SerialprintlnSerialprintln55SerialprintlnHEX055SerialprintlnBIN055SerialprintlnOCT055SerialprintlnDEC055dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBkZWxheSgxMDAwKTsKICBTZXJpYWwud3JpdGUoNTUpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBTZXJpYWwucHJpbnRsbig1NSk7CiAgU2VyaWFsLnByaW50bG4oNTUsSEVYKTsKICBTZXJpYWwucHJpbnRsbig1NSxCSU4pOwogIFNlcmlhbC5wcmludGxuKDU1LE9DVCk7CiAgU2VyaWFsLnByaW50bG4oNTUsREVDKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6PpgJrorq/pnIDopoHmu6HotrPms6Lnibnnjofnm7jlkIwKICAvL+WOn+Wni+aJk+WNsOaJk+WNsOaVsOWtl+aXtui+k+WHuuaYr+aYr+mYv+aWr+WFi+eggeWtl+espu+8jOi+k+WFpeWtl+espuS4suaXtui+k+WHuuWOn+Wtl+espuS4sgogIC8v5Liy5Y+j5omT5Y2w5Y+v5Lul6YCJ5oup5o2i6KGM5LiO5ZCm77yM5Li65LqG5pWw5o2u5Y+v6KeG5YyW5LiA6Iis5oiR5Lus6YeH55So5o2i6KGM5omT5Y2wCiAgLy/kuLLlj6Plj6/ku6XlsIYxMOi/m+WItuaVsOaIluiAheWFtuS7lui/m+WItuaVsO+8jOi9rOaNouS4uuWvueW6lOi/m+WItuWQju+8jOS7peWtl+espuS4suW9ouW8j+aJk+WNsOWHuuadpQogIC8v5LiK5Lyg5LiL5YiX56iL5bqP77yM5pu05pS55LiN5ZCM5rOi54m5546H6KeC5a+f5Liy5Y+j6L6T5Ye6CiAgLy/pmo/mnLrmm7TmlLnovpPlh7rkuLrlrZfnrKbkuLLvvIzlrZfnrKbnrYnop4Llr5/vvIzlr7vmib7lhbbop4TlvosKICAvL+S4suWPo+WIneWni+WMlumcgOimgeS4gOeCueaXtumXtO+8jOWboOatpOW7tuaXtuS4gOenkuaJk+WNsAoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入1.mix new file mode 100644 index 00000000..099d0af7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入1.mix @@ -0,0 +1 @@ +串口发送方式改为no上传下列程序,观察串口数据的输入与输出时间差是多少Serial9600Seriallocal_variate时间unsigned longmillisSerialprintlnSerialSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5LiK5Lyg5LiL5YiX56iL5bqP77yM6KeC5a+f5Liy5Y+j5pWw5o2u55qE6L6T5YWl5LiO6L6T5Ye65pe26Ze05beu5piv5aSa5bCRCgogIGlmIChTZXJpYWwuYXZhaWxhYmxlKCkgPiAwKSB7CiAgICB1bnNpZ25lZCBsb25nIF9FNl85N19CNl9FOV85N19CNCA9IG1pbGxpcygpOwogICAgU2VyaWFsLnByaW50bG4oU2VyaWFsLnJlYWRTdHJpbmcoKSk7CiAgICBTZXJpYWwucHJpbnRsbigobWlsbGlzKCkgLSBfRTZfOTdfQjZfRTlfOTdfQjQpKTsKCiAgfQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入2.mix new file mode 100644 index 00000000..bdadac30 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入2.mix @@ -0,0 +1 @@ +串口发送方式改为no分别上传一个带a结尾和不带a结尾的字符串,观察时间差异Serial9600Seriallocal_variate时间unsigned longmillisSerialprintlnSerialaSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5YiG5Yir5LiK5Lyg5LiA5Liq5bimYee7k+WwvuWSjOS4jeW4pmHnu5PlsL7nmoTlrZfnrKbkuLLvvIzop4Llr5/ml7bpl7Tlt67lvIIKCiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIHVuc2lnbmVkIGxvbmcgX0U2Xzk3X0I2X0U5Xzk3X0I0ID0gbWlsbGlzKCk7CiAgICBTZXJpYWwucHJpbnRsbihTZXJpYWwucmVhZFN0cmluZ1VudGlsKCdhJykpOwogICAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0KSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入3.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入3.mix new file mode 100644 index 00000000..451821c6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入3.mix @@ -0,0 +1 @@ +串口发送方式改为no串口直接读取的是阿斯克码值,因此需要转为可视字符上传程序寻找与前两次串口读取的差异Serial9600Seriallocal_variate时间unsigned longmillisSerialprintln223SerialreadSerialprintlnMINUS1millis1时间dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/kuLLlj6Plj5HpgIHmlrnlvI/mlLnkuLpubwogIC8v5Liy5Y+j55u05o6l6K+75Y+W55qE5piv6Zi/5pav5YWL56CB5YC877yM5Zug5q2k6ZyA6KaB6L2s5Li65Y+v6KeG5a2X56ymCiAgLy/kuIrkvKDnqIvluo/lr7vmib7kuI7liY3kuKTmrKHkuLLlj6Por7vlj5bnmoTlt67lvIIKCiAgaWYgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIHVuc2lnbmVkIGxvbmcgX0U2Xzk3X0I2X0U5Xzk3X0I0ID0gbWlsbGlzKCk7CiAgICBTZXJpYWwucHJpbnRsbihjaGFyKFNlcmlhbC5yZWFkKCkpKTsKICAgIFNlcmlhbC5wcmludGxuKChtaWxsaXMoKSAtIF9FNl85N19CNl9FOV85N19CNCkpOwoKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入4.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入4.mix new file mode 100644 index 00000000..1bc3895d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/02-串口输入4.mix @@ -0,0 +1 @@ +串口发送方式改为no思考此种方式接收串口数据的优点延时2毫秒能删除吗?改一改试试吧Serial9600串口输入Stringlocal_variate串口数据StringWHILETRUESerial串口数据Hello串口数据Mixly223Serialreaddelay2串口数据Seriallocal_variate时间unsigned longmillisSerialprintlnSerialprintlnMINUS1millis1时间U3RyaW5nIF9FNF9COF9CMl9FNV84Rl9BM19FOF9CRV85M19FNV84NV9BNSgpIHsKICBTdHJpbmcgX0U0X0I4X0IyX0U1XzhGX0EzX0U2Xzk1X0IwX0U2XzhEX0FFID0gIiI7CiAgd2hpbGUgKFNlcmlhbC5hdmFpbGFibGUoKSA+IDApIHsKICAgIF9FNF9COF9CMl9FNV84Rl9BM19FNl85NV9CMF9FNl84RF9BRSA9IFN0cmluZyhfRTRfQjhfQjJfRTVfOEZfQTNfRTZfOTVfQjBfRTZfOERfQUUpICsgU3RyaW5nKGNoYXIoU2VyaWFsLnJlYWQoKSkpOwogICAgZGVsYXkoMik7CiAgfQogIHJldHVybiBfRTRfQjhfQjJfRTVfOEZfQTNfRTZfOTVfQjBfRTZfOERfQUU7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5Liy5Y+j5Y+R6YCB5pa55byP5pS55Li6bm8KICAvL+aAneiAg+atpOenjeaWueW8j+aOpeaUtuS4suWPo+aVsOaNrueahOS8mOeCuQogIC8v5bu25pe2Muavq+enkuiDveWIoOmZpOWQl++8n+aUueS4gOaUueivleivleWQpwoKICBpZiAoU2VyaWFsLmF2YWlsYWJsZSgpID4gMCkgewogICAgdW5zaWduZWQgbG9uZyBfRTZfOTdfQjZfRTlfOTdfQjQgPSBtaWxsaXMoKTsKICAgIFNlcmlhbC5wcmludGxuKChfRTRfQjhfQjJfRTVfOEZfQTNfRThfQkVfOTNfRTVfODVfQTUoKSkpOwogICAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0KSk7CgogIH0KCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/03-串口发送等待.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/03-串口发送等待.mix new file mode 100644 index 00000000..44976760 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/03-串口发送等待.mix @@ -0,0 +1 @@ +Serial.flush()函数不具备清空缓存区的作用,其主要作用是串口发送数据时等待,&#10;直到串口数据发送完例如下面程序都发送了同一个字符串,各自打印的时间不一致可说明若要清空缓存区请重复读取串口,直到串口数据为空Serial9600local_variate时间1unsigned longmillisSerialprintlnhelloSerialprintlnMINUS1millis1时间1local_variate时间2unsigned longmillisSerialprintlnhelloSerialSerialprintlnMINUS1millis1时间2dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICB1bnNpZ25lZCBsb25nIF9FNl85N19CNl9FOV85N19CNDEgPSBtaWxsaXMoKTsKICBTZXJpYWwucHJpbnRsbigiaGVsbG8iKTsKICBTZXJpYWwucHJpbnRsbigobWlsbGlzKCkgLSBfRTZfOTdfQjZfRTlfOTdfQjQxKSk7CiAgdW5zaWduZWQgbG9uZyBfRTZfOTdfQjZfRTlfOTdfQjQyID0gbWlsbGlzKCk7CiAgU2VyaWFsLnByaW50bG4oImhlbGxvIik7CiAgU2VyaWFsLmZsdXNoKCk7CiAgU2VyaWFsLnByaW50bG4oKG1pbGxpcygpIC0gX0U2Xzk3X0I2X0U5Xzk3X0I0MikpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL1NlcmlhbC5mbHVzaCgp5Ye95pWw5LiN5YW35aSH5riF56m657yT5a2Y5Yy655qE5L2c55So77yM5YW25Li76KaB5L2c55So5piv5Liy5Y+j5Y+R6YCB5pWw5o2u5pe2562J5b6F77yMCiAgLy/nm7TliLDkuLLlj6PmlbDmja7lj5HpgIHlrowKICAvL+S+i+WmguS4i+mdoueoi+W6j+mDveWPkemAgeS6huWQjOS4gOS4quWtl+espuS4su+8jOWQhOiHquaJk+WNsOeahOaXtumXtOS4jeS4gOiHtOWPr+ivtOaYjgogIC8v6Iul6KaB5riF56m657yT5a2Y5Yy66K+36YeN5aSN6K+75Y+W5Liy5Y+j77yM55u05Yiw5Liy5Y+j5pWw5o2u5Li656m6Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/04-串口中断.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/04-串口中断.mix new file mode 100644 index 00000000..fc8b32de --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/04-串口中断.mix @@ -0,0 +1 @@ +此处的串口中断并非是真正的串口中断,上传下面程序查看结果可知串口中断会在loop函数执行完运行一次 ,会受到其他函数的影响,一般不使用此功能Serial9600SerialSerialprintlnSerialdelay5000dm9pZCBzZXJpYWxFdmVudCgpIHsKICBTZXJpYWwucHJpbnRsbihTZXJpYWwucmVhZFN0cmluZygpKTsKfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/mraTlpITnmoTkuLLlj6PkuK3mlq3lubbpnZ7mmK/nnJ/mraPnmoTkuLLlj6PkuK3mlq3vvIzkuIrkvKDkuIvpnaLnqIvluo/mn6XnnIvnu5Pmnpzlj6/nn6UKICAvL+S4suWPo+S4reaWreS8muWcqGxvb3Dlh73mlbDmiafooYzlrozov5DooYzkuIDmrKEg77yM5Lya5Y+X5Yiw5YW25LuW5Ye95pWw55qE5b2x5ZON77yM5LiA6Iis5LiN5L2/55So5q2k5Yqf6IO9CgogIGRlbGF5KDUwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/05-软串口的使用.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/05-软串口的使用.mix new file mode 100644 index 00000000..2803f01b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/09-串口/05-软串口的使用.mix @@ -0,0 +1 @@ +硬件串口在程序上传时会被占用,若外接其他模块可能会导致无法 上传程序&#10;因此一般不做额外用途,仅用来调试程序,当我们要使用其他串口类模块时,&#10;一般使用软串口,软串口能将任意数字输出引脚当做串口来使用,例如下列程序&#10;定义了2和3为软串口,,软串口每隔一秒发送一个数据,硬件串口收到数据时打印&#10;该数据,同时11号管脚LED切换状态。串口通讯波特率必须一致,软串口能使用的波特率一般不超过115200,超过可能导致&#10;异常,用一根双公头杜邦线接入3与RX(0)引脚,观察现象用另一块板子上传相同程序,分别把己方的3号管脚接入对方的RX,观察现象&#10;注意把两块板子的GND连接到一起说说软串口与硬件串口的区别mySerial23mySerial9600SerialSerialprintlnSeriala11HIGH1111000mySerialprint1aCiNpbmNsdWRlIDxTb2Z0d2FyZVNlcmlhbC5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KClNvZnR3YXJlU2VyaWFsIG15U2VyaWFsKDIsMyk7ClNpbXBsZVRpbWVyIHRpbWVyOwoKdm9pZCBTaW1wbGVfdGltZXJfMSgpIHsKICBteVNlcmlhbC5wcmludCgiMWEiKTsKfQoKdm9pZCBzZXR1cCgpewogIG15U2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwogIHRpbWVyLnNldEludGVydmFsKDEwMDBMLCBTaW1wbGVfdGltZXJfMSk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL+ehrOS7tuS4suWPo+WcqOeoi+W6j+S4iuS8oOaXtuS8muiiq+WNoOeUqO+8jOiLpeWkluaOpeWFtuS7luaooeWdl+WPr+iDveS8muWvvOiHtOaXoOazlSDkuIrkvKDnqIvluo8KICAvL+WboOatpOS4gOiIrOS4jeWBmumineWklueUqOmAlO+8jOS7heeUqOadpeiwg+ivleeoi+W6j++8jOW9k+aIkeS7rOimgeS9v+eUqOWFtuS7luS4suWPo+exu+aooeWdl+aXtu+8jAogIC8v5LiA6Iis5L2/55So6L2v5Liy5Y+j77yM6L2v5Liy5Y+j6IO95bCG5Lu75oSP5pWw5a2X6L6T5Ye65byV6ISa5b2T5YGa5Liy5Y+j5p2l5L2/55So77yM5L6L5aaC5LiL5YiX56iL5bqPCiAgLy/lrprkuYnkuoYy5ZKMM+S4uui9r+S4suWPo++8jO+8jOi9r+S4suWPo+avj+malOS4gOenkuWPkemAgeS4gOS4quaVsOaNru+8jOehrOS7tuS4suWPo+aUtuWIsOaVsOaNruaXtuaJk+WNsAogIC8v6K+l5pWw5o2u77yM5ZCM5pe2MTHlj7fnrqHohJpMRUTliIfmjaLnirbmgIHjgIIKICAvL+S4suWPo+mAmuiur+azoueJueeOh+W/hemhu+S4gOiHtO+8jOi9r+S4suWPo+iDveS9v+eUqOeahOazoueJueeOh+S4gOiIrOS4jei2hei/hzExNTIwMO+8jOi2hei/h+WPr+iDveWvvOiHtAogIC8v5byC5bi477yM55So5LiA5qC55Y+M5YWs5aS05p2c6YKm57q/5o6l5YWlM+S4jlJY77yIMO+8ieW8leiEmu+8jOinguWvn+eOsOixoQogIC8v55So5Y+m5LiA5Z2X5p2/5a2Q5LiK5Lyg55u45ZCM56iL5bqP77yM5YiG5Yir5oqK5bex5pa555qEM+WPt+euoeiEmuaOpeWFpeWvueaWueeahFJY77yM6KeC5a+f546w6LGhCiAgLy/ms6jmhI/miorkuKTlnZfmnb/lrZDnmoRHTkTov57mjqXliLDkuIDotbcKICAvL+ivtOivtOi9r+S4suWPo+S4juehrOS7tuS4suWPo+eahOWMuuWIqwoKICBpZiAoU2VyaWFsLmF2YWlsYWJsZSgpID4gMCkgewogICAgU2VyaWFsLnByaW50bG4oU2VyaWFsLnJlYWRTdHJpbmdVbnRpbCgnYScpKTsKICAgIGRpZ2l0YWxXcml0ZSgxMSwoIWRpZ2l0YWxSZWFkKDExKSkpOwoKICB9CgogIHRpbWVyLnJ1bigpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/01-超声波测距.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/01-超声波测距.mix new file mode 100644 index 00000000..6bf10386 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/01-超声波测距.mix @@ -0,0 +1 @@ +超声波测距注意超声波模块的使用电平,某些型号有逻辑电平&#10;要求,如3.3V,5V等,按要求使用Serialprintln23delay100ZmxvYXQgY2hlY2tkaXN0YW5jZV8yXzMoKSB7CiAgZGlnaXRhbFdyaXRlKDIsIExPVyk7CiAgZGVsYXlNaWNyb3NlY29uZHMoMik7CiAgZGlnaXRhbFdyaXRlKDIsIEhJR0gpOwogIGRlbGF5TWljcm9zZWNvbmRzKDEwKTsKICBkaWdpdGFsV3JpdGUoMiwgTE9XKTsKICBmbG9hdCBkaXN0YW5jZSA9IHB1bHNlSW4oMywgSElHSCkgLyA1OC4wMDsKICBkZWxheSgxMCk7CiAgcmV0dXJuIGRpc3RhbmNlOwp9Cgp2b2lkIHNldHVwKCl7CiAgcGluTW9kZSgyLCBPVVRQVVQpOwogIHBpbk1vZGUoMywgSU5QVVQpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/otoXlo7Dms6LmtYvot50KICAvL+azqOaEj+i2heWjsOazouaooeWdl+eahOS9v+eUqOeUteW5s++8jOafkOS6m+Wei+WPt+aciemAu+i+keeUteW5swogIC8v6KaB5rGC77yM5aaCMy4zVu+8jDVW562J77yM5oyJ6KaB5rGC5L2/55SoCiAgU2VyaWFsLnByaW50bG4oY2hlY2tkaXN0YW5jZV8yXzMoKSk7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/02-获取DHT11温湿度.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/02-获取DHT11温湿度.mix new file mode 100644 index 00000000..0c0beea7 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/02-获取DHT11温湿度.mix @@ -0,0 +1 @@ +获取温湿度Serialprintln112temperatureSerialprintln112humiditySerialprintlndelay100CiNpbmNsdWRlIDxESFQuaD4KCkRIVCBkaHQyKDIsIDExKTsKCnZvaWQgc2V0dXAoKXsKICAgZGh0Mi5iZWdpbigpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5bmuKnmub/luqYKICBTZXJpYWwucHJpbnRsbihkaHQyLnJlYWRUZW1wZXJhdHVyZSgpKTsKICBTZXJpYWwucHJpbnRsbihkaHQyLnJlYWRIdW1pZGl0eSgpKTsKICBTZXJpYWwucHJpbnRsbigiIik7CiAgZGVsYXkoMTAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/03-获取LM35温度.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/03-获取LM35温度.mix new file mode 100644 index 00000000..8a3f0d88 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/03-获取LM35温度.mix @@ -0,0 +1 @@ +获取LM35温度SerialprintlnA0delay100dm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5ZMTTM15rip5bqmCiAgU2VyaWFsLnByaW50bG4oYW5hbG9nUmVhZChBMCkqMC40ODgpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/04-获取DS18B20温度.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/04-获取DS18B20温度.mix new file mode 100644 index 00000000..335625c0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/04-获取DS18B20温度.mix @@ -0,0 +1 @@ +获取DS18B20温度Serialprintln20delay100CiNpbmNsdWRlIDxPbmVXaXJlLmg+CiNpbmNsdWRlIDxEYWxsYXNUZW1wZXJhdHVyZS5oPgoKT25lV2lyZSBvbmVXaXJlXzIoMik7CkRhbGxhc1RlbXBlcmF0dXJlIHNlbnNvcnNfMigmb25lV2lyZV8yKTsKRGV2aWNlQWRkcmVzcyBpbnNpZGVUaGVybW9tZXRlcjsKCmZsb2F0IGRzMThiMjBfMl9nZXRUZW1wKGludCB3KSB7CiAgc2Vuc29yc18yLnJlcXVlc3RUZW1wZXJhdHVyZXMoKTsKICBpZih3PT0wKSB7CiAgICByZXR1cm4gc2Vuc29yc18yLmdldFRlbXBDKGluc2lkZVRoZXJtb21ldGVyKTsKICB9CiAgZWxzZSB7CiAgICByZXR1cm4gc2Vuc29yc18yLmdldFRlbXBGKGluc2lkZVRoZXJtb21ldGVyKTsKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBzZW5zb3JzXzIuZ2V0QWRkcmVzcyhpbnNpZGVUaGVybW9tZXRlciwgMCk7CiAgc2Vuc29yc18yLnNldFJlc29sdXRpb24oaW5zaWRlVGhlcm1vbWV0ZXIsIDkpOwogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgLy/ojrflj5ZEUzE4QjIw5rip5bqmCiAgU2VyaWFsLnByaW50bG4oZHMxOGIyMF8yX2dldFRlbXAoMCkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/05-获取BME280参数.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/05-获取BME280参数.mix new file mode 100644 index 00000000..73bd5cac --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/05-获取BME280参数.mix @@ -0,0 +1 @@ +获取BME280参数使用默认iic接口,工具分类查看开发板IO图查看对应接口SerialprintlnbmereadTemperature()0x77SerialprintlnbmereadHumidity()0x77SerialprintlnbmereadPressure()0x77SerialprintlnbmereadAltitude(SEALEVELPRESSURE_HPA)0x77Serialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxTUEkuaD4KI2luY2x1ZGUgPEFkYWZydWl0X1NlbnNvci5oPgojaW5jbHVkZSA8QWRhZnJ1aXRfQk1FMjgwLmg+CiNkZWZpbmUgU0VBTEVWRUxQUkVTU1VSRV9IUEEgKDEwMTMuMjUpCgpBZGFmcnVpdF9CTUUyODAgYm1lOwoKdm9pZCBzZXR1cCgpewogIHVuc2lnbmVkIHN0YXR1czsKICBzdGF0dXMgPSBibWUuYmVnaW4oMHg3Nyk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPlkJNRTI4MOWPguaVsAogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBTZXJpYWwucHJpbnRsbihibWUucmVhZFRlbXBlcmF0dXJlKCkpOwogIFNlcmlhbC5wcmludGxuKGJtZS5yZWFkSHVtaWRpdHkoKSk7CiAgU2VyaWFsLnByaW50bG4oYm1lLnJlYWRQcmVzc3VyZSgpKTsKICBTZXJpYWwucHJpbnRsbihibWUucmVhZEFsdGl0dWRlKFNFQUxFVkVMUFJFU1NVUkVfSFBBKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/06-获取SHT20温湿度.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/06-获取SHT20温湿度.mix new file mode 100644 index 00000000..0736fbe3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/06-获取SHT20温湿度.mix @@ -0,0 +1 @@ +获取SHT20温湿度使用默认iic接口,工具分类查看开发板IO图查看对应接口Serialprintlnsht20.readTemperature()Serialprintlnsht20.readHumidity()Serialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxERlJvYm90X1NIVDIwLmg+CgpERlJvYm90X1NIVDIwIHNodDIwOwoKdm9pZCBzZXR1cCgpewogIHNodDIwLmluaXRTSFQyMCgpOwogIHNodDIwLmNoZWNrU0hUMjAoKTsKCiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL+iOt+WPllNIVDIw5rip5rm/5bqmCiAgLy/kvb/nlKjpu5jorqRpaWPmjqXlj6PvvIzlt6XlhbfliIbnsbvmn6XnnIvlvIDlj5Hmnb9JT+Wbvuafpeeci+WvueW6lOaOpeWPowogIFNlcmlhbC5wcmludGxuKHNodDIwLnJlYWRUZW1wZXJhdHVyZSgpKTsKICBTZXJpYWwucHJpbnRsbihzaHQyMC5yZWFkSHVtaWRpdHkoKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/07-BMLX90614红外温度测量.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/07-BMLX90614红外温度测量.mix new file mode 100644 index 00000000..c8cdcf3d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/07-BMLX90614红外温度测量.mix @@ -0,0 +1 @@ +BMLX90614红外温度测量使用默认iic接口,工具分类查看开发板IO图查看对应接口0x5ASerialprintlnreadObjectTempCdelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxBZGFmcnVpdF9NTFg5MDYxNC5oPgoKQWRhZnJ1aXRfTUxYOTA2MTQgTUxYID0gQWRhZnJ1aXRfTUxYOTA2MTQoMHg1QSk7Cgp2b2lkIHNldHVwKCl7CiAgTUxYLmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL0JNTFg5MDYxNOe6ouWklua4qeW6pua1i+mHjwogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBTZXJpYWwucHJpbnRsbihNTFgucmVhZE9iamVjdFRlbXBDKCkpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/08-tcs34725颜色提取.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/08-tcs34725颜色提取.mix new file mode 100644 index 00000000..7734e6be --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/08-tcs34725颜色提取.mix @@ -0,0 +1 @@ +tcs34725颜色提取使用默认iic接口,工具分类查看开发板IO图查看对应接口Serialprintlntcs34725.getRedToGamma()Serialprintlntcs34725.getGreenToGamma()Serialprintlntcs34725.getBlueToGamma()Serialprintlndelay100CiNpbmNsdWRlIDxERlJvYm90X1RDUzM0NzI1Lmg+CgpERlJvYm90X1RDUzM0NzI1IHRjczM0NzI1OwoKdm9pZCBzZXR1cCgpewogIHRjczM0NzI1LmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3RjczM0NzI16aKc6Imy5o+Q5Y+WCiAgLy/kvb/nlKjpu5jorqRpaWPmjqXlj6PvvIzlt6XlhbfliIbnsbvmn6XnnIvlvIDlj5Hmnb9JT+Wbvuafpeeci+WvueW6lOaOpeWPowogIFNlcmlhbC5wcmludGxuKHRjczM0NzI1LmdldFJlZFRvR2FtbWEoKSk7CiAgU2VyaWFsLnByaW50bG4odGNzMzQ3MjUuZ2V0R3JlZW5Ub0dhbW1hKCkpOwogIFNlcmlhbC5wcmludGxuKHRjczM0NzI1LmdldEJsdWVUb0dhbW1hKCkpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/09-tcs230颜色提取.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/09-tcs230颜色提取.mix new file mode 100644 index 00000000..915b8ce0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/09-tcs230颜色提取.mix @@ -0,0 +1 @@ +tcs230颜色提取234567SerialprintlnRSerialprintlnGSerialprintlnBSerialprintlndelay100I2RlZmluZSB0Y3MyMzBfUzAgMgojZGVmaW5lIHRjczIzMF9TMSAzCiNkZWZpbmUgdGNzMjMwX1MyIDQKI2RlZmluZSB0Y3MyMzBfUzMgNQojZGVmaW5lIHRjczIzMF9zZW5zb3JPdXQgNwojZGVmaW5lIHRjczIzMF9MRUQgNgoKLy9UQ1MyMzDpopzoibLkvKDmhJ/lmajojrflj5ZSR0LlgLwKaW50IHRjczIzMF9HZXRjb2xvcihjaGFyIGRhdGEpCnsKICBpbnQgZnJlcXVlbmN5ID0gMDsKICBzd2l0Y2goZGF0YSkKICB7CiAgICBjYXNlICdSJzoKICAgIHsKICAgICAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMixMT1cpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IHB1bHNlSW4odGNzMjMwX3NlbnNvck91dCwgTE9XKTsKICAgICAgZnJlcXVlbmN5ID0gbWFwKGZyZXF1ZW5jeSwgMjUsIDcyLCAyNTUsIDApOwogICAgICBicmVhazsKICAgIH0KICAgIGNhc2UgJ0cnOgogICAgewogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MyLEhJR0gpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLEhJR0gpOwogICAgICBmcmVxdWVuY3kgPSBwdWxzZUluKHRjczIzMF9zZW5zb3JPdXQsIExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IG1hcChmcmVxdWVuY3ksIDMwLCA5MCwgMjU1LCAwKTsKICAgICAgYnJlYWs7CiAgICB9CiAgICBjYXNlICdCJzoKICAgIHsKICAgICAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMixMT1cpOwogICAgICBkaWdpdGFsV3JpdGUodGNzMjMwX1MzLEhJR0gpOwogICAgICBmcmVxdWVuY3kgPSBwdWxzZUluKHRjczIzMF9zZW5zb3JPdXQsIExPVyk7CiAgICAgIGZyZXF1ZW5jeSA9IG1hcChmcmVxdWVuY3ksIDI1LCA3MCwgMjU1LCAwKTsKICAgICAgYnJlYWs7CiAgICB9CiAgICBkZWZhdWx0OgogICAgICByZXR1cm4gLTE7CiAgfQogIGlmIChmcmVxdWVuY3kgPCAwKQogICAgZnJlcXVlbmN5ID0gMDsKICBpZiAoZnJlcXVlbmN5ID4gMjU1KQogICAgZnJlcXVlbmN5ID0gMjU1OwogIHJldHVybiBmcmVxdWVuY3k7Cn0KCnZvaWQgc2V0dXAoKXsKICBwaW5Nb2RlKHRjczIzMF9TMCwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMSwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMiwgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9TMywgT1VUUFVUKTsKICBwaW5Nb2RlKHRjczIzMF9MRUQsIE9VVFBVVCk7CiAgcGluTW9kZSh0Y3MyMzBfc2Vuc29yT3V0LCBJTlBVVCk7CiAgZGlnaXRhbFdyaXRlKHRjczIzMF9TMCxISUdIKTsKICBkaWdpdGFsV3JpdGUodGNzMjMwX1MxLExPVyk7CiAgZGlnaXRhbFdyaXRlKHRjczIzMF9MRUQsSElHSCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL3RjczIzMOminOiJsuaPkOWPlgogIFNlcmlhbC5wcmludGxuKHRjczIzMF9HZXRjb2xvcignUicpKTsKICBTZXJpYWwucHJpbnRsbih0Y3MyMzBfR2V0Y29sb3IoJ0cnKSk7CiAgU2VyaWFsLnByaW50bG4odGNzMjMwX0dldGNvbG9yKCdCJykpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKICBkZWxheSgxMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/10-MPU6050陀螺仪.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/10-MPU6050陀螺仪.mix new file mode 100644 index 00000000..1a3313a5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/10-MPU6050陀螺仪.mix @@ -0,0 +1 @@ +MPU6050陀螺仪使用默认iic接口,工具分类查看开发板IO图查看对应接口1100SerialprintlngetAccX()SerialprintlngetAccY()SerialprintlngetAccZ()SerialprintlngetAngleX()SerialprintlngetAngleY()SerialprintlngetAngleZ()SerialprintlngetTemp()SerialprintlnCiNpbmNsdWRlIDxNUFU2MDUwX3RvY2tuLmg+CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKTVBVNjA1MCBtcHU2MDUwKFdpcmUpOwpTaW1wbGVUaW1lciB0aW1lcjsKCnZvaWQgU2ltcGxlX3RpbWVyXzEoKSB7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBY2NYKCkpOwogIFNlcmlhbC5wcmludGxuKG1wdTYwNTAuZ2V0QWNjWSgpKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldEFjY1ooKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVgoKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVkoKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRBbmdsZVooKSk7CiAgU2VyaWFsLnByaW50bG4obXB1NjA1MC5nZXRUZW1wKCkpOwogIFNlcmlhbC5wcmludGxuKCIiKTsKfQoKdm9pZCBzZXR1cCgpewogIFdpcmUuYmVnaW4oKTsKICBtcHU2MDUwLmJlZ2luKCk7CiAgbXB1NjA1MC5jYWxjR3lyb09mZnNldHModHJ1ZSk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIHRpbWVyLnNldEludGVydmFsKDEwMEwsIFNpbXBsZV90aW1lcl8xKTsKCn0KCnZvaWQgbG9vcCgpewogIC8vTVBVNjA1MOmZgOieuuS7qgogIC8v5L2/55So6buY6K6kaWlj5o6l5Y+j77yM5bel5YW35YiG57G75p+l55yL5byA5Y+R5p2/SU/lm77mn6XnnIvlr7nlupTmjqXlj6MKICBtcHU2MDUwLnVwZGF0ZSgpOwoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/11-MPU9250加速度传感器.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/11-MPU9250加速度传感器.mix new file mode 100644 index 00000000..2d39d842 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/10-传感器/11-MPU9250加速度传感器.mix @@ -0,0 +1 @@ +MPU9250加速度传感器使用默认iic接口,工具分类查看开发板IO图查看对应接口SerialprintlnaSerialprintlnbSerialprintlncSerialprintlndSerialprintlneSerialprintlnfSerialprintlngSerialprintlnhSerialprintlniSerialprintlndelay100CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxGYUJvOUF4aXNfTVBVOTI1MC5oPgoKRmFCbzlBeGlzIGZhYm9fOWF4aXM7CiBmbG9hdCBheCxheSxheixneCxneSxneixteCxteSxtejsKCnZvaWQgc2V0dXAoKXsKICBmYWJvXzlheGlzLmJlZ2luKCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwp9Cgp2b2lkIGxvb3AoKXsKICAvL01QVTkyNTDliqDpgJ/luqbkvKDmhJ/lmagKICAvL+S9v+eUqOm7mOiupGlpY+aOpeWPo++8jOW3peWFt+WIhuexu+afpeeci+W8gOWPkeadv0lP5Zu+5p+l55yL5a+55bqU5o6l5Y+jCiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkQWNjZWxYKCkpOwogIFNlcmlhbC5wcmludGxuKGZhYm9fOWF4aXMucmVhZEFjY2VsWSgpKTsKICBTZXJpYWwucHJpbnRsbihmYWJvXzlheGlzLnJlYWRBY2NlbFooKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1goKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1koKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkR3lyb1ooKSk7CiAgU2VyaWFsLnByaW50bG4oZmFib185YXhpcy5yZWFkTWFnbmV0WCgpKTsKICBTZXJpYWwucHJpbnRsbihmYWJvXzlheGlzLnJlYWRNYWduZXRZKCkpOwogIFNlcmlhbC5wcmludGxuKGZhYm9fOWF4aXMucmVhZE1hZ25ldFooKSk7CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/01-红外数据接收.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/01-红外数据接收.mix new file mode 100644 index 00000000..ad63e666 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/01-红外数据接收.mix @@ -0,0 +1 @@ +红外接收,接收的数据为16进制数字,可以通过串口打印获取其编码与数据&#10;通过对比接收到的数据是否等于某一数值执行某一程序,例如下方通过接收特定&#10;数字切换LED状态ir_item9SerialprintlnHEXir_itemEQir_item0xFFA25D11HIGH11CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKbG9uZyBpcl9pdGVtOwpJUnJlY3YgaXJyZWN2XzkoOSk7CmRlY29kZV9yZXN1bHRzIHJlc3VsdHNfOTsKCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgcGluTW9kZSgxMSwgT1VUUFVUKTsKICBpcnJlY3ZfOS5lbmFibGVJUkluKCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v57qi5aSW5o6l5pS277yM5o6l5pS255qE5pWw5o2u5Li6MTbov5vliLbmlbDlrZfvvIzlj6/ku6XpgJrov4fkuLLlj6PmiZPljbDojrflj5blhbbnvJbnoIHkuI7mlbDmja4KICAvL+mAmui/h+WvueavlOaOpeaUtuWIsOeahOaVsOaNruaYr+WQpuetieS6juafkOS4gOaVsOWAvOaJp+ihjOafkOS4gOeoi+W6j++8jOS+i+WmguS4i+aWuemAmui/h+aOpeaUtueJueWumgogIC8v5pWw5a2X5YiH5o2iTEVE54q25oCBCiAgaWYgKGlycmVjdl85LmRlY29kZSgmcmVzdWx0c185KSkgewogICAgaXJfaXRlbT1yZXN1bHRzXzkudmFsdWU7CiAgICBTdHJpbmcgdHlwZT0iVU5LTk9XTiI7CiAgICBTdHJpbmcgdHlwZWxpc3RbMThdPXsiVU5VU0VEIiwgIlJDNSIsICJSQzYiLCAiTkVDIiwgIlNPTlkiLCAiUEFOQVNPTklDIiwgIkpWQyIsICJTQU1TVU5HIiwgIldIWU5URVIiLCAiQUlXQV9SQ19UNTAxIiwgIkxHIiwgIlNBTllPIiwgIk1JVFNVQklTSEkiLCAiRElTSCIsICJTSEFSUCIsICJERU5PTiIsICJQUk9OVE8iLCAiTEVHT19QRiJ9OwogICAgaWYocmVzdWx0c185LmRlY29kZV90eXBlPj0xJiZyZXN1bHRzXzkuZGVjb2RlX3R5cGU8PTE3KXsKICAgICAgdHlwZT10eXBlbGlzdFtyZXN1bHRzXzkuZGVjb2RlX3R5cGVdOwogICAgfQogICAgU2VyaWFsLnByaW50bG4oIklSIFRZUEU6Iit0eXBlKyIgICIpOwogICAgU2VyaWFsLnByaW50bG4oaXJfaXRlbSxIRVgpOwogICAgaWYgKGlyX2l0ZW0gPT0gMHhGRkEyNUQpIHsKICAgICAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CgogICAgfQogICAgaXJyZWN2XzkucmVzdW1lKCk7CiAgfSBlbHNlIHsKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/02-红外数据发送.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/02-红外数据发送.mix new file mode 100644 index 00000000..7688a61f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/02-红外数据发送.mix @@ -0,0 +1 @@ +红外数据发送,,对已知编码与数据的红外信号进行 发送,例如将&#10;上一例红外接收,编写如下程序可让一块板子控制另一块板子比特数一般默认ir_item9SerialprintlnHEXir_itemEQir_item0xFFA25D11HIGH1111000NEC30xFFA25D32CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpJUnNlbmQgaXJzZW5kOwoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlyc2VuZC5zZW5kTkVDKDB4RkZBMjVELDMyKTsKfQoKdm9pZCBzZXR1cCgpewogIHRpbWVyLnNldEludGVydmFsKDEwMDBMLCBTaW1wbGVfdGltZXJfMSk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL+e6ouWkluaVsOaNruWPkemAge+8jO+8jOWvueW3suefpee8lueggeS4juaVsOaNrueahOe6ouWkluS/oeWPt+i/m+ihjCDlj5HpgIHvvIzkvovlpoLlsIYKICAvL+S4iuS4gOS+i+e6ouWkluaOpeaUtu+8jOe8luWGmeWmguS4i+eoi+W6j+WPr+iuqeS4gOWdl+adv+WtkOaOp+WItuWPpuS4gOWdl+adv+WtkAogIC8v5q+U54m55pWw5LiA6Iis6buY6K6kCgogIHRpbWVyLnJ1bigpOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/03-红外数据模拟收发.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/03-红外数据模拟收发.mix new file mode 100644 index 00000000..a342c1d2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/13-通信/03-红外数据模拟收发.mix @@ -0,0 +1 @@ +红外解码与发送案例2&#10;一些特殊设备如空调电视等,我们可以先获取编码,仅上传一次按下&#10;普通红外按键,串口打印其接收的数组,记录下该数组长度与数据,即可通过&#10;红外数据发送器模拟红外信号控制其他设备比特数一般默认上传一次后禁用91获取编码后启用10003904,9350,4450,700,500,650,500,650,500,650,500,650,500,650,500,650,500,650,500,650,1600,650,1600,650,1600,700,1550,700,1550,700,1550,700,1600,650,1600,650,1600,650,550,600,1650,600,550,600,550,600,550,600,1650,600,550,600,550,600,1650,650,500,650,1600,650,1650,600,1650,600,550,600,1650,6006838CiNpbmNsdWRlIDxJUnJlbW90ZS5oPgoKI2luY2x1ZGUgPFNpbXBsZVRpbWVyLmg+CgpJUnNlbmQgaXJzZW5kOwoKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIHVuc2lnbmVkIGludCBidWZfcmF3WzY4XT17OTA0LDkzNTAsNDQ1MCw3MDAsNTAwLDY1MCw1MDAsNjUwLDUwMCw2NTAsNTAwLDY1MCw1MDAsNjUwLDUwMCw2NTAsNTAwLDY1MCw1MDAsNjUwLDE2MDAsNjUwLDE2MDAsNjUwLDE2MDAsNzAwLDE1NTAsNzAwLDE1NTAsNzAwLDE1NTAsNzAwLDE2MDAsNjUwLDE2MDAsNjUwLDE2MDAsNjUwLDU1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCw1NTAsNjAwLDU1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCw1NTAsNjAwLDE2NTAsNjUwLDUwMCw2NTAsMTYwMCw2NTAsMTY1MCw2MDAsMTY1MCw2MDAsNTUwLDYwMCwxNjUwLDYwMH07CiAgaXJzZW5kLnNlbmRSYXcoYnVmX3Jhdyw2OCwzOCk7Cn0KCnZvaWQgc2V0dXAoKXsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgLy/nuqLlpJbop6PnoIHkuI7lj5HpgIHmoYjkvosyCiAgLy/kuIDkupvnibnmrororr7lpIflpoLnqbrosIPnlLXop4bnrYnvvIzmiJHku6zlj6/ku6XlhYjojrflj5bnvJbnoIHvvIzku4XkuIrkvKDkuIDmrKHmjInkuIsKICAvL+aZrumAmue6ouWkluaMiemUru+8jOS4suWPo+aJk+WNsOWFtuaOpeaUtueahOaVsOe7hO+8jOiusOW9leS4i+ivpeaVsOe7hOmVv+W6puS4juaVsOaNru+8jOWNs+WPr+mAmui/hwogIC8v57qi5aSW5pWw5o2u5Y+R6YCB5Zmo5qih5ouf57qi5aSW5L+h5Y+35o6n5Yi25YW25LuW6K6+5aSHCiAgLy/mr5TnibnmlbDkuIDoiKzpu5jorqQKCiAgLy8g6I635Y+W57yW56CB5ZCO5ZCv55SoCiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/01-SD卡读写测试.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/01-SD卡读写测试.mix new file mode 100644 index 00000000..d274d083 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/01-SD卡读写测试.mix @@ -0,0 +1 @@ +打印SD卡参数与读写测试SD卡拥有超大的存储容量,一般用来保存检测传感器数据与系统参数&#10;如温湿度数据等,通常保存的数据要加上时间戳1112134SerialprintlnSerialprintlnvolume.blocksPerCluster()*volume.clusterCount()/2/1024/1024.0fileName.txtSerialprintlnfileName.txtfileName.txthello worldTRUEfileName.txtCiNpbmNsdWRlIDxTRC5oPgojaW5jbHVkZSA8U1BJLmg+CgpTZDJDYXJkIGNhcmQ7ClNkVm9sdW1lIHZvbHVtZTsKU2RGaWxlIHJvb3Q7CkZpbGUgZGF0YWZpbGU7ClN0cmluZyBTRF9jYXJkX3JlYWRpbmcoU3RyaW5nIHBhdGgpIHsKZGF0YWZpbGUgPSBTRC5vcGVuKHBhdGgpOwogU3RyaW5nIHNkX2RhdGEgPSAiIjsKIHdoaWxlIChkYXRhZmlsZS5hdmFpbGFibGUoKSkgewogIHNkX2RhdGEgPSBTdHJpbmcoc2RfZGF0YSkgKyBTdHJpbmcoY2hhcihkYXRhZmlsZS5yZWFkKCkpKTsKIH0KICByZXR1cm4gc2RfZGF0YTsKfQoKdm9pZCBzZXR1cCgpewogIFNELmJlZ2luKDQpOwogIGNhcmQuaW5pdChTUElfSEFMRl9TUEVFRCwgNCk7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIHZvbHVtZS5pbml0KGNhcmQpOwogIFNlcmlhbC5wcmludGxuKGNhcmQudHlwZSgpKTsKICBTZXJpYWwucHJpbnRsbih2b2x1bWUuYmxvY2tzUGVyQ2x1c3RlcigpKnZvbHVtZS5jbHVzdGVyQ291bnQoKS8yLzEwMjQvMTAyNC4wKTsKICByb290Lm9wZW5Sb290KHZvbHVtZSk7CiAgcm9vdC5scyhMU19SIHwgTFNfREFURSB8IExTX1NJWkUpO2lmIChTRC5leGlzdHMoImZpbGVOYW1lLnR4dCIpKSB7CiAgICBTZXJpYWwucHJpbnRsbihTRF9jYXJkX3JlYWRpbmcoImZpbGVOYW1lLnR4dCIpKTsKCiAgfQogIGRhdGFmaWxlID0gU0Qub3BlbigiZmlsZU5hbWUudHh0IiwgRklMRV9XUklURSk7CiAgaWYoZGF0YWZpbGUpewogIAlkYXRhZmlsZS5wcmludCgiaGVsbG8gd29ybGQiKTsKICAJZGF0YWZpbGUucHJpbnRsbigiIik7CiAgCWRhdGFmaWxlLmNsb3NlKCk7CiAgfQp9Cgp2b2lkIGxvb3AoKXsKICAvL+aJk+WNsFNE5Y2h5Y+C5pWw5LiO6K+75YaZ5rWL6K+VCiAgLy9TROWNoeaLpeaciei2heWkp+eahOWtmOWCqOWuuemHj++8jOS4gOiIrOeUqOadpeS/neWtmOajgOa1i+S8oOaEn+WZqOaVsOaNruS4juezu+e7n+WPguaVsAogIC8v5aaC5rip5rm/5bqm5pWw5o2u562J77yM6YCa5bi45L+d5a2Y55qE5pWw5o2u6KaB5Yqg5LiK5pe26Ze05oizCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/02-EEPROM掉电存储.mix b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/02-EEPROM掉电存储.mix new file mode 100644 index 00000000..8e5e0531 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/Mixly2.0简明教程/14-存储/02-EEPROM掉电存储.mix @@ -0,0 +1 @@ +EEPROM记录LED状态,初始化恢复断电前的状态EEPROM有写入次数寿命,不适合频繁的写入数据不同开发板EEPROM存储空间有所不同,UNO与Nano&#10;的EEPROM为1KB(地址0-1023),Mega为4KB不同数据类型存储占用的字节空间不同,使用多个时并不能&#10;简单的把地址理解为变量存储区需结合数据类型做判断global_variateledbooleanTRUE0ledled11HIGH11LOWattachClick12HIGH11HIGH1111ledTRUEledFALSE00ledCiNpbmNsdWRlIDxFRVBST00uaD4KI2luY2x1ZGUgPE9uZUJ1dHRvbi5oPgoKdm9sYXRpbGUgYm9vbGVhbiBsZWQ7Ck9uZUJ1dHRvbiBidXR0b24xMigxMixmYWxzZSk7Cgp2b2lkIGF0dGFjaENsaWNrMTIoKSB7CiAgZGlnaXRhbFdyaXRlKDExLCghZGlnaXRhbFJlYWQoMTEpKSk7CiAgaWYgKGRpZ2l0YWxSZWFkKDExKSkgewogICAgbGVkID0gdHJ1ZTsKCiAgfSBlbHNlIHsKICAgIGxlZCA9IGZhbHNlOwoKICB9CiAgRUVQUk9NLnB1dCgwLCBsZWQpOwp9Cgp2b2lkIHNldHVwKCl7CiAgbGVkID0gdHJ1ZTsKICBwaW5Nb2RlKDExLCBPVVRQVVQpOwogIEVFUFJPTS5nZXQoMCwgbGVkKTsKICBpZiAobGVkKSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsSElHSCk7CgogIH0gZWxzZSB7CiAgICBkaWdpdGFsV3JpdGUoMTEsTE9XKTsKCiAgfQogIGJ1dHRvbjEyLmF0dGFjaENsaWNrKGF0dGFjaENsaWNrMTIpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL0VFUFJPTeiusOW9lUxFROeKtuaAge+8jOWIneWni+WMluaBouWkjeaWreeUteWJjeeahOeKtuaAgQogIC8vRUVQUk9N5pyJ5YaZ5YWl5qyh5pWw5a+/5ZG977yM5LiN6YCC5ZCI6aKR57mB55qE5YaZ5YWl5pWw5o2uCiAgLy/kuI3lkIzlvIDlj5Hmnb9FRVBST03lrZjlgqjnqbrpl7TmnInmiYDkuI3lkIzvvIxVTk/kuI5OYW5vCiAgLy/nmoRFRVBST03kuLoxS0LvvIjlnLDlnYAwLTEwMjPvvInvvIxNZWdh5Li6NEtCCiAgLy/kuI3lkIzmlbDmja7nsbvlnovlrZjlgqjljaDnlKjnmoTlrZfoioLnqbrpl7TkuI3lkIzvvIzkvb/nlKjlpJrkuKrml7blubbkuI3og70KICAvL+eugOWNleeahOaKiuWcsOWdgOeQhuino+S4uuWPmOmHj+WtmOWCqOWMuumcgOe7k+WQiOaVsOaNruexu+Wei+WBmuWIpOaWrQoKICBidXR0b24xMi50aWNrKCk7Cn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/map.json b/mixly/boards/default_src/arduino_avr/origin/examples/map.json new file mode 100644 index 00000000..c17e549a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/map.json @@ -0,0 +1,1390 @@ +{ + "01-输入输出": { + "01-LED闪烁.mix": { + "__file__": true, + "__name__": "01-LED闪烁.mix" + }, + "02-开关灯.mix": { + "__file__": true, + "__name__": "02-开关灯.mix" + }, + "03-调光灯.mix": { + "__file__": true, + "__name__": "03-调光灯.mix" + }, + "04-多功能按键.mix": { + "__file__": true, + "__name__": "04-多功能按键.mix" + }, + "05-硬件中断.mix": { + "__file__": true, + "__name__": "05-硬件中断.mix" + }, + "06-软件中断.mix": { + "__file__": true, + "__name__": "06-软件中断.mix" + }, + "07-声控灯.mix": { + "__file__": true, + "__name__": "07-声控灯.mix" + }, + "08-脉冲.mix": { + "__file__": true, + "__name__": "08-脉冲.mix" + }, + "09-软件模拟PWM.mix": { + "__file__": true, + "__name__": "09-软件模拟PWM.mix" + }, + "10-ShiftOut数字骰子.mix": { + "__file__": true, + "__name__": "10-ShiftOut数字骰子.mix" + }, + "11-ShiftOut流水灯.mix": { + "__file__": true, + "__name__": "11-ShiftOut流水灯.mix" + }, + "__file__": false, + "__name__": "01-输入输出" + }, + "02-控制": { + "01-初始化.mix": { + "__file__": true, + "__name__": "01-初始化.mix" + }, + "02-LED流水灯.mix": { + "__file__": true, + "__name__": "02-LED流水灯.mix" + }, + "03-While循环.mix": { + "__file__": true, + "__name__": "03-While循环.mix" + }, + "04-延时灯.mix": { + "__file__": true, + "__name__": "04-延时灯.mix" + }, + "05-定时器控制灯亮灭.mix": { + "__file__": true, + "__name__": "05-定时器控制灯亮灭.mix" + }, + "06-简单定时器.mix": { + "__file__": true, + "__name__": "06-简单定时器.mix" + }, + "07-随机亮灯.mix": { + "__file__": true, + "__name__": "07-随机亮灯.mix" + }, + "08-Scoop多线程.mix": { + "__file__": true, + "__name__": "08-Scoop多线程.mix" + }, + "09-硬件中断-秒表.mix": { + "__file__": true, + "__name__": "09-硬件中断-秒表.mix" + }, + "__file__": false, + "__name__": "02-控制" + }, + "03-数学": { + "01-模拟输入和模拟输出.mix": { + "__file__": true, + "__name__": "01-模拟输入和模拟输出.mix" + }, + "02-绘制三角函数曲线.mix": { + "__file__": true, + "__name__": "02-绘制三角函数曲线.mix" + }, + "03-映射.mix": { + "__file__": true, + "__name__": "03-映射.mix" + }, + "04-随机数.mix": { + "__file__": true, + "__name__": "04-随机数.mix" + }, + "05-约束运算.mix": { + "__file__": true, + "__name__": "05-约束运算.mix" + }, + "06-移位计算.mix": { + "__file__": true, + "__name__": "06-移位计算.mix" + }, + "__file__": false, + "__name__": "03-数学" + }, + "04-文本": { + "01-serial_string-1.mix": { + "__file__": true, + "__name__": "01-serial_string-1.mix" + }, + "02-serial_string-2.mix": { + "__file__": true, + "__name__": "02-serial_string-2.mix" + }, + "03-serial_string-3.mix": { + "__file__": true, + "__name__": "03-serial_string-3.mix" + }, + "04-serial_string-4.mix": { + "__file__": true, + "__name__": "04-serial_string-4.mix" + }, + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "__file__": false, + "__name__": "04-文本" + }, + "05-数组": { + "01-一维数组输出.mix": { + "__file__": true, + "__name__": "01-一维数组输出.mix" + }, + "02-二维数组输出.mix": { + "__file__": true, + "__name__": "02-二维数组输出.mix" + }, + "__file__": false, + "__name__": "05-数组" + }, + "06-逻辑": { + "01-比较运算符.mix": { + "__file__": true, + "__name__": "01-比较运算符.mix" + }, + "02-逻辑运算符.mix": { + "__file__": true, + "__name__": "02-逻辑运算符.mix" + }, + "03-?语句.mix": { + "__file__": true, + "__name__": "03-?语句.mix" + }, + "__file__": false, + "__name__": "06-逻辑" + }, + "07-串口": { + "01-串口交互.mix": { + "__file__": true, + "__name__": "01-串口交互.mix" + }, + "02-串口控制开关灯.mix": { + "__file__": true, + "__name__": "02-串口控制开关灯.mix" + }, + "03-打印ASCII值.mix": { + "__file__": true, + "__name__": "03-打印ASCII值.mix" + }, + "__file__": false, + "__name__": "07-串口" + }, + "08-通信": { + "01-IRremote红外控制灯.mix": { + "__file__": true, + "__name__": "01-IRremote红外控制灯.mix" + }, + "02-IICMaster_字符.mix": { + "__file__": true, + "__name__": "02-IICMaster_字符.mix" + }, + "02-IICMaster_字符串.mix": { + "__file__": true, + "__name__": "02-IICMaster_字符串.mix" + }, + "02-IICMaster_请求数据.mix": { + "__file__": true, + "__name__": "02-IICMaster_请求数据.mix" + }, + "02-IICSlave_字符.mix": { + "__file__": true, + "__name__": "02-IICSlave_字符.mix" + }, + "02-IICSlave_字符串.mix": { + "__file__": true, + "__name__": "02-IICSlave_字符串.mix" + }, + "03-SPI_Master.mix": { + "__file__": true, + "__name__": "03-SPI_Master.mix" + }, + "03-SPI_Master_1.mix": { + "__file__": true, + "__name__": "03-SPI_Master_1.mix" + }, + "03-SPI_Master_2.mix": { + "__file__": true, + "__name__": "03-SPI_Master_2.mix" + }, + "03-SPI_Master_字符串.mix": { + "__file__": true, + "__name__": "03-SPI_Master_字符串.mix" + }, + "03-SPI_Slave.mix": { + "__file__": true, + "__name__": "03-SPI_Slave.mix" + }, + "03-SPI_Slave_1.mix": { + "__file__": true, + "__name__": "03-SPI_Slave_1.mix" + }, + "03-SPI_Slave_2.mix": { + "__file__": true, + "__name__": "03-SPI_Slave_2.mix" + }, + "03-SPI_Slave_字符串.mix": { + "__file__": true, + "__name__": "03-SPI_Slave_字符串.mix" + }, + "04-RFID_写卡&读卡.mix": { + "__file__": true, + "__name__": "04-RFID_写卡&读卡.mix" + }, + "04-RFID_写卡.mix": { + "__file__": true, + "__name__": "04-RFID_写卡.mix" + }, + "04-RFID_读卡.mix": { + "__file__": true, + "__name__": "04-RFID_读卡.mix" + }, + "04-RFID_读取RFID卡号.mix": { + "__file__": true, + "__name__": "04-RFID_读取RFID卡号.mix" + }, + "__file__": false, + "__name__": "08-通信" + }, + "09-存储": { + "02-EEPROM.mix": { + "__file__": true, + "__name__": "02-EEPROM.mix" + }, + "02-EEPROM_写入和读取字符数组.mix": { + "__file__": true, + "__name__": "02-EEPROM_写入和读取字符数组.mix" + }, + "02-EEPROM_写入和读取字节数组.mix": { + "__file__": true, + "__name__": "02-EEPROM_写入和读取字节数组.mix" + }, + "02-EEPROM_写入和读取小数.mix": { + "__file__": true, + "__name__": "02-EEPROM_写入和读取小数.mix" + }, + "02-EEPROM_写入和读取长整数.mix": { + "__file__": true, + "__name__": "02-EEPROM_写入和读取长整数.mix" + }, + "__file__": false, + "__name__": "09-存储" + }, + "10-传感器": { + "01-超声波测距.mix": { + "__file__": true, + "__name__": "01-超声波测距.mix" + }, + "02-LCD1602显示温湿度.mix": { + "__file__": true, + "__name__": "02-LCD1602显示温湿度.mix" + }, + "04-DS18B20温度传感器.mix": { + "__file__": true, + "__name__": "04-DS18B20温度传感器.mix" + }, + "05-MLX90614测温.mix": { + "__file__": true, + "__name__": "05-MLX90614测温.mix" + }, + "06-TCS34725颜色识别传感器.mix": { + "__file__": true, + "__name__": "06-TCS34725颜色识别传感器.mix" + }, + "07-TCS230颜色识别传感器.mix": { + "__file__": true, + "__name__": "07-TCS230颜色识别传感器.mix" + }, + "11-旋转编码器读取数据.mix": { + "__file__": true, + "__name__": "11-旋转编码器读取数据.mix" + }, + "12-DS1302液晶时钟.mix": { + "__file__": true, + "__name__": "12-DS1302液晶时钟.mix" + }, + "12-DS1302输出日期.mix": { + "__file__": true, + "__name__": "12-DS1302输出日期.mix" + }, + "13-矩阵键盘密码灯.mix": { + "__file__": true, + "__name__": "13-矩阵键盘密码灯.mix" + }, + "13-矩阵键盘打印按键值.mix": { + "__file__": true, + "__name__": "13-矩阵键盘打印按键值.mix" + }, + "13-矩阵键盘简易密码锁.mix": { + "__file__": true, + "__name__": "13-矩阵键盘简易密码锁.mix" + }, + "15-MPU6050打印数值.mix": { + "__file__": true, + "__name__": "15-MPU6050打印数值.mix" + }, + "16-BME280打印温度值.mix": { + "__file__": true, + "__name__": "16-BME280打印温度值.mix" + }, + "16-BME280气象站.mix": { + "__file__": true, + "__name__": "16-BME280气象站.mix" + }, + "17-PS2手柄_打印摇杆值.mix": { + "__file__": true, + "__name__": "17-PS2手柄_打印摇杆值.mix" + }, + "B01-声控舵机.mix": { + "__file__": true, + "__name__": "B01-声控舵机.mix" + }, + "__file__": false, + "__name__": "10-传感器" + }, + "11-执行器": { + "01-门铃.mix": { + "__file__": true, + "__name__": "01-门铃.mix" + }, + "02-蜂鸣器播放简单声音.mix": { + "__file__": true, + "__name__": "02-蜂鸣器播放简单声音.mix" + }, + "03-按键钢琴.mix": { + "__file__": true, + "__name__": "03-按键钢琴.mix" + }, + "04-两只老虎.mix": { + "__file__": true, + "__name__": "04-两只老虎.mix" + }, + "05-Alarm.mix": { + "__file__": true, + "__name__": "05-Alarm.mix" + }, + "06-WS2812.mix": { + "__file__": true, + "__name__": "06-WS2812.mix" + }, + "07-mini MP3_播放音乐.mix": { + "__file__": true, + "__name__": "07-mini MP3_播放音乐.mix" + }, + "09-七彩流水灯.mix": { + "__file__": true, + "__name__": "09-七彩流水灯.mix" + }, + "__file__": false, + "__name__": "11-执行器" + }, + "12-显示器": { + "01-TM1650_显示变化的数字.mix": { + "__file__": true, + "__name__": "01-TM1650_显示变化的数字.mix" + }, + "03-LCD1602_显示Hello Mixly.mix": { + "__file__": true, + "__name__": "03-LCD1602_显示Hello Mixly.mix" + }, + "04-OLED_多页切换.mix": { + "__file__": true, + "__name__": "04-OLED_多页切换.mix" + }, + "04-OLED_显示Mixly Logo.mix": { + "__file__": true, + "__name__": "04-OLED_显示Mixly Logo.mix" + }, + "04-OLED_显示奥运五环图案.mix": { + "__file__": true, + "__name__": "04-OLED_显示奥运五环图案.mix" + }, + "04-OLED_显示文本.mix": { + "__file__": true, + "__name__": "04-OLED_显示文本.mix" + }, + "04-OLED_显示汉字(取模).mix": { + "__file__": true, + "__name__": "04-OLED_显示汉字(取模).mix" + }, + "04-OLED_显示汉字.mix": { + "__file__": true, + "__name__": "04-OLED_显示汉字.mix" + }, + "04-OLED_显示表情图片.mix": { + "__file__": true, + "__name__": "04-OLED_显示表情图片.mix" + }, + "04-OLED_显示表情图片1.mix": { + "__file__": true, + "__name__": "04-OLED_显示表情图片1.mix" + }, + "05-NOKIA5110_显示汉字(取模).mix": { + "__file__": true, + "__name__": "05-NOKIA5110_显示汉字(取模).mix" + }, + "06-LCD12864 8080_显示汉字(取模).mix": { + "__file__": true, + "__name__": "06-LCD12864 8080_显示汉字(取模).mix" + }, + "06-LCD12864 SPI_显示汉字(取模).mix": { + "__file__": true, + "__name__": "06-LCD12864 SPI_显示汉字(取模).mix" + }, + "07-MAX7219_显示笑脸和哭脸.mix": { + "__file__": true, + "__name__": "07-MAX7219_显示笑脸和哭脸.mix" + }, + "07-MAX7219_水平方向四块级联滚动显示Mixly.mix": { + "__file__": true, + "__name__": "07-MAX7219_水平方向四块级联滚动显示Mixly.mix" + }, + "__file__": false, + "__name__": "12-显示器" + }, + "15-函数": { + "01-函数法SOS.mix": { + "__file__": true, + "__name__": "01-函数法SOS.mix" + }, + "02-含参数无返回值呼吸灯.mix": { + "__file__": true, + "__name__": "02-含参数无返回值呼吸灯.mix" + }, + "__file__": false, + "__name__": "15-函数" + }, + "16-自定义模块": { + "(在2.0下编译报错)01-Factory.mix": { + "__file__": true, + "__name__": "(在2.0下编译报错)01-Factory.mix" + }, + "__file__": false, + "__name__": "16-自定义模块" + }, + "Mixly2.0_simple_tutorial": { + "01_input_and_Output": { + "01_Light_up_the_on_board_indicator.mix": { + "__file__": true, + "__name__": "01_Light_up_the_on_board_indicator.mix" + }, + "02_On_board_indicator_flashes.mix": { + "__file__": true, + "__name__": "02_On_board_indicator_flashes.mix" + }, + "03_Digital_Inputs.mix": { + "__file__": true, + "__name__": "03_Digital_Inputs.mix" + }, + "04_Pin_output_state_switching.mix": { + "__file__": true, + "__name__": "04_Pin_output_state_switching.mix" + }, + "05_PWMAnalog_Output.mix": { + "__file__": true, + "__name__": "05_PWMAnalog_Output.mix" + }, + "06_Analog_Inputs.mix": { + "__file__": true, + "__name__": "06_Analog_Inputs.mix" + }, + "07_Software_analog_output.mix": { + "__file__": true, + "__name__": "07_Software_analog_output.mix" + }, + "08_Multi_functional_keys.mix": { + "__file__": true, + "__name__": "08_Multi_functional_keys.mix" + }, + "09_Hardware_Interrupts.mix": { + "__file__": true, + "__name__": "09_Hardware_Interrupts.mix" + }, + "10_Software_Interruptions.mix": { + "__file__": true, + "__name__": "10_Software_Interruptions.mix" + }, + "11_Pulse_measurement.mix": { + "__file__": true, + "__name__": "11_Pulse_measurement.mix" + }, + "12_Pin_up_mode.mix": { + "__file__": true, + "__name__": "12_Pin_up_mode.mix" + }, + "13_Serial_Data_Output.mix": { + "__file__": true, + "__name__": "13_Serial_Data_Output.mix" + }, + "__file__": false, + "__name__": "01_input_and_Output" + }, + "02_Control": { + "01_Stop_the_program.mix": { + "__file__": true, + "__name__": "01_Stop_the_program.mix" + }, + "02_Difference_between_while_and_do_while.mix": { + "__file__": true, + "__name__": "02_Difference_between_while_and_do_while.mix" + }, + "03_if_elseConditional_Judgment.mix": { + "__file__": true, + "__name__": "03_if_elseConditional_Judgment.mix" + }, + "04_switch_Multi_branching_condition_control.mix": { + "__file__": true, + "__name__": "04_switch_Multi_branching_condition_control.mix" + }, + "05_for_Circular_breathing_light.mix": { + "__file__": true, + "__name__": "05_for_Circular_breathing_light.mix" + }, + "06_Jump_out_of_the_loop.mix": { + "__file__": true, + "__name__": "06_Jump_out_of_the_loop.mix" + }, + "07_System_runtime.mix": { + "__file__": true, + "__name__": "07_System_runtime.mix" + }, + "08_Hardware_Timer.mix": { + "__file__": true, + "__name__": "08_Hardware_Timer.mix" + }, + "09_Simple_Timer.mix": { + "__file__": true, + "__name__": "09_Simple_Timer.mix" + }, + "10_Register_delay_function.mix": { + "__file__": true, + "__name__": "10_Register_delay_function.mix" + }, + "11_SCoop_Multi-threaded.mix": { + "__file__": true, + "__name__": "11_SCoop_Multi-threaded.mix" + }, + "__file__": false, + "__name__": "02_Control" + }, + "03_Mathematics": { + "01_Algebraic_operations.mix": { + "__file__": true, + "__name__": "01_Algebraic_operations.mix" + }, + "02_Bit_Operations.mix": { + "__file__": true, + "__name__": "02_Bit_Operations.mix" + }, + "03_Trigonometric_functions.mix": { + "__file__": true, + "__name__": "03_Trigonometric_functions.mix" + }, + "04_Variable_self-adding.mix": { + "__file__": true, + "__name__": "04_Variable_self-adding.mix" + }, + "05_Common_mathematical_operations(Rounding_etc.).mix": { + "__file__": true, + "__name__": "05_Common_mathematical_operations(Rounding_etc.).mix" + }, + "06_Get_the_number_of_bytes_occupied_by_different_types_of_data.mix": { + "__file__": true, + "__name__": "06_Get_the_number_of_bytes_occupied_by_different_types_of_data.mix" + }, + "07_Maximum_and_minimum_values.mix": { + "__file__": true, + "__name__": "07_Maximum_and_minimum_values.mix" + }, + "08_Get_random_number.mix": { + "__file__": true, + "__name__": "08_Get_random_number.mix" + }, + "09_Mathematical_constraints.mix": { + "__file__": true, + "__name__": "09_Mathematical_constraints.mix" + }, + "10_Mathematical_mapping.mix": { + "__file__": true, + "__name__": "10_Mathematical_mapping.mix" + }, + "__file__": false, + "__name__": "03_Mathematics" + }, + "04_Logic": { + "01_Logical_relationships.mix": { + "__file__": true, + "__name__": "01_Logical_relationships.mix" + }, + "02_Logical_operations.mix": { + "__file__": true, + "__name__": "02_Logical_operations.mix" + }, + "03_Logical_non-operations.mix": { + "__file__": true, + "__name__": "03_Logical_non-operations.mix" + }, + "04_Conditional_return_value.mix": { + "__file__": true, + "__name__": "04_Conditional_return_value.mix" + }, + "__file__": false, + "__name__": "04_Logic" + }, + "05_Text": { + "01_String_Splicing.mix": { + "__file__": true, + "__name__": "01_String_Splicing.mix" + }, + "02_String_to_integer_or_decimal.mix": { + "__file__": true, + "__name__": "02_String_to_integer_or_decimal.mix" + }, + "03_String_Index.mix": { + "__file__": true, + "__name__": "03_String_Index.mix" + }, + "04_Intercepting_strings.mix": { + "__file__": true, + "__name__": "04_Intercepting_strings.mix" + }, + "05_String_conversion_and_replacement.mix": { + "__file__": true, + "__name__": "05_String_conversion_and_replacement.mix" + }, + "06_String_First_Determination_and_Data_Type_Conversion.mix": { + "__file__": true, + "__name__": "06_String_First_Determination_and_Data_Type_Conversion.mix" + }, + "07_Character_to_ascii_conversion.mix": { + "__file__": true, + "__name__": "07_Character_to_ascii_conversion.mix" + }, + "08_Incremental_conversion.mix": { + "__file__": true, + "__name__": "08_Incremental_conversion.mix" + }, + "09_String_length_and_getting_the_specified_position_character.mix": { + "__file__": true, + "__name__": "09_String_length_and_getting_the_specified_position_character.mix" + }, + "10_String_relations _and_comparisons.mix": { + "__file__": true, + "__name__": "10_String_relations _and_comparisons.mix" + }, + "__file__": false, + "__name__": "05_Text" + }, + "06_Arrays": { + "01_One-dimensional_array_declaration.mix": { + "__file__": true, + "__name__": "01_One-dimensional_array_declaration.mix" + }, + "02_Array_reading_and_writing.mix": { + "__file__": true, + "__name__": "02_Array_reading_and_writing.mix" + }, + "03_Array_circular_shift.mix": { + "__file__": true, + "__name__": "03_Array_circular_shift.mix" + }, + "04_Two-dimensional_array_declaration.mix": { + "__file__": true, + "__name__": "04_Two-dimensional_array_declaration.mix" + }, + "05_Two-dimensional_array_reading_and_writing.mix": { + "__file__": true, + "__name__": "05_Two-dimensional_array_reading_and_writing.mix" + }, + "__file__": false, + "__name__": "06_Arrays" + }, + "07_Variables": { + "01_Difference_between_variable_declaration_and_use.mix": { + "__file__": true, + "__name__": "01_Difference_between_variable_declaration_and_use.mix" + }, + "__file__": false, + "__name__": "07_Variables" + }, + "08_Function": { + "01_no-return-value-no-parameter_function.mix": { + "__file__": true, + "__name__": "01_no-return-value-no-parameter_function.mix" + }, + "02_no-return-value_function_with_parameters.mix": { + "__file__": true, + "__name__": "02_no-return-value_function_with_parameters.mix" + }, + "03_Function_declaration_with_return_value_and_parameters.mix": { + "__file__": true, + "__name__": "03_Function_declaration_with_return_value_and_parameters.mix" + }, + "04_Multiple_return_value_function_declaration_with_parameters.mix": { + "__file__": true, + "__name__": "04_Multiple_return_value_function_declaration_with_parameters.mix" + }, + "__file__": false, + "__name__": "08_Function" + }, + "09_Serial_port": { + "01_Serial_printout.mix": { + "__file__": true, + "__name__": "01_Serial_printout.mix" + }, + "02_Serial_input_1.mix": { + "__file__": true, + "__name__": "02_Serial_input_1.mix" + }, + "02_Serial_input_2.mix": { + "__file__": true, + "__name__": "02_Serial_input_2.mix" + }, + "02_Serial_input_3.mix": { + "__file__": true, + "__name__": "02_Serial_input_3.mix" + }, + "02_Serial_input_4.mix": { + "__file__": true, + "__name__": "02_Serial_input_4.mix" + }, + "03_Serial_port_send_wait.mix": { + "__file__": true, + "__name__": "03_Serial_port_send_wait.mix" + }, + "04_Serial_Interrupt.mix": { + "__file__": true, + "__name__": "04_Serial_Interrupt.mix" + }, + "05_Use_of_soft_serial_port.mix": { + "__file__": true, + "__name__": "05_Use_of_soft_serial_port.mix" + }, + "__file__": false, + "__name__": "09_Serial_port" + }, + "10_Sensors": { + "01_Ultrasonic_distance_measurement.mix": { + "__file__": true, + "__name__": "01_Ultrasonic_distance_measurement.mix" + }, + "02_Get_DHT11_temperature_and_humidity.mix": { + "__file__": true, + "__name__": "02_Get_DHT11_temperature_and_humidity.mix" + }, + "03_get_LM35_temperature.mix": { + "__file__": true, + "__name__": "03_get_LM35_temperature.mix" + }, + "04_Get_DS18B20_temperature.mix": { + "__file__": true, + "__name__": "04_Get_DS18B20_temperature.mix" + }, + "05_Get_BME280_parameters.mix": { + "__file__": true, + "__name__": "05_Get_BME280_parameters.mix" + }, + "06_get_SHT20_temperature_and_humidity.mix": { + "__file__": true, + "__name__": "06_get_SHT20_temperature_and_humidity.mix" + }, + "07_BMLX90614_Infrared_temperature_measurement.mix": { + "__file__": true, + "__name__": "07_BMLX90614_Infrared_temperature_measurement.mix" + }, + "08_tcs34725_color_extraction.mix": { + "__file__": true, + "__name__": "08_tcs34725_color_extraction.mix" + }, + "09_tcs230_color_extraction.mix": { + "__file__": true, + "__name__": "09_tcs230_color_extraction.mix" + }, + "10_MPU6050_Gyroscope.mix": { + "__file__": true, + "__name__": "10_MPU6050_Gyroscope.mix" + }, + "11_MPU9250_acceleration_sensor.mix": { + "__file__": true, + "__name__": "11_MPU9250_acceleration_sensor.mix" + }, + "__file__": false, + "__name__": "10_Sensors" + }, + "13_Communication": { + "01_Infrared_data_reception.mix": { + "__file__": true, + "__name__": "01_Infrared_data_reception.mix" + }, + "02_Infrared_data_transmission.mix": { + "__file__": true, + "__name__": "02_Infrared_data_transmission.mix" + }, + "03_Infrared_data_simulation_transceiver.mix": { + "__file__": true, + "__name__": "03_Infrared_data_simulation_transceiver.mix" + }, + "__file__": false, + "__name__": "13_Communication" + }, + "14_Storage": { + "01_SD_card_read_test.mix": { + "__file__": true, + "__name__": "01_SD_card_read_test.mix" + }, + "02_EEPROM_power_down_storage.mix": { + "__file__": true, + "__name__": "02_EEPROM_power_down_storage.mix" + }, + "__file__": false, + "__name__": "14_Storage" + }, + "__file__": false, + "__name__": "Mixly2.0_simple_tutorial" + }, + "Mixly2.0简明教程": { + "01-输入输出": { + "01-点亮板载指示灯13.mix": { + "__file__": true, + "__name__": "01-点亮板载指示灯13.mix" + }, + "02-板载指示灯13闪烁.mix": { + "__file__": true, + "__name__": "02-板载指示灯13闪烁.mix" + }, + "03-数字输入.mix": { + "__file__": true, + "__name__": "03-数字输入.mix" + }, + "04-管脚输出状态切换.mix": { + "__file__": true, + "__name__": "04-管脚输出状态切换.mix" + }, + "05-PWM模拟输出.mix": { + "__file__": true, + "__name__": "05-PWM模拟输出.mix" + }, + "06-模拟输入.mix": { + "__file__": true, + "__name__": "06-模拟输入.mix" + }, + "07-软件模拟输出.mix": { + "__file__": true, + "__name__": "07-软件模拟输出.mix" + }, + "08-多功能按键.mix": { + "__file__": true, + "__name__": "08-多功能按键.mix" + }, + "09-硬件中断.mix": { + "__file__": true, + "__name__": "09-硬件中断.mix" + }, + "10-软件中断.mix": { + "__file__": true, + "__name__": "10-软件中断.mix" + }, + "11-脉冲测量.mix": { + "__file__": true, + "__name__": "11-脉冲测量.mix" + }, + "12-管脚上拉模式.mix": { + "__file__": true, + "__name__": "12-管脚上拉模式.mix" + }, + "13-串行数据输出.mix": { + "__file__": true, + "__name__": "13-串行数据输出.mix" + }, + "__file__": false, + "__name__": "01-输入输出" + }, + "02-控制": { + "01-停止程序.mix": { + "__file__": true, + "__name__": "01-停止程序.mix" + }, + "02-while与do while区别.mix": { + "__file__": true, + "__name__": "02-while与do while区别.mix" + }, + "03-if else条件判断.mix": { + "__file__": true, + "__name__": "03-if else条件判断.mix" + }, + "04-switch多分枝条件控制.mix": { + "__file__": true, + "__name__": "04-switch多分枝条件控制.mix" + }, + "05-for循环呼吸灯.mix": { + "__file__": true, + "__name__": "05-for循环呼吸灯.mix" + }, + "06-跳出循环.mix": { + "__file__": true, + "__name__": "06-跳出循环.mix" + }, + "07-系统运行时间.mix": { + "__file__": true, + "__name__": "07-系统运行时间.mix" + }, + "08-硬件定时器.mix": { + "__file__": true, + "__name__": "08-硬件定时器.mix" + }, + "09-简单定时器.mix": { + "__file__": true, + "__name__": "09-简单定时器.mix" + }, + "10-注册延时函数.mix": { + "__file__": true, + "__name__": "10-注册延时函数.mix" + }, + "11-SCoop多线程.mix": { + "__file__": true, + "__name__": "11-SCoop多线程.mix" + }, + "__file__": false, + "__name__": "02-控制" + }, + "03-数学": { + "01-代数运算.mix": { + "__file__": true, + "__name__": "01-代数运算.mix" + }, + "02-位运算.mix": { + "__file__": true, + "__name__": "02-位运算.mix" + }, + "03-三角函数.mix": { + "__file__": true, + "__name__": "03-三角函数.mix" + }, + "04-变量自加.mix": { + "__file__": true, + "__name__": "04-变量自加.mix" + }, + "05-常见数学运算(四舍五入等).mix": { + "__file__": true, + "__name__": "05-常见数学运算(四舍五入等).mix" + }, + "06-获取不同类型数据占用的字节数.mix": { + "__file__": true, + "__name__": "06-获取不同类型数据占用的字节数.mix" + }, + "07-最大值与最小值.mix": { + "__file__": true, + "__name__": "07-最大值与最小值.mix" + }, + "08-获取随机数.mix": { + "__file__": true, + "__name__": "08-获取随机数.mix" + }, + "09-数学约束.mix": { + "__file__": true, + "__name__": "09-数学约束.mix" + }, + "10-数学映射.mix": { + "__file__": true, + "__name__": "10-数学映射.mix" + }, + "__file__": false, + "__name__": "03-数学" + }, + "04-逻辑": { + "01-逻辑关系.mix": { + "__file__": true, + "__name__": "01-逻辑关系.mix" + }, + "02-逻辑运算.mix": { + "__file__": true, + "__name__": "02-逻辑运算.mix" + }, + "03-逻辑非运算.mix": { + "__file__": true, + "__name__": "03-逻辑非运算.mix" + }, + "04-条件返回值.mix": { + "__file__": true, + "__name__": "04-条件返回值.mix" + }, + "__file__": false, + "__name__": "04-逻辑" + }, + "05-文本": { + "01-字符串拼接.mix": { + "__file__": true, + "__name__": "01-字符串拼接.mix" + }, + "02-字符串转整数或小数.mix": { + "__file__": true, + "__name__": "02-字符串转整数或小数.mix" + }, + "03-字符串索引.mix": { + "__file__": true, + "__name__": "03-字符串索引.mix" + }, + "04-截取字符串.mix": { + "__file__": true, + "__name__": "04-截取字符串.mix" + }, + "05-字符串转换与替换.mix": { + "__file__": true, + "__name__": "05-字符串转换与替换.mix" + }, + "06-字符串首位判断与数据类型转换.mix": { + "__file__": true, + "__name__": "06-字符串首位判断与数据类型转换.mix" + }, + "07-字符与ascii码互相转换.mix": { + "__file__": true, + "__name__": "07-字符与ascii码互相转换.mix" + }, + "08-进制转换.mix": { + "__file__": true, + "__name__": "08-进制转换.mix" + }, + "09-字符串长度与获取指定位置字符.mix": { + "__file__": true, + "__name__": "09-字符串长度与获取指定位置字符.mix" + }, + "10-字符串关系与比较.mix": { + "__file__": true, + "__name__": "10-字符串关系与比较.mix" + }, + "__file__": false, + "__name__": "05-文本" + }, + "06-数组": { + "01-一维数组声明.mix": { + "__file__": true, + "__name__": "01-一维数组声明.mix" + }, + "02-数组读写.mix": { + "__file__": true, + "__name__": "02-数组读写.mix" + }, + "03-数组循环移位.mix": { + "__file__": true, + "__name__": "03-数组循环移位.mix" + }, + "04-二维数组声明.mix": { + "__file__": true, + "__name__": "04-二维数组声明.mix" + }, + "05-二维数组读写.mix": { + "__file__": true, + "__name__": "05-二维数组读写.mix" + }, + "__file__": false, + "__name__": "06-数组" + }, + "07-变量": { + "01-变量声明与使用区别.mix": { + "__file__": true, + "__name__": "01-变量声明与使用区别.mix" + }, + "__file__": false, + "__name__": "07-变量" + }, + "08-函数": { + "01-无返回值无参数函数.mix": { + "__file__": true, + "__name__": "01-无返回值无参数函数.mix" + }, + "02-无返回值带参数函数.mix": { + "__file__": true, + "__name__": "02-无返回值带参数函数.mix" + }, + "03-带返回值带参数函数声明.mix": { + "__file__": true, + "__name__": "03-带返回值带参数函数声明.mix" + }, + "04-多返回值带参数函数声明.mix": { + "__file__": true, + "__name__": "04-多返回值带参数函数声明.mix" + }, + "__file__": false, + "__name__": "08-函数" + }, + "09-串口": { + "01-串口打印输出.mix": { + "__file__": true, + "__name__": "01-串口打印输出.mix" + }, + "02-串口输入1.mix": { + "__file__": true, + "__name__": "02-串口输入1.mix" + }, + "02-串口输入2.mix": { + "__file__": true, + "__name__": "02-串口输入2.mix" + }, + "02-串口输入3.mix": { + "__file__": true, + "__name__": "02-串口输入3.mix" + }, + "02-串口输入4.mix": { + "__file__": true, + "__name__": "02-串口输入4.mix" + }, + "03-串口发送等待.mix": { + "__file__": true, + "__name__": "03-串口发送等待.mix" + }, + "04-串口中断.mix": { + "__file__": true, + "__name__": "04-串口中断.mix" + }, + "05-软串口的使用.mix": { + "__file__": true, + "__name__": "05-软串口的使用.mix" + }, + "__file__": false, + "__name__": "09-串口" + }, + "10-传感器": { + "01-超声波测距.mix": { + "__file__": true, + "__name__": "01-超声波测距.mix" + }, + "02-获取DHT11温湿度.mix": { + "__file__": true, + "__name__": "02-获取DHT11温湿度.mix" + }, + "03-获取LM35温度.mix": { + "__file__": true, + "__name__": "03-获取LM35温度.mix" + }, + "04-获取DS18B20温度.mix": { + "__file__": true, + "__name__": "04-获取DS18B20温度.mix" + }, + "05-获取BME280参数.mix": { + "__file__": true, + "__name__": "05-获取BME280参数.mix" + }, + "06-获取SHT20温湿度.mix": { + "__file__": true, + "__name__": "06-获取SHT20温湿度.mix" + }, + "07-BMLX90614红外温度测量.mix": { + "__file__": true, + "__name__": "07-BMLX90614红外温度测量.mix" + }, + "08-tcs34725颜色提取.mix": { + "__file__": true, + "__name__": "08-tcs34725颜色提取.mix" + }, + "09-tcs230颜色提取.mix": { + "__file__": true, + "__name__": "09-tcs230颜色提取.mix" + }, + "10-MPU6050陀螺仪.mix": { + "__file__": true, + "__name__": "10-MPU6050陀螺仪.mix" + }, + "11-MPU9250加速度传感器.mix": { + "__file__": true, + "__name__": "11-MPU9250加速度传感器.mix" + }, + "__file__": false, + "__name__": "10-传感器" + }, + "13-通信": { + "01-红外数据接收.mix": { + "__file__": true, + "__name__": "01-红外数据接收.mix" + }, + "02-红外数据发送.mix": { + "__file__": true, + "__name__": "02-红外数据发送.mix" + }, + "03-红外数据模拟收发.mix": { + "__file__": true, + "__name__": "03-红外数据模拟收发.mix" + }, + "__file__": false, + "__name__": "13-通信" + }, + "14-存储": { + "01-SD卡读写测试.mix": { + "__file__": true, + "__name__": "01-SD卡读写测试.mix" + }, + "02-EEPROM掉电存储.mix": { + "__file__": true, + "__name__": "02-EEPROM掉电存储.mix" + }, + "__file__": false, + "__name__": "14-存储" + }, + "__file__": false, + "__name__": "Mixly2.0简明教程" + }, + "教材范例": { + "创意电子": { + "03按钮指示灯_buttonindator_2.mix": { + "__file__": true, + "__name__": "03按钮指示灯_buttonindator_2.mix" + }, + "03按钮指示灯_flashinglight_2.mix": { + "__file__": true, + "__name__": "03按钮指示灯_flashinglight_2.mix" + }, + "04渐变灯_buttonindator_3.mix": { + "__file__": true, + "__name__": "04渐变灯_buttonindator_3.mix" + }, + "04渐变灯_gradientlamp_1.mix": { + "__file__": true, + "__name__": "04渐变灯_gradientlamp_1.mix" + }, + "05反应测试_gradientlamp_2.mix": { + "__file__": true, + "__name__": "05反应测试_gradientlamp_2.mix" + }, + "05反应测试_reactiontest_2.mix": { + "__file__": true, + "__name__": "05反应测试_reactiontest_2.mix" + }, + "06遥控灯_remotecontrollight_2.mix": { + "__file__": true, + "__name__": "06遥控灯_remotecontrollight_2.mix" + }, + "07遥控门锁_keylessentry_1.mix": { + "__file__": true, + "__name__": "07遥控门锁_keylessentry_1.mix" + }, + "07遥控门锁_keylessentry_2.mix": { + "__file__": true, + "__name__": "07遥控门锁_keylessentry_2.mix" + }, + "08温度指示器_temperatureindator_1.mix": { + "__file__": true, + "__name__": "08温度指示器_temperatureindator_1.mix" + }, + "08温度指示器_temperatureindator_2.mix": { + "__file__": true, + "__name__": "08温度指示器_temperatureindator_2.mix" + }, + "09报警器_alarm_1.mix": { + "__file__": true, + "__name__": "09报警器_alarm_1.mix" + }, + "09报警器_alarm_2.mix": { + "__file__": true, + "__name__": "09报警器_alarm_2.mix" + }, + "09报警器_lib_alarm_lib2.mix": { + "__file__": true, + "__name__": "09报警器_lib_alarm_lib2.mix" + }, + "10可调报警器_adjustablealarm_1.mix": { + "__file__": true, + "__name__": "10可调报警器_adjustablealarm_1.mix" + }, + "10可调报警器_adjustablealarm_2.mix": { + "__file__": true, + "__name__": "10可调报警器_adjustablealarm_2.mix" + }, + "10可调报警器_lib_adjustablealarm_lib2.mix": { + "__file__": true, + "__name__": "10可调报警器_lib_adjustablealarm_lib2.mix" + }, + "11倒车雷达_reversingradar_1.mix": { + "__file__": true, + "__name__": "11倒车雷达_reversingradar_1.mix" + }, + "11倒车雷达_reversingradar_2.mix": { + "__file__": true, + "__name__": "11倒车雷达_reversingradar_2.mix" + }, + "12计时器_timer_1.mix": { + "__file__": true, + "__name__": "12计时器_timer_1.mix" + }, + "12计时器_timer_2.mix": { + "__file__": true, + "__name__": "12计时器_timer_2.mix" + }, + "1闪烁灯_1 flashing light.mix": { + "__file__": true, + "__name__": "1闪烁灯_1 flashing light.mix" + }, + "2闪烁灯_2 flashing lights.mix": { + "__file__": true, + "__name__": "2闪烁灯_2 flashing lights.mix" + }, + "__file__": false, + "__name__": "创意电子" + }, + "智能机器": { + "“保卫”消防通道_Secure Fire Passage.mix": { + "__file__": true, + "__name__": "“保卫”消防通道_Secure Fire Passage.mix" + }, + "你抢我答_You rob me to answer.mix": { + "__file__": true, + "__name__": "你抢我答_You rob me to answer.mix" + }, + "噪声监控_Noise monitoring.mix": { + "__file__": true, + "__name__": "噪声监控_Noise monitoring.mix" + }, + "图书消毒柜_Book disinfection cabinet.mix": { + "__file__": true, + "__name__": "图书消毒柜_Book disinfection cabinet.mix" + }, + "太阳能发电机_Solar generator.mix": { + "__file__": true, + "__name__": "太阳能发电机_Solar generator.mix" + }, + "彩色手电筒_Color flashlight.mix": { + "__file__": true, + "__name__": "彩色手电筒_Color flashlight.mix" + }, + "无人驾驶_unmanned.mix": { + "__file__": true, + "__name__": "无人驾驶_unmanned.mix" + }, + "智能停车场_Smart parking.mix": { + "__file__": true, + "__name__": "智能停车场_Smart parking.mix" + }, + "眼疾手快_Eye disease hand fast.mix": { + "__file__": true, + "__name__": "眼疾手快_Eye disease hand fast.mix" + }, + "瞄准狐狸_Aiming at the fox.mix": { + "__file__": true, + "__name__": "瞄准狐狸_Aiming at the fox.mix" + }, + "节电风扇_Power-saving fan.mix": { + "__file__": true, + "__name__": "节电风扇_Power-saving fan.mix" + }, + "超市储物箱_Supermarket storage box.mix": { + "__file__": true, + "__name__": "超市储物箱_Supermarket storage box.mix" + }, + "__file__": false, + "__name__": "智能机器" + }, + "__file__": false, + "__name__": "教材范例" + } +} diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_buttonindator_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_buttonindator_2.mix new file mode 100644 index 00000000..43d7f288 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_buttonindator_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm10WHILETRUE10delay1011HIGH11 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_flashinglight_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_flashinglight_2.mix new file mode 100644 index 00000000..4e17b603 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/03按钮指示灯_flashinglight_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmEQ10HIGH11HIGHEQ10LOW11LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_buttonindator_3.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_buttonindator_3.mix new file mode 100644 index 00000000..befc9323 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_buttonindator_3.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmi02551100idelay10i2550-1100idelay10 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_gradientlamp_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_gradientlamp_1.mix new file mode 100644 index 00000000..2ec69ec6 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/04渐变灯_gradientlamp_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmi02551100i110MINUS2551idelay10i2550-1100i110MINUS2551idelay10 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_gradientlamp_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_gradientlamp_2.mix new file mode 100644 index 00000000..6132c5e2 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_gradientlamp_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm11HIGH10WHILETRUE10delay10Serialprintlntime:Mixlymillis11LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_reactiontest_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_reactiontest_2.mix new file mode 100644 index 00000000..85e16bf8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/05反应测试_reactiontest_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmglobal_variate按下时刻int0global_variatestateint010WHILETRUE10delay10EQstate0按下时刻millis11HIGHstate1Serialprintlntime:MixlyMINUS1millis1按下时刻11LOWstate0 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/06遥控灯_remotecontrollight_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/06遥控灯_remotecontrollight_2.mix new file mode 100644 index 00000000..a0f34700 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/06遥控灯_remotecontrollight_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmir_item12delay150EQir_item0xFF689713HIGHEQir_item0xFF30CF13LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_1.mix new file mode 100644 index 00000000..ba618791 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm20100021801000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_2.mix new file mode 100644 index 00000000..1eda968d --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/07遥控门锁_keylessentry_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmglobal_variates1int020200ir_item8SerialprintHEXir_itemdelay150EQir_item0xFF6897s11ANDEQir_item0xFF30CFEQs11s12s10EQs122180300020500 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_1.mix new file mode 100644 index 00000000..0fdba925 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm2901000global_variatetemfloat0tem118temperatureSerialprintlntemLTEtem28213510002451000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_2.mix new file mode 100644 index 00000000..86f05350 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/08温度指示器_temperatureindator_2.mix @@ -0,0 +1 @@ +2901000global_variatetemfloat0tem118temperatureSerialprintlntemLTEtem2821501000GTtem2923010002901000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_1.mix new file mode 100644 index 00000000..aaa24336 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm10262delay30010294delay30010330delay30010delay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_2.mix new file mode 100644 index 00000000..5a5e08a9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_alarm_2.mix @@ -0,0 +1 @@ +i0360110262ADD1MULTIPLY1SINi500700delay10 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_lib_alarm_lib2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_lib_alarm_lib2.mix new file mode 100644 index 00000000..5a5e08a9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/09报警器_lib_alarm_lib2.mix @@ -0,0 +1 @@ +i0360110262ADD1MULTIPLY1SINi500700delay10 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_1.mix new file mode 100644 index 00000000..5b3c4608 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_1.mix @@ -0,0 +1 @@ +global_variates1int020200课程地址:https://study.163.com/course/introduction/1209591937.htm101397delay1000map_intA001023100100010delay1000map_intA0010231001000ir_item8SerialprintHEXir_itemdelay150EQir_item0xFF6897s11ANDEQir_item0xFF30CFEQs11s12s10EQs122180300020500 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_2.mix new file mode 100644 index 00000000..a50a919e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_adjustablealarm_2.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmi0360110262ADD1MULTIPLY1SINi500700delay1000map_intA001023515 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_lib_adjustablealarm_lib2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_lib_adjustablealarm_lib2.mix new file mode 100644 index 00000000..572587e8 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/10可调报警器_lib_adjustablealarm_lib2.mix @@ -0,0 +1 @@ +i0360110262ADD1MULTIPLY1SINi500700delay1000map_intA001023515 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_1.mix new file mode 100644 index 00000000..9719ffdd --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htmSerialprintln89delay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_2.mix new file mode 100644 index 00000000..0d703b16 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/11倒车雷达_reversingradar_2.mix @@ -0,0 +1 @@ +global_variatelengthint0课程地址:https://study.163.com/course/introduction/1209591937.htmlength89SerialprintlnlengthLTElength2510131delay1000MULTIPLY1length410delay1000MULTIPLY1length4 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_1.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_1.mix new file mode 100644 index 00000000..b1f37b99 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_1.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm2i101-1clearabcdidelay100010131abcd0delay100010 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_2.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_2.mix new file mode 100644 index 00000000..b32d4504 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/12计时器_timer_2.mix @@ -0,0 +1 @@ +global_variatetimeint0课程地址:https://study.163.com/course/introduction/1209591937.htmtimemap_intA001023130clearabcdtimedelay1502i10time1-1clearabcdidelay100010131abcd0delay100010 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/1闪烁灯_1 flashing light.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/1闪烁灯_1 flashing light.mix new file mode 100644 index 00000000..cb7b3b8b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/1闪烁灯_1 flashing light.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm11HIGHdelay100011LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/2闪烁灯_2 flashing lights.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/2闪烁灯_2 flashing lights.mix new file mode 100644 index 00000000..5e27b313 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/创意电子/2闪烁灯_2 flashing lights.mix @@ -0,0 +1 @@ +课程地址:https://study.163.com/course/introduction/1209591937.htm10LOW11HIGHdelay100010HIGH11LOWdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/“保卫”消防通道_Secure Fire Passage.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/“保卫”消防通道_Secure Fire Passage.mix new file mode 100644 index 00000000..ce290095 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/“保卫”消防通道_Secure Fire Passage.mix @@ -0,0 +1 @@ +global_variatestartTimeint0global_variateendTimeint0global_variatetimeint0RISING10810startTimemillisWHILETRUE10endTimemillistimeMINUS1endTime1startTimeANDGTEtime5000LTtime100005500GTEtime105100alarmi15times18131delay500delay8delay500delaydelay2000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/你抢我答_You rob me to answer.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/你抢我答_You rob me to answer.mix new file mode 100644 index 00000000..fe018ebc --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/你抢我答_You rob me to answer.mix @@ -0,0 +1 @@ +global_variatenum1int0global_variatenum2int0intmylist+-*/global_variateopcharglobal_variateflagbooleanFALSELTA2505LOW10LOWflagFALSEnum11100num21100opmylist115SSD1306_128X64_NONAMEu8g2U8G2_R0A5A4u8g2WHILETRUELTA250delay10flag25HIGHflagTRUE410HIGHflagTRUE5LOW10LOWpage1u8g2tim08Ru8g2001234num1u8g20201234opu8g20401234num2 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/噪声监控_Noise monitoring.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/噪声监控_Noise monitoring.mix new file mode 100644 index 00000000..3344acba --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/噪声监控_Noise monitoring.mix @@ -0,0 +1 @@ +soundA0SSD1306_128X64_NONAMEu8g2U8G2_R0A5A4u8g2delay500LTEsound558LOW9HIGHLTEsound70i1318HIGH9LOWdelay2008LOW9HIGHdelay200delay10008LOW9LOWglobal_variatesoundint0page1u8g2tim08Ru8g20201234sound \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/图书消毒柜_Book disinfection cabinet.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/图书消毒柜_Book disinfection cabinet.mix new file mode 100644 index 00000000..dac20aa1 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/图书消毒柜_Book disinfection cabinet.mix @@ -0,0 +1 @@ +8HIGH9LOWdelay10008LOW9HIGHdelay1000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/太阳能发电机_Solar generator.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/太阳能发电机_Solar generator.mix new file mode 100644 index 00000000..71e31287 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/太阳能发电机_Solar generator.mix @@ -0,0 +1 @@ +global_variatelightint0lightmap_intA0010230255100light11050light \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/彩色手电筒_Color flashlight.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/彩色手电筒_Color flashlight.mix new file mode 100644 index 00000000..55508513 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/彩色手电筒_Color flashlight.mix @@ -0,0 +1 @@ +28HIGH89LOWWHILETRUE2delay1049HIGH98LOWWHILETRUE4delay10 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/无人驾驶_unmanned.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/无人驾驶_unmanned.mix new file mode 100644 index 00000000..3b3d054f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/无人驾驶_unmanned.mix @@ -0,0 +1 @@ +goAhead100speed1105060speedglobal_variatestatebooleanFALSEir_item2SerialprintHEXir_itemEQir_item0XFFA857stateTRUEEQir_item0XFFA25DstateFALSEstateAND47255AND47255255stop1001105060turnLeft100110speed5060speedturnRight100speed11050speed60 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/智能停车场_Smart parking.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/智能停车场_Smart parking.mix new file mode 100644 index 00000000..7c7ffa82 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/智能停车场_Smart parking.mix @@ -0,0 +1 @@ +global_variateparkedint0global_variatespareint20page1u8g2tim08Ru8g20201234Spare Mixlyspareu8g20401234Parked MixlyparkedSSD1306_128X64_NONAMEu8g2U8G2_R0A5A40x27u8g2AND2GTspare010901000parkedADD1parked1spareMINUS1spare1WHILETRUE2delay101001000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/眼疾手快_Eye disease hand fast.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/眼疾手快_Eye disease hand fast.mix new file mode 100644 index 00000000..e7368420 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/眼疾手快_Eye disease hand fast.mix @@ -0,0 +1 @@ +intlights3713global_variatelightint0global_variatestarttimeint0global_variatenowint0global_variateisPressedbooleanFALSEglobal_variateisRightbooleanFALSEglobal_variatecountint0global_variateerrorint0SSD1306_128X64_NONAMEu8g2U8G2_R0A5A4PressbooleanOR2OR412isPressedTRUEisPressedWHILETRUELTerror3lightlights1140lightHIGHisPressedFALSEisRightFALSEstarttimemillisWHILETRUEnowmillisGTEMINUS1now1starttime1000BREAKcountADD1count1errorADD1error1u8g20lightLOWdelay100EQerror381313000RightbooleanAND23isRightTRUEAND47isRightTRUEAND1213isRightTRUEisRightFALSEisRightpage1u8g2tim08Ru8g20201234Count Mixlycountu8g20401234Error Mixlyerror \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/瞄准狐狸_Aiming at the fox.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/瞄准狐狸_Aiming at the fox.mix new file mode 100644 index 00000000..d8b1f58f --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/瞄准狐狸_Aiming at the fox.mix @@ -0,0 +1 @@ +global_variateflagbooleanTRUERISING5AND8flag2LOW4LOW121313000flagFALSEAND8flag2HIGH4HIGHdelay10002LOW4LOWdelay1000flag2LOW4LOW2HIGH4HIGH \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/节电风扇_Power-saving fan.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/节电风扇_Power-saving fan.mix new file mode 100644 index 00000000..054e3c1e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/节电风扇_Power-saving fan.mix @@ -0,0 +1 @@ +global_variatedistancefloat0global_variatestatebooleanFALSEstateLTdistance2010150110LTdistance4010255110100110100110distance242WHILE2delay10statestate \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/超市储物箱_Supermarket storage box.mix b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/超市储物箱_Supermarket storage box.mix new file mode 100644 index 00000000..586f5e5a --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/examples/教材范例/智能机器/超市储物箱_Supermarket storage box.mix @@ -0,0 +1 @@ +10WHILETRUE10delay105LOW6HIGHdelay2005LOW6LOWdelay250041202000WHILETRUE4delay10121502000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/media/uno_compressed.png b/mixly/boards/default_src/arduino_avr/origin/media/uno_compressed.png new file mode 100644 index 00000000..cf9ea5ba Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/media/uno_compressed.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-1.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-1.png new file mode 100644 index 00000000..e2ea1bc1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-1.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-10.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-10.png new file mode 100644 index 00000000..3ac13ac8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-10.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-11.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-11.png new file mode 100644 index 00000000..feb78b7b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-11.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-12.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-12.png new file mode 100644 index 00000000..d099b6b2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-12.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-13.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-13.png new file mode 100644 index 00000000..ac3bd9e5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-13.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-14.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-14.png new file mode 100644 index 00000000..a86fbf28 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-14.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-15.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-15.png new file mode 100644 index 00000000..965c9d1c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-15.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-16.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-16.png new file mode 100644 index 00000000..84c4d91d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-16.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-17.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-17.png new file mode 100644 index 00000000..627643de Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-17.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-18.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-18.png new file mode 100644 index 00000000..0eee4892 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-18.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-19.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-19.png new file mode 100644 index 00000000..8fa605a0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-19.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-2.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-2.png new file mode 100644 index 00000000..99d26593 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-2.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-20.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-20.png new file mode 100644 index 00000000..7ab8b5f0 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-20.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-21.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-21.png new file mode 100644 index 00000000..30b5faca Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-21.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-22.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-22.png new file mode 100644 index 00000000..22e454f8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-22.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-23.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-23.png new file mode 100644 index 00000000..cf3e7c17 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-23.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-24.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-24.png new file mode 100644 index 00000000..659cd365 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-24.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-25.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-25.png new file mode 100644 index 00000000..f718cc13 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-25.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-26.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-26.png new file mode 100644 index 00000000..72df5915 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-26.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-27.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-27.png new file mode 100644 index 00000000..0bbc6bed Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-27.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-28.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-28.png new file mode 100644 index 00000000..a67d3043 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-28.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-29.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-29.png new file mode 100644 index 00000000..3ee63b8d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-29.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-3.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-3.png new file mode 100644 index 00000000..4dde4aef Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-3.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-4.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-4.png new file mode 100644 index 00000000..0810c992 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-4.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-5.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-5.png new file mode 100644 index 00000000..a690f101 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-5.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-6.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-6.png new file mode 100644 index 00000000..876f080b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-6.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-7.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-7.png new file mode 100644 index 00000000..fa0921aa Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-7.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-8.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-8.png new file mode 100644 index 00000000..2f799633 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-8.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-9.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-9.png new file mode 100644 index 00000000..67ce5e15 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/base/interface-9.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break-example.png new file mode 100644 index 00000000..1a06493d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break.png new file mode 100644 index 00000000..c9b21871 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/break.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/control.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/control.png new file mode 100644 index 00000000..a73d9a9a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/control.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay-example.png new file mode 100644 index 00000000..4f083c74 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay.png new file mode 100644 index 00000000..84baf2f6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/delay.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example1.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example1.png new file mode 100644 index 00000000..4494fb4f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example1.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example2.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example2.png new file mode 100644 index 00000000..191c6e1e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for-example2.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for.png new file mode 100644 index 00000000..ee6c89a6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/for.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time-example.png new file mode 100644 index 00000000..b000fd42 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time.png new file mode 100644 index 00000000..eee205f7 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/get-time.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example1.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example1.png new file mode 100644 index 00000000..0b870c35 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example1.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example2.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example2.png new file mode 100644 index 00000000..12de53b5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example2.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example3.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example3.png new file mode 100644 index 00000000..b7b14c44 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else-example3.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else.png new file mode 100644 index 00000000..02b0166d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if-else.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if.png new file mode 100644 index 00000000..00772006 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/if.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts-example.png new file mode 100644 index 00000000..089f8c5d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts.png new file mode 100644 index 00000000..ffd82f3d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/interrupts.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-example.png new file mode 100644 index 00000000..34628bb5 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-start.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-start.png new file mode 100644 index 00000000..10a8641c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-start.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-stop.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-stop.png new file mode 100644 index 00000000..d0cb16df Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2-stop.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2.png new file mode 100644 index 00000000..f713b49d Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/ms-timer2.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts-example.png new file mode 100644 index 00000000..f9284ef1 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts.png new file mode 100644 index 00000000..b41c6199 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/no-interrupts.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task-example.png new file mode 100644 index 00000000..1b037a4c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task.png new file mode 100644 index 00000000..634c6f68 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/scoop-task.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example1.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example1.png new file mode 100644 index 00000000..f0422058 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example1.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example2.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example2.png new file mode 100644 index 00000000..77877137 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup-example2.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup.png new file mode 100644 index 00000000..0a513aa6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/setup.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer-example.png new file mode 100644 index 00000000..17bebb93 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer.png new file mode 100644 index 00000000..37471f38 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/simple-timer.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case-example.png new file mode 100644 index 00000000..2f91c6d9 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case.png new file mode 100644 index 00000000..f465e31f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch-case.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch.png new file mode 100644 index 00000000..613394fb Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/switch.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while-example.png new file mode 100644 index 00000000..3021681f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while.png new file mode 100644 index 00000000..fc6842f8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/control/while.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton-example.png new file mode 100644 index 00000000..61ec162c Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton.png new file mode 100644 index 00000000..9fc6f021 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/OneButton.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input-example.png new file mode 100644 index 00000000..a1dbd6c8 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input.png new file mode 100644 index 00000000..5cb0cf05 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-input.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output-example.png new file mode 100644 index 00000000..40006564 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output.png new file mode 100644 index 00000000..5f8ab029 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/analog-pin-output.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/detach-interrupt-pin.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/detach-interrupt-pin.png new file mode 100644 index 00000000..5be4690e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/detach-interrupt-pin.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input-example.png new file mode 100644 index 00000000..4fcba65a Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input.png new file mode 100644 index 00000000..3fb416f6 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-input.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output-example.png new file mode 100644 index 00000000..b66dccaa Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output.png new file mode 100644 index 00000000..dfec7d4e Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/digital-pin-output.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/input-output.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/input-output.png new file mode 100644 index 00000000..5140e62f Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/input-output.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin-example.png new file mode 100644 index 00000000..b5ce3668 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin.png new file mode 100644 index 00000000..3804908b Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/interrupt-pin.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn-example.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn-example.png new file mode 100644 index 00000000..b3707914 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn-example.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn.png new file mode 100644 index 00000000..66b4c848 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pin-pulseIn.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pinmode.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pinmode.png new file mode 100644 index 00000000..baf3a582 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/pinmode.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/shiftout.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/shiftout.png new file mode 100644 index 00000000..0491bfdc Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/shiftout.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-detachInterrupt.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-detachInterrupt.png new file mode 100644 index 00000000..a17682f2 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-detachInterrupt.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-interrupt.png b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-interrupt.png new file mode 100644 index 00000000..c19d7f55 Binary files /dev/null and b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/images/inout/software-interrupt.png differ diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/001-输入输出介绍.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/001-输入输出介绍.md new file mode 100644 index 00000000..14eeb226 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/001-输入输出介绍.md @@ -0,0 +1,13 @@ +## 输入/输出 + +输入/输出所包含的指令主要分为四部分:控制管脚的输入输出(按信号类型可分为数字信号和模拟信号)、中断、脉冲长度及ShiftOut。 + +- 输入输出:数字输入、数字输出、模拟输入、模拟输出 + +- 中断控制:定义中断,取消中断 + +- 脉冲长度 + +- 移位输出 + +输入/输出分类 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/005-数字输出.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/005-数字输出.md new file mode 100644 index 00000000..7a2740eb --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/005-数字输出.md @@ -0,0 +1,41 @@ +## 数字输出 + +数字输出 + +```arduino +digitalWrite(2, HIGH); +digitalWrite(2, LOW); +``` + +### 描述 + +> 给一个数字引脚写入HIGH或者LOW。 + +### 参数 + +- 管脚: 引脚编号(如1,5,10,A0,A3) +- 值: 高 或 低 + +### 范例 + +将13号端口设置为高电平,延迟一秒,然后设置为低电平,再延迟一秒,如此往复。 + +数字输出示例 + +```arduino +void setup(){ + pinMode(13, OUTPUT); +} + +void loop(){ + digitalWrite(13,HIGH); + delay(1000); + digitalWrite(13,LOW); + delay(1000); +} +``` + +
+
注意
+
数字13号引脚难以作为数字输入使用,因为大部分的控制板上使用了一颗LED与一个电阻连接到他。如果启动了内部的20K上拉电阻,他的电压将在1.7V左右,而不是正常的5V,因为板载LED串联的电阻把他使他降了下来,这意味着他返回的值总是LOW。如果必须使用数字13号引脚的输入模式,需要使用外部上拉下拉电阻
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/010-数字输入.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/010-数字输入.md new file mode 100644 index 00000000..adba83af --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/010-数字输入.md @@ -0,0 +1,42 @@ +## 数字输入 + +数字输入 + +```arduino +digitalRead(2); +``` + +### 描述 + +> 读取指定引脚的值,HIGH或LOW。 + +### 参数 + +- 管脚: 引脚编号(如1,5,10,A0,A3) + +### 返回 + +HIGH 或 LOW + +### 范例 + +读取数字0号引脚的值,并通过串口打印出来。 + +数字输入示例 + +```arduino +void setup(){ + pinMode(2, INPUT); + Serial.begin(9600); +} + +void loop(){ + Serial.println(digitalRead(2)); + delay(1000); +} +``` + +
+
注意
+
如果引脚悬空,digitalRead()会返回HIGH或LOW(随机变化)。
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/015-模拟输出.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/015-模拟输出.md new file mode 100644 index 00000000..b17c0672 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/015-模拟输出.md @@ -0,0 +1,44 @@ +## 模拟输出 + +模拟输出 + +```arduino +analogWrite(3, 100); +``` + +### 描述 + +> 从一个引脚输出模拟值(PWM)。 可用于让LED以不同的亮度点亮或驱动电机以不同的速度旋转。 + +### 参数 + +- 管脚:引脚编号(如3,5,6,9,10,11)不同的开发板模拟输入引脚数量不一样。 +- 赋值:0(完全关闭)到255(完全打开)之间。 + +### 范例 + +控制LED实现呼吸灯效果。 + +模拟输出示例 + +```arduino +void setup(){ + +} + +void loop(){ + for (int i = 0; i <= 255; i = i + (1)) { + analogWrite(10, i); + delay(10); + } + for (int i = 255; i >= 0; i = i + (-1)) { + analogWrite(10, i); + delay(10); + } +} +``` + +
+
注意
+
analogWrite函数与模拟引脚、analogRead函数没有直接关系。 在大多数Arduino板(ATmega168或ATmega328),只有引脚3,5,6,9,10和11可以实现该功能。 在Arduino Mega上,引脚2到13可以实现该功能。
+
diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/020-模拟输入.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/020-模拟输入.md new file mode 100644 index 00000000..7d661125 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/020-模拟输入.md @@ -0,0 +1,43 @@ +## 模拟输入 + +模拟输入 + +```arduino +analogRead(A0); +``` + +### 描述 + +> 从指定的模拟引脚读取数据值。 +> +> Arduino板包含一个6通道(Mini和Nano有8个通道,Mega有16个通道),10位模拟数字转换器。这意味着它将0至5伏特之间的输入电压映射到0至1023之间的整数值。 + +### 参数 + +- 管脚: 引脚编号(如A0,A1,A2,A3)不同的开发板模拟输入引脚数量不一样。 + +### 返回 + +从0到1023的整数值 + +### 范例 + +读取模拟A0引脚的值,并通过串口打印出来。 + +模拟输入示例 + +```arduino +void setup(){ + pinMode(A0, INPUT); + Serial.begin(9600); +} + +void loop(){ + Serial.println(analogRead(A0)); +} +``` + +
+
注意
+
如果模拟输入引脚没有连入电路,由analogRead()返回的值将根据多项因素(例如其他模拟输入引脚,你的手靠近板子等)产生波动。
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/025-硬件中断.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/025-硬件中断.md new file mode 100644 index 00000000..9d7815b9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/025-硬件中断.md @@ -0,0 +1,84 @@ +## 硬件中断 + +中断管脚 + +```arduino +void attachInterrupt_fun_RISING_2() { +} + +void setup(){ + pinMode(2, INPUT_PULLUP); +} + +void loop(){ + attachInterrupt(digitalPinToInterrupt(2),attachInterrupt_fun_RISING_2,RISING); +} +``` + +### 1.1 描述 + +> 当发生外部中断时,调用一个指定函数。当中断发生时,该函数会取代正在执行的程序。 +> +> 大多数的Arduino板有两个外部中断:0(数字引脚2)和1(数字引脚3)。 +> +> Arduino Mege有四个外部中断:数字2(引脚21),3(20针),4(引脚19),5(引脚18)。 +> +> ESP8266 、ESP32系列有更多中断。 + +### 1.2 参数 + +- 管脚: 引脚编号(如2,3)不同的开发板中断引脚不一样。 + +- 模式: + + > 改变:当引脚电平发生改变时,触发中断 + > + > 上升:当引脚由低电平变为高电平时,触发中断 + > + > 下降:当引脚由高电平变为低电平时,触发中断 + +### 1.3 范例 + +利用2号引脚中断,控制13号引脚的LED亮灭。 + +中断管脚示例 + +```arduino +volatile boolean state; + +void attachInterrupt_fun_RISING_2() { + state = !state; + digitalWrite(13,state); +} + +void setup(){ + state = false; + pinMode(2, INPUT_PULLUP); + pinMode(13, OUTPUT); + attachInterrupt(digitalPinToInterrupt(2),attachInterrupt_fun_RISING_2,RISING); +} + +void loop(){ +} +``` + +
+
注意
+
当中断函数发生时,delay()和millis()的数值将不会继续变化。当中断发生时,串口收到的数据可能会丢失。你应该声明一个变量来在未发生中断时储存变量。
+
+ +## 取消硬件中断 + +取消中断 + +```arduino +detachInterrupt(digitalPinToInterrupt(2)); +``` + +### 2.1 描述 + +> 关闭给定的中断。 + +### 2.2 参数 + +- 管脚: 引脚编号(如2,3)不同的开发板中断引脚不一样。 diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/030-管脚模式.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/030-管脚模式.md new file mode 100644 index 00000000..4a0c89c5 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/030-管脚模式.md @@ -0,0 +1,17 @@ +## 管脚模式 + +管脚模式 + +```arduino +pinMode(2, INPUT); +``` + +### 描述 + +> 设置指定管脚的模式。 + +### 参数 + +- 管脚: 引脚编号(如2,3)不同的开发板中断引脚不一样。 +- 模式: 要将管脚设置成的模式,包括输入、输出、上拉输入。 + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/035-脉冲长度.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/035-脉冲长度.md new file mode 100644 index 00000000..f282fbd3 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/035-脉冲长度.md @@ -0,0 +1,42 @@ +## 脉冲长度 + +脉冲长度 + +```arduino +pulseIn(0, HIGH); +pulseIn(0, HIGH, 1000000); +``` + +### 描述 + +> 读取一个引脚的脉冲(HIGH或LOW)。 +> +> 例如,如果value是HIGH,pulseIn()会等待引脚变为HIGH,开始计时,再等待引脚变为LOW并停止计时。返回脉冲的长度,单位微秒。如果在指定的时间内无脉冲,函数返回。 此函数的计时功能由经验决定,长时间的脉冲计时可能会出错。计时范围从10微秒至3分钟。(1秒=1000毫秒=1000000微秒) + +### 参数 + +- 管脚:你要进行脉冲计时的引脚号(int)。 +- 状态:要读取的脉冲类型,HIGH或LOW(int)。 +- 超时 (可选):指定脉冲计数的等待时间,单位为微秒,默认值是1秒(unsigned long)。 + +### 返回 + +脉冲长度(微秒),如果等待超时返回0(unsigned long) + +### 范例 + +读取6号引脚脉冲时长。 + +脉冲长度示例 + +```arduino +void setup(){ + pinMode(6, INPUT); + Serial.begin(9600); +} + +void loop(){ + Serial.println(pulseIn(6, HIGH)); +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/040-ShiftOut.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/040-ShiftOut.md new file mode 100644 index 00000000..887cad20 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/040-ShiftOut.md @@ -0,0 +1,19 @@ +## ShiftOut + +image-20220528150921075 + +```arduino +shiftOut(2, 3, MSBFIRST, 0); // 高位先入 +shiftOut(2, 3, LSBFIRST, 0); // 低位先入 +``` + +### 描述 + +> 将一个数据的一个字节一位一位的移出。从最高有效位(最左边)或最低有效位(最右边)开始。依次向数据脚写入每一位,之后时钟脚被拉高或拉低,指示刚才的数据有效。 + +### 参数 + +- 数据管脚:输出每一位数据的引脚(int) +- 时钟管脚:时钟脚,当数据管脚有值时此引脚电平变化(int) +- 顺序:输出位的顺序,最高位优先或最低位优先 +- 数值: 要移位输出的数据(byte) \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/045-软件中断.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/045-软件中断.md new file mode 100644 index 00000000..2d78402b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/045-软件中断.md @@ -0,0 +1,57 @@ +## 软件中断 + +软件中断 + +```arduino +#include + +void attachPinInterrupt_fun_RISING_2() { +} + +void setup(){ + pinMode(2, INPUT); + PCintPort::attachInterrupt(2,attachPinInterrupt_fun_RISING_2,RISING); +} + +void loop(){ +} +``` + +### 1.1 描述 + +> 当发生外部中断时,调用一个指定函数。当中断发生时,该函数会取代正在执行的程序。 +> +> 本模块为模拟中断,支持所有管脚使用。 + +### 1.2 参数 + +- 管脚: 引脚编号(如2,3)不同的开发板中断引脚不一样。 + +- 模式: + + 改变:当引脚电平发生改变时,触发中断上升:当引脚由低电平变为高电平时,触发中断下降:当引脚由高电平变为低电平时,触发中断 + +### 1.3 范例 + +利用中断,控制13号引脚的LED亮灭。 + +
+
注意
+
当中断函数发生时,delay()和millis()的数值将不会继续变化。当中断发生时,串口收到的数据可能会丢失。你应该声明一个变量来在未发生中断时储存变量。
+
+ +## 取消软件中断 + +取消软件中断 + +```arduino +PCintPort::detachInterrupt(2); +``` + +### 2.1 描述 + +> 关闭给定的中断。 + +### 2.2 参数 + +- 管脚: 引脚编号(如2,3)不同的开发板中断引脚不一样。 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/050-多功能按键.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/050-多功能按键.md new file mode 100644 index 00000000..b1427d29 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/002-输入输出/050-多功能按键.md @@ -0,0 +1,56 @@ +## 多功能按键 + +多功能按键 + +```arduino + +#include + +OneButton button2(2, false); + +void attachClick2() { +} + +void setup(){ + button2.attachClick(attachClick2); +} + +void loop(){ + button2.tick(); +} +``` + +### 描述 + +> 设置特定管脚连接的按钮为多功能按钮,并确定不同模式下执行不同的程序。 + +### 参数 + +- 多功能按键: 引脚编号(如1,5,10,A0,A3) +- 模式: 单击 双击 长按开始 长按中 长按结束 + +### 范例 + +将2号端口连接的按钮设置为多功能按钮,单击时串口提示“one Click”。 + +多功能按键示例 + +```arduino +#include + +OneButton button2(2, false); + +void attachClick2() { + Serial.println("one click"); +} + +void setup(){ + button2.attachClick(attachClick2); + Serial.begin(9600); +} + +void loop(){ + button2.tick(); +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/001-控制介绍.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/001-控制介绍.md new file mode 100644 index 00000000..0896bf0b --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/001-控制介绍.md @@ -0,0 +1,5 @@ +## 控制 + +控制类别中包括了时间延迟、条件执行、循环执行、获取运行时间、初始化、Switch执行等 控制模块中主要执行的内容是对程序结构进行的相应控制。 + +控制分类 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/005-初始化.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/005-初始化.md new file mode 100644 index 00000000..15cdc3ba --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/005-初始化.md @@ -0,0 +1,61 @@ +## 初始化 + +初始化 + +```arduino +void setup(){ + pinMode(3, OUTPUT); + digitalWrite(3, HIGH); +} + +void loop(){ +} +``` + +### 描述 + +> 在Arduino中程序运行时将首先调用 setup()函数。 用于初始化变量、设置针脚的输出输入类型、配置串口、引入类库文件等等。 + +### 范例1 + +初始化时声明变量。 + +初始化示例1 + +```arduino +volatile int item; + +void setup(){ + item = 0; +} + +void loop(){ +} +``` + +### 范例2 + +在初始化时定义中断函数。 + +初始化示例2 + +```arduino +void attachInterrupt_fun_RISING_2() { + digitalWrite(13, LOW); +} + +void setup(){ + pinMode(13, OUTPUT); + pinMode(2, INPUT_PULLUP); + digitalWrite(13, HIGH); + attachInterrupt(digitalPinToInterrupt(2), attachInterrupt_fun_RISING_2,RISING); +} + +void loop(){ +} +``` + +
+
注意
+
每次 Arduino 上电或重启后,setup 函数只运行一次。
+
diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/010-while 循环.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/010-while 循环.md new file mode 100644 index 00000000..0886b106 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/010-while 循环.md @@ -0,0 +1,36 @@ +## while 循环 + +while + +```arduino +while (true) { +} +``` + +### 描述 + +> while循环会无限的循环,直到括号内的判断语句变为假。 必须要有能改变判断语句的东西,要不然while循环将永远不会结束。你可以使用一个传感器的值,或者一个变量来控制什么时候停止该循环。 + +### 参数 + +- 满足条件:为真或为假的一个条件。 + +### 范例 + +当温度高于30度时,亮灯,否则灭灯。 + +while示例 + +```arduino +void setup(){ + pinMode(13, OUTPUT); +} + +void loop(){ + while (analogRead(A0)*0.488 > 30) { + digitalWrite(13, HIGH); + } + digitalWrite(13, LOW); +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/015-延时.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/015-延时.md new file mode 100644 index 00000000..e6d73b76 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/015-延时.md @@ -0,0 +1,43 @@ +## 延时 + +延时 + +```arduino +delay(1000); +``` + +### 描述 + +> 使程序暂定设定的时间(单位毫秒)。(一秒等于1000毫秒)。 + +### 参数 + +- 毫秒:暂停的毫秒数。 + +### 范例 + +13号引脚灯亮1秒,灭1秒,往复循环。 + +延时示例 + +```arduino +void setup(){ + pinMode(13, OUTPUT); +} + +void loop(){ + digitalWrite(13, HIGH); + delay(1000); + digitalWrite(13, LOW); + delay(1000); +} +``` + +
+
注意
+
虽然创建一个使用delay()的闪烁LED很简单,并且许多例子将很短的delay用于消除开关抖动。 +

+但delay()确实拥有很多显著的缺点。在delay函数使用的过程中,读取传感器值、计算、引脚操作均无法执行,因此,它所带来的后果就是使其他大多数活动暂停。大多数熟练的程序员通常避免超过10毫秒的delay(),除非arduino程序非常简单。 +

+利用定时器,就可以解决这个问题,可以避免由于delay()带来的CPU暂停,也能很好地实现每隔一定时间执行动作。
+
diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/020-if 选择.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/020-if 选择.md new file mode 100644 index 00000000..f9e1c2cf --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/020-if 选择.md @@ -0,0 +1,86 @@ +## if 选择 + +if + +```arduino +if (false) { +} +``` + +### 描述 + +> if 语句与比较运算符一起用于检测某个条件是否达成,如某个传感器的值是否等于某个值。 + +### 参数 + +- 条件:比较表达式 + +### 用法 + +增加条件:如果需要增加条件,可以点开齿轮,然后将左侧的“否则如果”或者“否则”模块拖到右侧的“如果”之中。 + +if-else + +### 范例1 + +当连接在2号引脚的按键按下时,点亮13号引脚的灯。 + +if-else示例1 + +```arduino +void setup(){ + pinMode(2, INPUT); + pinMode(13, OUTPUT); +} + +void loop(){ + if (digitalRead(2) == 1) { + digitalWrite(13, HIGH); + } +} +``` + +如果判断的条件大于等于1时,可以省略等于判断,因为只要 该表达式的结果不为0,则为真。 + +所以,上面的写法与下面的写法等效。 + +if-ese示例2 + +```arduino +void setup(){ + pinMode(2, INPUT); + pinMode(13, OUTPUT); +} + +void loop(){ + if (digitalRead(2)) { + digitalWrite(13, HIGH); + } +} +``` + +### 范例2 + +当连接在2号引脚的按键按下时,点亮13号引脚的灯;当按键松开时,灯灭。 + +if-else示例3 + +```arduino +void setup(){ + pinMode(2, INPUT); + pinMode(13, OUTPUT); +} + +void loop(){ + if (digitalRead(2)) { + digitalWrite(13, HIGH); + } else { + digitalWrite(13, LOW); + } +} +``` + +
+
注意
+
另外一种进行多种条件分支判断的语句是switch case语句。
+
diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/025-switch 选择.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/025-switch 选择.md new file mode 100644 index 00000000..35bad033 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/025-switch 选择.md @@ -0,0 +1,55 @@ +## switch 选择 + +switch + +```arduino +switch (NULL) { +} +``` + +### 描述 + +> 和if语句相同,switch…case通过设定的在不同条件下执行的代码控制程序的流程。 +> +> 特别地,switch语句将变量值和case语句中设定的值进行比较。当一个case语句中的设定值与变量值相同时,这条case语句将被执行。 +> +> 关键字break可用于退出switch语句,通常每条case语句都以break结尾。如果没有break语句,switch语句将会一直执行接下来的语句(一直向下)直到遇见一个break,或者直到switch语句结尾。 + +### 参数 + +- var: 用于与下面的case中的标签进行比较的变量值 +- label: 与变量进行比较的值 + +### 用法 + +增加case:如果需要增加条件,可以点开齿轮,然后将左侧的“case”或者“default”模块拖到右侧的“switch”之中。 + +switch-case + +### 范例 + +当连接在2号引脚的按键按下时,点亮13号引脚的灯,否则13号引脚的灯灭。 + +switch-case示例 + +```arduino +void setup(){ + pinMode(2, INPUT); + pinMode(13, OUTPUT); +} + +void loop(){ + switch (digitalRead(2)) { + case true: + digitalWrite(13, HIGH); + break; + default: + digitalWrite(13, HIGH); + } +} +``` + +
+
注意
+
每个switch可以有多个case,但是最多不超过一个default,当不满足任何一个case时,执行default中的程序。
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/030-for 循环.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/030-for 循环.md new file mode 100644 index 00000000..e9090c5c --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/030-for 循环.md @@ -0,0 +1,54 @@ +## for 循环 + +for + +```arduino +for (int i = 1; i <= 10; i = i + (1)) { +} +``` + +### 描述 + +> for循环用于重复执行一段的程序。通常使用一个增量计数器计数并终止循环。 +> +> for循环用于重复性的操作非常有效,通常与数组结合起来使用来操作数据、引脚。 + +### 参数 + +- 变量名:用于记录for循环次数的变量名。 +- 起始值:循环的计数起始值,一般从0开头,也可以从其他数值开始。 +- 终点值:循环的计数终点值。 +- 步长:每次循环的步长,一般为1,也可以是其他整数。 + +### 用法 + +可自行设置循环的变量名称,并确定循环的开始和终止以及循环方向,最后一个数字可以为负数。 + +for示例1 + +### 范例 + +将连接在3号引脚的灯制作成呼吸灯,每一次亮度变化之间间隔50毫秒。 + +for示例2 + +```arduino +void setup(){ +} + +void loop(){ + for (int i = 0; i <= 255; i = i + (1)) { + analogWrite(3, i); + delay(50); + } + for (int i = 255; i >= 0; i = i + (-1)) { + analogWrite(3, i); + delay(50); + } +} +``` + +
+
注意
+
for循环中定义的变量有名字,可以用字母i,j,k或单词red,state等有意义的词语表示。
+
diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/035-跳出循环.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/035-跳出循环.md new file mode 100644 index 00000000..55e099ef --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/035-跳出循环.md @@ -0,0 +1,46 @@ +## 跳出循环 + +break + +```arduino +break; +``` + +### 描述 + +> 跳出循环用于终止一段重复的程序,一般使用时作为条件语句的执行部分,当循环中的变量满足某个条件时,执行跳出循环语句。 +> +> 跳出循环在处理循环中的特殊情况时十分有用。 + +### 参数 + +- 操作:可以选择跳出循环和跳到下一个循环两种操作,结果不同。 + +### 范例 + +引脚3上的数字从0到255逐一增加,每一次增加之间间隔50毫秒,当数字增加到150时停止增加。 + +break示例 + +```arduino +void setup(){ + pinMode(A0, INPUT); + pinMode(3, OUTPUT); +} + +void loop(){ + for (int i = 0; i <= 255; i = i + (1)) { + if (analogRead(A0) == 130) { + break; + } else { + analogWrite(3, i); + delay(50); + } + } +} +``` + +
+
注意
+
注意跳到下一个循环的使用,可以方便的将循环中不需要的步骤跳过。
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/040-系统运行时间.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/040-系统运行时间.md new file mode 100644 index 00000000..668af8b0 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/040-系统运行时间.md @@ -0,0 +1,36 @@ +## 系统运行时间 + +系统运行时间 + +```arduino +millis(); // 系统运行时间(毫秒) +micros(); // 系统运行时间(微秒) +``` + +### 描述 + +> 返回自硬件启动或重启以来的时间值。 + +### 返回 + +自硬件启动或重启以来的时间,毫秒数或者微秒数。 + +### 范例 + +自动换行打印系统运行时间。 + +系统运行时间示例 + +```arduino +void setup(){ + pinMode(2, INPUT); + Serial.begin(9600); +} + +void loop(){ + if (digitalRead(2)) { + Serial.println(millis()); + } +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/045-MsTimer2 定时器.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/045-MsTimer2 定时器.md new file mode 100644 index 00000000..283bafd9 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/045-MsTimer2 定时器.md @@ -0,0 +1,65 @@ +## MsTimer2 定时器 + +MsTimer2 + +```arduino +MsTimer2::set(500, msTimer2_func); +``` + +### 1.1 描述 + +> 每隔设置的毫秒数执行相应的程序 + +### 1.2 范例 + +利用定时器控制13号引脚LED每隔1秒亮灭一次。 + +MsTimer2示例 + +```arduino +#include + +volatile boolean state; + +void msTimer2_func() { + state = !state; + digitalWrite(13, state); +} + +void setup(){ + state = false; + pinMode(13, OUTPUT); + MsTimer2::set(1000, msTimer2_func); + MsTimer2::start(); +} + +void loop(){ +} +``` + +
+
注意
+
利用定时器可以提高硬件的工作效率。 +

+但在一个程序中只能使用一个MsTimer2定时器,如果要实现多个时间的定时,可以配合变量计数来完成。
+
+ +## MsTimer2 定时器启动 + +MsTimer2启动 + +```arduino +MsTimer2::start(); +``` + +### 2.1 描述 + +> MsTimer2定时器开始计时 + +## MsTimer2 定时器停止 + +MsTimer2停止 + +### 3.1 描述 + +> MsTimer2定时器停止计时 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/050-简单定时器.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/050-简单定时器.md new file mode 100644 index 00000000..b50df9be --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/050-简单定时器.md @@ -0,0 +1,56 @@ +## 简单定时器 + +简单定时器 + +```arduino +#include + +SimpleTimer timer; + +void Simple_timer_1() { +} + +void setup(){ + timer.setInterval(1000L, Simple_timer_1); +} + +void loop(){ + timer.run(); +} +``` + +### 描述 + +> 设置不同的简单定时器,每隔指定秒数执行相应的程序常用于多任务处理。 + +### 范例 + +12,13分别连接LED灯,每隔200ms,12引脚LED灯切换亮灭; 每隔300ms,D13引脚LED灯切换亮灭。 + +简单定时器示例 + +```arduino +#include + +SimpleTimer timer; + +void Simple_timer_1() { + digitalWrite(12,digitalRead(12)); +} + +void Simple_timer_2() { + digitalWrite(13,digitalRead(13)); +} + +void setup(){ + pinMode(12, OUTPUT); + timer.setInterval(200L, Simple_timer_1); + pinMode(13, OUTPUT); + timer.setInterval(300L, Simple_timer_2); +} + +void loop(){ + timer.run(); +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/055-中断.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/055-中断.md new file mode 100644 index 00000000..82fa9dd4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/055-中断.md @@ -0,0 +1,68 @@ +## 允许中断 + +允许中断 + +```arduino +interrupts(); +``` + +### 1.1 描述 + +> 允许输入/输出模块中管脚中断的运行 + +### 1.2 范例 + +使用按钮模拟开关,每次按下,LED灯切换亮灭。 + +允许中断示例 + +```arduino +void attachInterrupt_fun_RISING_2() { + digitalWrite(10,digitalRead(10)); +} + +void setup(){ + pinMode(2, INPUT_PULLUP); + pinMode(10, OUTPUT); + interrupts(); + attachInterrupt(digitalPinToInterrupt(2), attachInterrupt_fun_RISING_2,RISING); +} + +void loop(){ +} +``` + +## 禁止中断 + +禁止中断 + +```arduino +noInterrupts(); +``` + +### 2.1 描述 + +> 禁止输入/输出模块中管脚中断的运行 + +### 2.2 范例 + +在允许中断范例的基础上,尝试禁止中断。 + +禁止中断示例 + +```arduino +void attachInterrupt_fun_RISING_2() { + digitalWrite(10,digitalRead(10)); +} + +void setup(){ + pinMode(2, INPUT_PULLUP); + pinMode(10, OUTPUT); + noInterrupts(); + attachInterrupt(digitalPinToInterrupt(2), attachInterrupt_fun_RISING_2,RISING); +} + +void loop(){ +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/060-SCoop Task.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/060-SCoop Task.md new file mode 100644 index 00000000..1a63b6ad --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/003-控制/060-SCoop Task.md @@ -0,0 +1,69 @@ +## SCoop Task + +SCoop Task + +```arduino +#include "SCoop.h" + +defineTask(scoopTask1) +void scoopTask1::setup(){ +} +void scoopTask1::loop(){ +} + +void setup(){ + mySCoop.start(); +} + +void loop(){ + yield(); + sleep(1000); +} +``` + +### 描述 + +> SCoop模块用于执行多线程任务,最多支持8个任务。 + +### 范例 + +利用SCoop,控制13号引脚LED灯以2秒的频率闪烁,同时控制12号引脚的LED灯以200毫秒的频率闪烁。 + +SCoop Task示例 + +```arduino +#include "SCoop.h" + +defineTask(scoopTask1) +void scoopTask1::setup(){ + pinMode(13, OUTPUT); +} +void scoopTask1::loop(){ + digitalWrite(13, HIGH); + sleep(1000); + digitalWrite(13, LOW); + sleep(1000); +} + +defineTask(scoopTask2) +void scoopTask2::setup(){ + pinMode(12, OUTPUT); +} +void scoopTask2::loop(){ + digitalWrite(12, HIGH); + sleep(100); + digitalWrite(12, LOW); + sleep(100); +} + +void setup(){ + pinMode(13, OUTPUT); + mySCoop.start(); + pinMode(12, OUTPUT); +} + +void loop(){ + yield(); +} +``` + diff --git a/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/home.md b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/home.md new file mode 100644 index 00000000..2e328628 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/origin/wiki/wiki-libs/zh-hans/home.md @@ -0,0 +1,221 @@ +## 快捷键 + +### 1.1 页面操作快捷键 + +| 页面操作 | 快捷键 | +| :------------------: | :--------------------: | +| 重载页面 | `Ctrl` + `R` | +| 还原页面 | `Ctrl` + `0` | +| 关闭窗口 | `Ctrl` + `W` | +| 最小化窗口 | `Ctrl` + `M` | +| 打开新窗口 | `Ctrl` + `Shift` + `N` | +| 缩小页面 | `Ctrl` + `Shift` + `-` | +| 放大页面 | `Ctrl` + `Shift` + `=` | +| 打开或关闭开发者工具 | `Ctrl` + `Shift` + `I` | + +### 1.2 Blockly图形块操作快捷键 + +| Blockly图形块操作 | 快捷键 | +| :---------------: | :--------------------: | +| 复制 | `Ctrl` + `C` | +| 粘贴 | `Ctrl` + `V` | +| 查找 | `Ctrl` + `F` | +| 跨页面复制 | `Ctrl` + `Shift` + `C` | +| 跨页面粘贴 | `Ctrl` + `Shift` + `V` | + +### 1.3 代码编辑器操作快捷键 + +| 代码编辑器操作 | 快捷键 | +| :------------: | :--------------------: | +| 命令面板 | `F1` | +| 查找 | `Ctrl` + `F` | +| 替换 | `Ctrl` + `H` | +| 增大字体 | `Ctrl` + `=` | +| 减小字体 | `Ctrl` + `-` | +| 切换行注释 | `Ctrl` + `/` | +| 切换块注释 | `Ctrl` + `Shift` + `/` | + +### 1.4 状态栏操作快捷键 + +| 状态栏操作 | 快捷键 | +| :--------: | :--------------------: | +| 增大字体 | `Ctrl` + `=` | +| 减小字体 | `Ctrl` + `-` | +| 清空状态栏 | `Ctrl` + `E` | +| 串口终端 | `Ctrl` + `T` | +| 发送Ctrl+C | `Ctrl` + `Shift` + `C` | +| 发送Ctrl+D | `Ctrl` + `Shift` + `D` | + +## 界面介绍 + +Mixly软件主要分成图形化程序选择区、图形化程序编辑区、代码预览区、系统功能区、消息提示区。 + +界面1 + +### 2.1 图形化程序选择区 + +图形化程序选择区中包含了各类图形化程序,每一个类别中都包含多个图形化。通过将这些图形块拖动到图形化程序编辑区就可以完成编程。 + +图形化程序选择区 + +如果你是初次使用,不知道某些图形块所处的分类名,也可以通过图形化程序选择区上方的搜索框来查找带有某一个或几个关键词的图形块。通过输入多个关键词可实现精确查找。 + +| ![查找1]({default}/images/base/interface-4.png) | ![查找2]({default}/images/base/interface-5.png) | +| ----------------------------------------------- | ----------------------------------------------- | + +
+
注意
+
在图形化程序选择区中查找图形块时,多个关键词之间需用空格分隔开。
+
+ +### 2.2 程序编写区 + +程序编写区 + +#### 1. 程序编写 + +我们通常把能完成一定功能的代码块拖动到该区域处进行连接。 + +#### 2. 程序删除 + +- 将不需要的代码拖到右下方的垃圾桶。 +- 将不用的代码拖到最左侧的图形化程序选择区。 +- 选中不用的代码后点击键盘Delete或者Backspace键。 + +#### 3. 程序缩放 + +在右下角垃圾桶上方有缩放按钮。 + +- 第一个按钮是图形块大小正常化并居中。 +- 第二个是放大图形块。 +- 第三个是缩小图形块。 + +程序缩放 + +当然,你也可以直接使用鼠标滚轮进行缩放。 + +#### 4. 程序整理 + +当编写的程序比较多时,需要对程序进行整理。 + +在空白区右击,选择清理块。 + +| 清理前 | 清理后 | +| :----------------------------------------------: | :----------------------------------------------: | +| ![清理前]({default}/images/base/interface-8.png) | ![清理后]({default}/images/base/interface-9.png) | + +#### 5. 程序复制 + +在图形块上右击,选择复制,会产生一个一样的块,但该方式只能复制一个块。 + +程序复制 + +先用鼠标拖住多个块,再按下 `Ctrl` + `Shift` + `C`,`Ctrl` + `Shift` + `V` 可以复制多块。 + +#### 6. 撤销及重做 + +在返回主页面按钮右边有两个连续的按钮,分别是撤销(undo,`Ctrl` + `Z`)及重做(redo,`Ctrl` + `Y`)。 + +撤销功能是当我们编写代码时误删代码后,便可点击左箭头或直接按 `Ctrl` + `Z` 来恢复误删代码。 + +而重做则是和 `Ctrl` + `Z` 相反,它是恢复上一步操作,该功能也可通过点击右箭头或直接键入 `Ctrl` + `Y` 来实现。 + +#### 7. 垃圾桶 + +被删除的块可以在垃圾桶里找到,点击右下角垃圾桶图标即可显示此前被删除的所有图形块。 + +| 无被删除的图形块 | 有被删除的图形块 | +| :----------------------------------------------------------: | :----------------------------------------------------------: | +| 垃圾桶无可回收块 | 垃圾桶 | + +#### 8. 背包 + +在图形块上右击,选择加入背包即可将当前图形块放入背包,你可以将任意图形块或拼接块加入背包。 + +加入背包 + +在背包中用鼠标悬浮与某个块同时右击,选择从背包中移除即可将此块从背包中删除。如果想清空背包中的所有块,鼠标在右上角的书包上右击,选择清空即可。 + +| 背包 | 从背包中移除 | 清空背包 | +| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| 背包 | 从背包中移除 | 清空背包 | + +#### 9. 查找图形块 + +当图形化程序编写区中图形块过多时,你可以使用图形块查找工具来快速定位你所要查看的图形块。通过在图形化程序编写区中右击,选择查找图形块,你可以打开图形块查找工具。 + +| 查找图形块按钮 | 查找图形块工具 | +| :----------------------------------------------------------: | :----------------------------------------------------------: | + +查找图形块示例 + +输入一个关键词即可查找出对应的图形化模块,其中灰色块为当前查找所定位的图形块,而黑色块为查找出的全部图形块,你可以使用此工具中的上下箭头来定位上一个或下一个图形块。 + +#### 10. 打开wiki + +当在板卡页面配置中开启wiki并且当某个图形块关联了此wiki中某一页时,将会在图形化的右键菜单里显示打开wiki选项,点击后即可在新页面下打开关联的wiki页。 + +### 2.3 代码预览区 + +代码预览区 + +该区域可通过点击右侧深灰色箭头来显示或隐藏。 + +在图形化程序选择区拖拽图形块后,在代码编辑区会生成对应的代码。可以帮助用户掌握代码的学习。 + +
+
注意
+
在该区域无法直接对代码进行编辑,需要点击图形化程序选择区左上角的 代码 按钮才能进行编辑。
+
+ +### 2.4 消息提示区 + +#### 1. 输出 + +输出栏通常是给学生予以信息反馈的场所。比如编译或上传进程中,编译或上传是否成功,如果失败原因是什么。 + +![输出]({default}/images/base/interface-21.png) + +#### 2. 串口 + +串口栏用于实时显示串口收到的数据,如果代码中包含 `Serial.begin(xxx);` ,则在代码上传完成后打开串口时自动将波特率设置为xxx。注意,xxx只可以在[9600, 19200, 28800, 38400, 57600, 115200]中取值,如果代码中设置的值不在此范围内,串口打开时的波特率将会使用配置文件中的默认值。 + +串口栏支持同时接收多个串口的数据,并支持使用mixly提供的相关串口指令操作串口。当然,你也可以在串口栏中右击来选择需要进行的操作。 + +| 打开多个串口 | 右键菜单 | 串口终端 | +| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| 打开多个串口 | 右键菜单 | 串口终端 | + +### 2.5 系统功能区 + +系统功能区主要执行的功能有新建、打开、保存、另存为、导入库、管理库、编译、上传、选择主控板型号及端口、串口监视器及工作区切换等功能。 + +系统功能区 + +## 编译&上传 + +当用户编写完代码后,如果想要检查代码逻辑是否有误,可点击编译。 + +如果显示“编译失败”,则需要根据提示检查自己的代码,如显示“编译成功”则证明代码逻辑上无误,可上传。 + +如果出现“上传失败”,大多数情况插拔USB线即可解决该问题。 + +如果出现“上传成功”,则证明代码已上传至板子上。当然,如果用户对于代码逻辑信心十足,可直接点击上传按钮。 + +## 板卡&端口 + +当用户点击主控板下拉三角时即可看到有众多主控板型号可供选择。用户需按照当前手中主控板型号予以选择。 + +板卡 + +选择好板卡后,还需要选择该板卡对应的端口号,端口号是计算机与板卡通信的通道。 + +端口 + +## 串口监视器 + +串口监视器与模块选择区的通信模块中的串口通信指令一起使用。 可以用于输出变量、传感器数值等。 + +| ![串口监视器]({default}/images/base/interface-28.png) | ![串口可视化]({default}/images/base/interface-29.png) | +| :---------------------------------------------------: | :---------------------------------------------------: | + diff --git a/mixly/boards/default_src/arduino_avr/package.json b/mixly/boards/default_src/arduino_avr/package.json new file mode 100644 index 00000000..2a5ccd64 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/package.json @@ -0,0 +1,33 @@ +{ + "name": "@mixly/arduino-avr", + "version": "1.9.0", + "description": "适用于mixly的arduino avr模块", + "scripts": { + "serve": "webpack-dev-server --config=webpack.dev.js", + "build:dev": "webpack --config=webpack.dev.js", + "build:prod": "npm run build:examples & webpack --config=webpack.prod.js", + "build:examples": "node ../../../scripts/build-examples.js -t special", + "build:examples:ob": "node ../../../scripts/build-examples.js -t special --obfuscate", + "publish:board": "npm publish --registry https://registry.npmjs.org/" + }, + "main": "./export.js", + "author": "Mixly Team", + "keywords": [ + "mixly", + "mixly-plugin", + "arduino-avr" + ], + "homepage": "https://gitee.com/bnu_mixly/mixly3/tree/master/boards/default_src/arduino_avr", + "bugs": { + "url": "https://gitee.com/bnu_mixly/mixly3/issues" + }, + "repository": { + "type": "git", + "url": "https://gitee.com/bnu_mixly/mixly3.git", + "directory": "default_src/arduino_avr" + }, + "publishConfig": { + "access": "public" + }, + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/pins/pins.js b/mixly/boards/default_src/arduino_avr/pins/pins.js new file mode 100644 index 00000000..c84a954e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/pins/pins.js @@ -0,0 +1,156 @@ +const pins = {}; + +pins.arduino_standard = { + description: "standard", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"]], + pwm: [["3", "3"], ["5", "5"], ["6", "6"], ["9", "9"], ["10", "10"], ["11", "11"]], + interrupt: [["2", "2"], ["3", "3"]], + SDA: [["A4", "A4"]], + SCL: [["A5", "A5"]], + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_mega = { + description: "Mega", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"], ["46", "46"], ["47", "47"], ["48", "48"], ["49", "49"], ["50", "50"], ["51", "51"], ["52", "52"], ["53", "53"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"], ["A12", "A12"], ["A13", "A13"], ["A14", "A14"], ["A15", "A15"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"], ["A12", "A12"], ["A13", "A13"], ["A14", "A14"], ["A15", "A15"]], + pwm: [["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"]], + interrupt: [["2", "2"], ["3", "3"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"]], + SDA: [["20", "20"]], + SCL: [["21", "21"]], + MOSI: [["51", "51"]], + MISO: [["50", "50"]], + SCK: [["52", "52"]], + SS: [["53", "53"]], + serial_select: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"], ["Serial3", "Serial3"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_eightanaloginputs = { + description: "eightanaloginputs", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"]], + pwm: [["3", "3"], ["5", "5"], ["6", "6"], ["9", "9"], ["10", "10"], ["11", "11"]], + interrupt: [["2", "2"], ["3", "3"]], + SDA: [["A4", "A4"]], + SCL: [["A5", "A5"]], + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_ethernet = { + description: "ethernet", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"]], + pwm: [["3", "3"], ["5", "5"], ["6", "6"], ["9", "9"], ["10", "10"], ["11", "11"]], + interrupt: [["2", "2"], ["3", "3"]], //本无 + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_gemma = { + description: "gemma", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"]], + pwm: [["0", "0"], ["1", "1"]], + interrupt: [["2", "2"], ["3", "3"]], //本无 + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_leonardo = { + description: "leonardo, micro, yun", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"]], + pwm: [["3", "3"], ["5", "5"], ["6", "6"], ["9", "9"], ["10", "10"], ["11", "11"], ["13", "13"]], + interrupt: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["7", "7"]], + SDA: [["2", "2"]], + SCL: [["3", "3"]], + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["Serial1", "Serial1"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_robot = { + description: "robot", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"]], + analog: [["A0", "A0"], ["A1", "A1"], ["A2", "A2"], ["A3", "A3"], ["A4", "A4"], ["A5", "A5"], ["A6", "A6"], ["A7", "A7"], ["A8", "A8"], ["A9", "A9"], ["A10", "A10"], ["A11", "A11"]], + pwm: [["3", "3"], ["6", "6"], ["9", "9"], ["10", "10"], ["11", "11"], ["13", "13"]], + interrupt: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["7", "7"]], + MOSI: [["11", "11"]], + MISO: [["12", "12"]], + SCK: [["13", "13"]], + serial_select: [["Serial", "Serial"], ["Serial1", "Serial1"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins["Arduino Leonardo"] = +pins["Arduino Leonardo ETH"] = +pins["Arduino/Genuino Micro"] = +pins["Arduino Esplora"] = +pins["LilyPad Arduino USB"] = +pins["Arduino Yun"] = +pins["Arduino Yun Mini"] = +pins["Arduino Yún"] = +pins["Arduino Yún Mini"] = +pins.arduino_leonardo; + +pins["Arduino Robot Control"] = +pins["Arduino Robot Motor"] = +pins.arduino_robot; + +pins["Arduino Mega or Mega 2560"] = +pins["Arduino/Genuino Mega or Mega 2560"] = +pins["Arduino/Genuino Mega or Mega 1280"] = +pins["Arduino Mega ADK"] = +pins["Arduino Mega w/ ATmega2560"] = +pins["Arduino Mega w/ ATmega1280"] = +pins.arduino_mega; + +pins["Arduino Ethernet"] = +pins.arduino_ethernet; + +pins["Arduino Gemma"] = +pins.arduino_gemma; + +pins["Arduino Uno WiFi"] = +pins["Arduino/Genuino Uno"] = +pins["Arduino Duemilanove or Diecimila"] = +pins["LilyPad Arduino"] = +pins["Arduino NG or older"] = +pins.arduino_standard; + +pins["Arduino Mini w/ ATmega168"] = +pins["Arduino Nano"] = +pins["Arduino Mini"] = +pins["Arduino Fio"] = +pins["Arduino BT"] = +pins["Arduino Pro or Pro Mini"] = +pins["Arduino Mini w/ ATmega328P"] = +pins["Arduino Nano w/ ATmega168"] = +pins["Arduino Nano w/ ATmega328P"] = +pins["Arduino Nano w/ ATmega328P (old bootloader)"] = +pins["Arduino Pro or Pro Mini"] = +pins["Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328P"] = +pins["Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328P"] = +pins["Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168"] = +pins["Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168"] = +pins.arduino_eightanaloginputs; + +export default pins; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/template.xml b/mixly/boards/default_src/arduino_avr/template.xml new file mode 100644 index 00000000..b43eeaff --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/template.xml @@ -0,0 +1,3614 @@ +<%= htmlWebpackPlugin.tags.headTags.join('\n') %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000000 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + 1 + + + + + 10 + + + + + 1 + + + + + + + + + + + + + 500 + + + + + + + + + + + 1 + + + 1000 + + + + + + + + 1000 + + + + + 1 + + + + + + + + + + + 1000 + + + + + + + + + + + 1 + + + + + 1 + + + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + item + + + + + ++ + + + item + + + + + + + + + + + + + + + 1 + + + + + 2 + + + + + + + 997 + + + millis + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + 1 + + + + + 1000 + + + + + + + + + + + + + + + + + + + + + hello + + + a + + + + + Hello + + + + + Mixly + + + + + + + A + + + + + B + + + + + C + + + + + + + 123 + + + + + + + Mixly + + + + + y + + + + + + + substring + + + + + 0 + + + + + 3 + + + + + + + 6.666 + + + + + 2 + + + + + + + String + + + + + + + String + + + + + s + + + + + Q + + + + + + + String + + + + + + + substring + + + + + substring + + + + + + + substring + + + + + + + 0xff0000 + + + + + + + 223 + + + + + a + + + + + 0 + + + + + + + hello + + + + + + + hello + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + mylist + + + + + int + mylist + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + mylist + + + + + 2 + + + + + 2 + + + + + {0,0},{0,0} + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + + + + + + + + + + + 9600 + + + + + + + Serial + println + + + + + 0 + + + + + + + + + + + a + + + + + + + + + + + + + + + + + + + + + 2 + 3 + + + 2 + + + + + + + + 2 + + + + + 0x77 + + + + + + + + + 10000 + + + + + 3950 + + + + + 10000 + + + + + + + 0x5A + + + + + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + + + + + + + + + + + + + + + 120 + + + + + + + 1992 + + + + + + + 2 + + + + + 3 + + + + + + + + + 0 + + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + A4 + + + + + A5 + + + + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + Jan/01/2020 + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + 12:34:56 + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + DATE + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + + + + + + + + + + + + + + + + 4800 + + + + + WHILE + + + + + + + + + + + + + location + + + + + Serial + + + location.lat + + + + + Serial + + + location.lng + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 100 + + + + + + + 5 + + + + + 4 + + + + + 100 + + + + + + + 100 + + + + + + + 2 + + + 0 + + + + + 0 + + + + + 2 + + + 1500 + + + + + 2 + + + + + 1 + + + + + 2 + + + + + 100 + + + + + 10 + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 100 + + + + + 10 + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 2 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 20 + + + + + + + + + + 1000 + + + + + mySerial + + + 10 + + + + + 11 + + + + + mySerial + + + 9600 + + + + + myPlayer + + + mySerial + + + + + + + + + + + 500 + + + + + + + 15 + + + + + + + myPlayer + + + 0 + + + DFPLAYER_EQ_NORMAL + + + + + myPlayer + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + + + 1 + + + + + + + myPlayer + readFileCounts + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + 1 + + + + + + + + + #ff0000 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + 2 + + + 4 + + + + + 2 + + + 20 + + + + + 2 + + + 1 + + + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 2 + + + 1 + + + + + 0 + + + + + 255 + + + + + 255 + + + + + 2 + + + 2 + + + 20 + + + + + 2 + + + 20 + + + + + + + + + clear + + + + + abcd + + + + + + + + + + 20 + + + + + + + + 2345 + + + + + + + 12 + + + + + 30 + + + + + + + + + 0x27 + + + + + 7 + 8 + 9 + 10 + 11 + 12 + + + + + + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + + + + mylcd + 0 + + + 1 + + + + + 1 + + + + + + + + + clear + + + + + + + + + + + + + 9 + 10 + 8 + + + 33ccff + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 0 + + + #000000 + + + + + + + TRUE + STHeiti + 16 + + + 米思齐 + + + + + 0 + + + + + 0 + + + + + 16 + + + + + 48 + + + + + 0xFCDF + + + 33ccff + + + + + + + 0 + + + + + 20 + + + + + + + + + 33ccff + + + + + + + + + + + 0 + + + + + 20 + + + + + + + + + 33ccff + + + + + 1234 + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + bitmap1 + + + + + + + 64 + + + + + 32 + + + + + + + + + 33ccff + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + + + 33ccff + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + + + 33ccff + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + + + 33ccff + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + + + 33ccff + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + + + 33ccff + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + 33ccff + + + + + + + + + 0x3C + + + + + + + + + + + + + + SSD1306_128X64_NONAME + U8G2_R0 + 10 + 9 + 8 + + + + + + + + + + + + U8G2_R0 + + + + + + + + + 10 + + + + + + + + + + + + U8G2_R0 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + + + + + + + + + + + + + + + page1 + + + + + + + 0 + + + + + 20 + + + + + 1234 + + + + + + + + + + bitmap + 96 + TRUE + + + 1 + 2 + 2 + STHeiti + 16 + 48 + 16 + 米思齐 + + + + + + + 0 + + + + + 0 + + + + + 128 + + + + + 64 + + + + + bitmap1 + + + + + + + + 100 + + + + + + + 20 + + + + + 0 + + + + + + + 0 + + + + + 20 + + + + + + + 64 + + + + + 32 + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + 15 + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + + + + + 9 + + + + + + + + + 1 + + + + + 1 + + + + + + + + + 1 + + + + + 1 + + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + + + Mixly + + + + + 300 + + + + + + + Mixly + + + + + + + 0 + + + + + + + + + + + + + + 5 + + + + + + + + + + + ir_item + + + 0 + + + + + Serial + println + HEX + + + ir_item + + + + + + + 3 + + + 0x89ABCDEF + + + + + 32 + + + + + + + + + + + + + + + 3 + + + 3 + + + + + 38 + + + + + + + + + + 0 + + + + + + + 8 + + + + + + + + + + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + mylist + + + + + 1 + + + + + + + + + + + howMany + + + + + + + + + + + 10 + + + + + + + + + + + + 0 + + + + + + + 10 + + + + + + + A + + + + + + + A + + + + + + + SPDR + + + + + + + SPDR + + + + + + + + + 10 + + + + + 13 + + + + + 11 + + + + + 12 + + + + + 9 + + + + + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + + 4 + + + + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + hello world + + + + + TRUE + + + + + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + item + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654n + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + wifi-ssid + + + + + wifi-pass + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + 1 + + + + + 0 + + + + + + + + + V0 + + + Serial + + + vpin_value + + + + + + + + + + + + 1000 + + + + + V0 + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + + 0 + + + + + + + + + #ff0000 + + + + + + + example@blynk.cc + + + + + Subject + + + + + Content + + + + + + + Notify + + + + + V0 + + + Serial + + + terminal_text + + + + + + + + + + + Hello,World! + + + + + V0 + + + Serial + + + hour + + + + + Serial + + + minute + + + + + Serial + + + second + + + + + + + + + + + + + V0 + + + 0 + + + + + 0 + + + + + 923 + + + + + + + + + http://yourvideostream.url + + + + + + + Test row + + + + + hello + + + + + V0 + + + Serial + + + index + + + + + Serial + + + selected + + + + + + + + + V0 + + + Serial + + + indexFrom + + + + + Serial + + + indexTo + + + + + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + BLYNK_CONNECTED + + + V0 + + + n2KlfPGDyjDBluNi1G9DG5OEjqDT996L + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + BLYNK_CONNECTED + + + + + 10 + + + + + + + + + V0 + + + action + String + + + + + + + + + + + EQ + + + action + + + + + play + + + + + + + play(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + stop + + + + + + + pause(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + next + + + + + + + next(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + prev + + + + + + + prev(); + + + 4 + + + + + 5 + + + + + + + + + + + V0 + + + Serial + + + lx + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + + + + + + + V0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/templates/func-array-rotate-loop.c b/mixly/boards/default_src/arduino_avr/templates/func-array-rotate-loop.c new file mode 100644 index 00000000..e2143b40 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/templates/func-array-rotate-loop.c @@ -0,0 +1,20 @@ +void array_rotate_loop(void *arr, size_t elem_size, size_t length, bool right) { + if (length <= 1) { + return; + } + + uint8_t buffer[32]; + if (elem_size > sizeof(buffer)) { + return; + } + + if (right) { + memcpy(buffer, (uint8_t *)arr + (length - 1) * elem_size, elem_size); + memmove((uint8_t *)arr + elem_size, arr, (length - 1) * elem_size); + memcpy(arr, buffer, elem_size); + } else { + memcpy(buffer, arr, elem_size); + memmove(arr, (uint8_t *)arr + elem_size, (length - 1) * elem_size); + memcpy((uint8_t *)arr + (length - 1) * elem_size, buffer, elem_size); + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/webpack.common.js b/mixly/boards/default_src/arduino_avr/webpack.common.js new file mode 100644 index 00000000..76e39a5e --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/webpack.common.js @@ -0,0 +1,19 @@ +const path = require('path'); +const common = require('../../../webpack.common'); +const { merge } = require('webpack-merge'); + +module.exports = merge(common, { + resolve: { + alias: { + '@mixly/arduino': path.resolve(__dirname, '../arduino') + } + }, + module: { + rules: [ + { + test: /\.(txt|c|cpp|h|hpp)$/, + type: 'asset/source' + } + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/webpack.dev.js b/mixly/boards/default_src/arduino_avr/webpack.dev.js new file mode 100644 index 00000000..31d3a078 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/webpack.dev.js @@ -0,0 +1,36 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ESLintPlugin = require('eslint-webpack-plugin'); + +module.exports = merge(common, { + mode: 'development', + devtool: 'source-map', + plugins: [ + new ESLintPlugin({ + context: process.cwd(), + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: false + }) + ], + devServer: { + https: true, + port: 8080, + host: '0.0.0.0', + hot: false, + static: { + directory: path.join(process.cwd(), '../../../'), + watch: false + }, + devMiddleware: { + index: false, + publicPath: `/boards/default/${path.basename(process.cwd())}`, + writeToDisk: true + } + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_avr/webpack.prod.js b/mixly/boards/default_src/arduino_avr/webpack.prod.js new file mode 100644 index 00000000..331b45f4 --- /dev/null +++ b/mixly/boards/default_src/arduino_avr/webpack.prod.js @@ -0,0 +1,27 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const TerserPlugin = require('terser-webpack-plugin'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = merge(common, { + mode: 'production', + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + extractComments: false, + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: { + removeAttributeQuotes: true, + collapseWhitespace: true, + removeComments: true, + } + }) + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/.npmignore b/mixly/boards/default_src/arduino_esp32/.npmignore new file mode 100644 index 00000000..21ab2a3e --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/.npmignore @@ -0,0 +1,3 @@ +node_modules +build +origin \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/actuator.js b/mixly/boards/default_src/arduino_esp32/blocks/actuator.js new file mode 100644 index 00000000..33fd4b14 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/actuator.js @@ -0,0 +1,156 @@ +import * as Blockly from 'blockly/core'; + +const ACTUATOR_HUE = 100; + +export const controls_tone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_TONE); + this.appendValueInput("PIN") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_CHANNEL); + this.appendValueInput('FREQUENCY') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_FREQUENCY); + this.appendValueInput('DELAY_TIME') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_DELAY); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE); + } +}; + +export const controls_notone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_NOTONE); + this.appendValueInput("PIN") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_CHANNEL); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_NOTONE); + } +}; + +export const onboard_tone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_TONE); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_CHANNEL); + this.appendValueInput('FREQUENCY') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_FREQUENCY); + this.appendValueInput('DELAY_TIME') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_DELAY); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_TONE); + } +}; + +export const onboard_notone = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_NOTONE); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_CHANNEL); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_NOTONE); + } +}; + +export const motor_id = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown([ + ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"] + ]), "CHANNEL"); + this.setOutput(true); + } +}; + +export const HR8833_Motor_Setup = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MOTOR_HR8833 + Blockly.Msg.MIXLY_SETUP); + this.appendValueInput('MOTOR_ID') + .setCheck(Number) + .appendField(Blockly.Msg.MOTOR_HR8833_TEAM_NO); + this.appendValueInput("PIN1") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_PIN + "1"); + this.appendValueInput("PIN2") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_PIN + "2"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_MOTOR_SETUP); + } +}; + +export const HR8833_Motor_Speed = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MOTOR_HR8833 + Blockly.Msg.MIXLY_SETTING); + this.appendValueInput('MOTOR_ID') + .setCheck(Number) + .appendField(Blockly.Msg.MOTOR_HR8833_TEAM_NO); + this.appendValueInput('SPEED') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MOTOR_SPEED); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + } +}; + +export const handbit_motor_move = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown([["M1", "0x01"], ["M2", "0x10"]]), "type"); + this.appendValueInput("speed") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SPEED + "(-100~100)"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(100); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/communicate.js b/mixly/boards/default_src/arduino_esp32/blocks/communicate.js new file mode 100644 index 00000000..da8ca718 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/communicate.js @@ -0,0 +1,48 @@ +import * as Blockly from 'blockly/core'; + +const COMMUNICATE_HUE = 140; + +export const serialBT_Init = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("CONTENT", String) + .appendField(Blockly.Msg.MIXLY_SERIALBT_INIT) + .setCheck(String); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_BEGIN); + } +}; + +export const serialBT_available = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SERIALBT_AVAILABLE); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_AVAILABLE); + } +}; + +export const serialBT_read = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SERIALBT_READ); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_AVAILABLE); + + } +}; + +export const serialBT_write = { + init: function () { + this.setColour(COMMUNICATE_HUE); + this.appendValueInput("CONTENT", String) + .appendField(Blockly.Msg.MIXLY_SERIALBT_WRITE); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_WRITE_TOOLTIP); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/control.js b/mixly/boards/default_src/arduino_esp32/blocks/control.js new file mode 100644 index 00000000..528f290c --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/control.js @@ -0,0 +1,132 @@ +import * as Blockly from 'blockly/core'; + +const LOOPS_HUE = 120; + +export const controls_hw_timer = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER) + .appendField(new Blockly.FieldDropdown([ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"] + ]), "TIMER_NUM"); + this.appendValueInput('TIME') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_MSTIMER2_EVERY); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MILLIS) + .appendField(Blockly.Msg.MIXLY_MODE) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PYTHON_ONE_SHOT, "false"], + [Blockly.Msg.MIXLY_PYTHON_PERIODIC, "true"] + ]), "mode"); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_MSTIMER2_DO); + this.setPreviousStatement(false); + this.setNextStatement(false); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2); + } +}; + +export const controls_runnig_core = { + init: function () { + this.appendDummyInput() + .appendField("ESP32") + .appendField("Task") + .appendField(new Blockly.FieldDropdown([ + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"] + ]), "task") + .appendField("Core") + .appendField(new Blockly.FieldDropdown([ + ["0", "0"], + ["1", "1"] + ]), "core"); + this.appendValueInput("length") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.SPACE_ALLOCATION); + this.appendStatementInput("setup") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SETUP); + this.appendStatementInput("loop") + .setCheck(null) + .appendField(Blockly.Msg.LANG_CONTROLS_FLOW_STATEMENTS_INPUT_OFLOOP); + this.setColour(LOOPS_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const control_core_delay = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_CONTROL_CORE_DELAY); + this.appendValueInput("sleeplength", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MILLIS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SCOOP_SLEEP); + } +}; + +export const controls_hw_timer_start = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER) + .appendField(new Blockly.FieldDropdown([ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"] + ]), "TIMER_NUM") + .appendField(Blockly.Msg.MIXLY_MSTIMER2_START); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2_START); + } +}; + +export const controls_hw_timer_stop = { + init: function () { + this.setColour(LOOPS_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ESP32_HW_TIMER) + .appendField(new Blockly.FieldDropdown([ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"] + ]), "TIMER_NUM") + .appendField(Blockly.Msg.MIXLY_STOP); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_CONTROL_MSTIMER2_STOP); + } +}; + +export const esp32_deep_sleep = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.DFPLAYER_MINI_SLEEP) + .appendField(new Blockly.FieldTextInput("5"), "time") + .appendField(Blockly.Msg.MIXLY_SECOND); + this.setPreviousStatement(true, null); + this.setColour(LOOPS_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/ethernet.js b/mixly/boards/default_src/arduino_esp32/blocks/ethernet.js new file mode 100644 index 00000000..446971b8 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/ethernet.js @@ -0,0 +1,58 @@ +import * as Blockly from 'blockly/core'; + +const ETHERNET_HUE = 0; + +//esp_now +export const esp_now_send = { + init: function () { + this.appendDummyInput() + .appendField("ESP NOW" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND); + this.appendValueInput("mac") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ETHERNET_MAC_ADDRESS); + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendStatementInput("success") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND + Blockly.Msg.MIXLY_SUCCESS); + this.appendStatementInput("failure") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND + Blockly.Msg.MIXLY_FAILED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl("https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/"); + } +}; + +//esp_now +export const esp_now_receive = { + init: function () { + this.appendDummyInput() + .appendField("ESP NOW" + Blockly.Msg.MQTT_subscribe2 + Blockly.Msg.MIXLY_SD_DATA); + this.appendStatementInput("receive_data") + .setCheck(null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl("https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/"); + } +}; + +export const esp32_wifi_connection_event = { + init: function () { + this.appendDummyInput() + .appendField("WiFi连接事件") + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT1, "1"], + [Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT2, "2"], + [Blockly.Msg.MIXLY_ESP32_WIFI_CONNECTION_EVENT3, "3"] + ]), "type"); + this.appendStatementInput("event") + .setCheck(null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/handbit.js b/mixly/boards/default_src/arduino_esp32/blocks/handbit.js new file mode 100644 index 00000000..53a614f6 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/handbit.js @@ -0,0 +1,269 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const HANDBIT_HUE = 65; +const ACTUATOR_HUE = 100; + +export const handbit_button_is_pressed = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUTTON); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'btn'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_PRESSED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_SENOR_IS_PRESSED); + } +}; + +export const handbit_light = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_LIGHT); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_LIGHT_TOOLTIP); + } +}; + +export const handbit_sound = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_SOUND); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_SOUND_TOOLTIP); + } +}; + +export const inout_touchRead = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ESP32_TOUCH + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_MACHINE_VALUE) + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_INOUT_PIN_PRESSED_TOOLTIP); + } +}; + +export const touchAttachInterrupt = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_TOUCHATTACHINTERRUPT_PIN) + .setCheck(Number); + this.appendValueInput("threshold", Number) + .appendField(Blockly.Msg.MIXLY_ESP32_THRESHOLD) + .setCheck(Number); + this.appendDummyInput(""); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + } +}; + +//传感器_重力感应 +export const handbit_MSA300 = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MixGo_MPU9250); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(handbit_MSA300.HANDBIT_MSA300_GETAB), "HANDBIT_MSA300_GETAB"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(""); + this.setHelpUrl(''); + }, + HANDBIT_MSA300_GETAB: [ + [Blockly.Msg.MixGo_MPU9250_AX, "msa.getX()"], + [Blockly.Msg.MixGo_MPU9250_AY, "msa.getY()"], + [Blockly.Msg.MixGo_MPU9250_AZ, "msa.getZ()"], + ] +}; + +export const handbit_MSA300_action = { + init: function () { + this.setColour(HANDBIT_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.Handbit); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(handbit_MSA300_action.HANDBIT_MSA300_ACTION), "HANDBIT_MSA300_ACTION"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(""); + this.setHelpUrl(''); + }, + HANDBIT_MSA300_ACTION: [ + [Blockly.Msg.HANDBIT_FORWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>-1000&&msa.getZ()<0"], + [Blockly.Msg.HANDBIT_BACKWARD, "msa.getX()>1500&&msa.getX()<2000&&msa.getZ()>0&&msa.getZ()<1500"], + [Blockly.Msg.HANDBIT_LEFT, "msa.getY()<1000&&msa.getY()>0"], + [Blockly.Msg.HANDBIT_RIGHT, "msa.getY()<0&&msa.getY()>-1000"], + [Blockly.Msg.HANDBIT_UP, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>-1800&&msa.getZ()<-1400"], + [Blockly.Msg.HANDBIT_DOWN, "msa.getX()>-400&&msa.getX()<400&&msa.getY()>-400&&msa.getY()<400&&msa.getZ()>2000&&msa.getZ()<2400"], + ] +}; + +export const handbit_rgb_rainbow1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("WAIT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGBdisplay_rgb_rainbow1); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const handbit_rgb_rainbow3 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(handbit_rgb_rainbow3.DISPLAY_RAINBOW_TYPE), "TYPE"); + this.appendValueInput("rainbow_color") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_display_rgb_rainbow3); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + }, + DISPLAY_RAINBOW_TYPE: [ + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"], + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"] + ] +}; + +export const handbit_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const handbit_rgb2 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_NUM + "1" + Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR1", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_NUM + "2" + Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR2", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_NUM + "3" + Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR3", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const handbit_rgb_Brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const handbit_rgb_show = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_SHOW) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const handbit_motor_move = { + init: function () { + this.appendDummyInput() + .appendField("掌控宝" + Blockly.Msg.MIXLY_MOTOR) + .appendField(new Blockly.FieldDropdown([["M1", "0x01"], ["M2", "0x10"]]), "type"); + this.appendValueInput("speed") + .setCheck(null) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_SPEED + "(-100~100)"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +export const handbit_RGB_color_HSV = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendValueInput("H") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_H); + this.appendValueInput("S") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_S); + this.appendValueInput("V") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_V); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip('色调范围0-65536;饱和度范围0-255;明度范围0-255'); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/inout.js b/mixly/boards/default_src/arduino_esp32/blocks/inout.js new file mode 100644 index 00000000..652d69af --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/inout.js @@ -0,0 +1,145 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; +import { inout_analog_write } from '@mixly/arduino-avr/blocks/inout'; + +const BASE_HUE = 20; + +export const ledcSetup = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField("ledc" + Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_CHANNEL); + this.appendValueInput("FREQ", Number) + .appendField(Blockly.Msg.MIXLY_FREQUENCY) + .setCheck(Number); + this.appendValueInput('PWM_RESOLUTION') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_RESOLUTION); + this.appendDummyInput("") + .appendField("bit"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + } +}; + +export const ledcAttachPin = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField("ledc" + Blockly.Msg.MIXLY_ATTATCH + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.appendValueInput('CHANNEL') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_CHANNEL); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + } +}; + +export const ledcDetachPin = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField("ledc" + Blockly.Msg.MIXLY_DETACH + Blockly.Msg.MIXLY_PIN) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + } +}; + +export const ledcWrite = inout_analog_write; + +export const inout_touchRead = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_ESP32_TOUCH) + .appendField(Blockly.Msg.MIXLY_PIN); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_MACHINE_VALUE) + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_INOUT_PIN_PRESSED_TOOLTIP); + } +}; + +export const touchAttachInterrupt = { + init: function () { + this.setColour(BASE_HUE); + this.appendValueInput("PIN", Number) + .appendField(Blockly.Msg.MIXLY_TOUCHATTACHINTERRUPT_PIN) + .setCheck(Number); + this.appendValueInput("threshold", Number) + .appendField(Blockly.Msg.MIXLY_ESP32_THRESHOLD) + .setCheck(Number); + this.appendDummyInput(""); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + } +}; + +export const inout_esp32_dac = { + init: function () { + this.appendValueInput("value") + .setCheck(null) + .appendField(Blockly.Msg.inout_esp32_dac) + .appendField(new Blockly.FieldDropdown(Profile.default.dac), "PIN") + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(20); + this.setTooltip(Blockly.Msg.inout_esp32_dac_HELP); + this.setHelpUrl(""); + } +}; + +export const esp32_led_pwm = { + init: function () { + this.appendValueInput("PIN") + .setCheck(null) + .appendField(Blockly.Msg.MICROBIT_ACTUATOR_ticks) + .appendField(new Blockly.FieldTextInput("8"), "resolution") + .appendField(Blockly.Msg.MIXLY_FREQUENCY) + .appendField(new Blockly.FieldTextInput("5000"), "freq") + .appendField(Blockly.Msg.MIXLY_CHANNEL) + .appendField(new Blockly.FieldDropdown([ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"], + ["9", "9"], + ["10", "10"], + ["11", "11"], + ["12", "12"], + ["13", "13"], + ["14", "14"], + ["15", "15"] + ]), "ledChannel") + .appendField(Blockly.Msg.MIXLY_ANALOGWRITE_PIN); + this.appendValueInput("val") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_VALUE2); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(20); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/mixepi.js b/mixly/boards/default_src/arduino_esp32/blocks/mixepi.js new file mode 100644 index 00000000..eb270e21 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/mixepi.js @@ -0,0 +1,232 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const DISPLAY_HUE = 180; +const SENSOR_HUE = 40; +const ACTUATOR_HUE = 100; + +export const brightness_select = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(brightness_select.BRIGHTNESS_SELECT), 'STAT'); + this.setOutput(true, Number); + }, + BRIGHTNESS_SELECT: [ + ["0", "0"], + ["1", "1"], + ["2", "2"], + ["3", "3"], + ["4", "4"], + ["5", "5"], + ["6", "6"], + ["7", "7"], + ["8", "8"] + ] +}; + +export const mixePi_button_is_pressed = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUTTON); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'btn'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_PRESSED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_SENOR_IS_PRESSED); + } +}; + +export const mixepi_light = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_LIGHT); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_LIGHT_TOOLTIP); + } +}; + +export const mixepi_sound = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_SOUND); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_SOUND_TOOLTIP); + } +}; + +export const mixepi_inout_touchRead = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_TOUCH) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.touch), 'touch_pin'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_MACHINE_VALUE) + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_INOUT_PIN_PRESSED_TOOLTIP); + } +}; + +export const mixepi_ADXL345_action = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("MIXEPI"); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldDropdown(mixepi_ADXL345_action.MIXEPI_ADXL345_ACTION), "MIXEPI_ADXL345_ACTION"); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(""); + this.setHelpUrl(''); + }, + MIXEPI_ADXL345_ACTION: [ + [Blockly.Msg.HANDBIT_FORWARD, "accel.getAcceleration().x>-4.7&&accel.getAcceleration().x<0&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"], + [Blockly.Msg.HANDBIT_BACKWARD, "accel.getAcceleration().x>0&&accel.getAcceleration().x<4.7&&accel.getAcceleration().y<1&&accel.getAcceleration().y>-1&&accel.getAcceleration().z<-8&&accel.getAcceleration().z>-9.8"], + [Blockly.Msg.HANDBIT_LEFT, "accel.getAcceleration().y>0&&accel.getAcceleration().y<5.5&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"], + [Blockly.Msg.HANDBIT_RIGHT, "accel.getAcceleration().y<0&&accel.getAcceleration().y>-4.7&&accel.getAcceleration().z<-7.5&&accel.getAcceleration().z>-9.8"], + [Blockly.Msg.HANDBIT_UP, "accel.getAcceleration().z>-9.8&&accel.getAcceleration().z<-8"], + [Blockly.Msg.HANDBIT_DOWN, "accel.getAcceleration().z>8&&accel.getAcceleration().z<9.8"] + ] +}; + +export const mixepi_rgb_rainbow1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("WAIT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGBdisplay_rgb_rainbow1); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const mixepi_rgb_rainbow3 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(mixepi_rgb_rainbow3.DISPLAY_RAINBOW_TYPE), "TYPE"); + this.appendValueInput("rainbow_color") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_display_rgb_rainbow3); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + }, + DISPLAY_RAINBOW_TYPE: [ + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"], + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"] + ] +}; + +export const RGB_color_seclet = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(new Blockly.FieldColour("ff0000"), "COLOR"); + this.setInputsInline(true); + this.setOutput(true, Number); + this.setTooltip(Blockly.Msg.OLED_DRAW_PIXE_TOOLTIP); + } +}; + +export const RGB_color_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendValueInput("R") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_R); + this.appendValueInput("G") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_G); + this.appendValueInput("B") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_B); + this.setInputsInline(true); + this.setOutput(true); + this.setTooltip(''); + } +}; + +export const mixepi_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const mixepi_rgb2 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField("1") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR1", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField("2") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR2", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField("3") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR3", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const mixepi_rgb_Brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/mixgo.js b/mixly/boards/default_src/arduino_esp32/blocks/mixgo.js new file mode 100644 index 00000000..89149758 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/mixgo.js @@ -0,0 +1,530 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const ACTUATOR_HUE = 100; +const DISPLAY_HUE = 180; + +//执行器_点阵屏显示_字符显示 +export const HT16K33_TEXT = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MAX7219_PUTSTR); + this.appendValueInput("TEXT", String) + .setCheck([Number, String]) + .setAlign(Blockly.inputs.Align.RIGHT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(""); + } +}; + +//执行器_点阵屏显示_画点显示 +export const HT16K33_POS = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_monitor); + this.appendValueInput('XVALUE') + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_X); + this.appendValueInput("YVALUE") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_Y); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_SHOWPOINT) + .appendField(new Blockly.FieldDropdown(HT16K33_POS.DRAW_TYPE), "DrawPixel_TYPE"); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(""); + }, + DRAW_TYPE: [ + [Blockly.Msg.MIXLY_4DIGITDISPLAY_ON, "LED_ON"], + [Blockly.Msg.MIXLY_4DIGITDISPLAY_OFF, "LED_OFF"] + ] +}; + +//执行器_点阵屏显示_显示图案 +export const HT16K33_DisplayChar = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_monitor); + this.appendValueInput("Chars") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_PICARRAY); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(); + } +}; + +//执行器_点阵屏显示_图案数组 +export const HT16K33_LedArray = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_DISPLAY_MATRIX_ARRAYVAR) + .appendField(new Blockly.FieldTextInput("LedArray1"), "VAR"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a81") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a82") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a83") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a84") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a85") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a86") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a87") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a88") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a89") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a810") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a811") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a812") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a813") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a814") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a815") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a816"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a71") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a72") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a73") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a74") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a75") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a76") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a77") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a78") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a79") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a710") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a711") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a712") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a713") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a714") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a715") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a716"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a61") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a62") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a63") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a64") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a65") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a66") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a67") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a68") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a69") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a610") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a611") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a612") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a613") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a614") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a615") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a616"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a51") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a52") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a53") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a54") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a55") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a56") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a57") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a58") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a59") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a510") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a511") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a512") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a513") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a514") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a515") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a516"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a41") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a42") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a43") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a44") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a45") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a46") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a47") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a48") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a49") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a410") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a411") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a412") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a413") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a414") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a415") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a416"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a31") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a32") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a33") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a34") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a35") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a36") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a37") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a38") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a39") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a310") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a311") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a312") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a313") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a314") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a315") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a316"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a21") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a22") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a23") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a24") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a25") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a26") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a27") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a28") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a29") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a210") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a211") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a212") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a213") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a214") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a215") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a216"); + this.appendDummyInput("") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a11") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a12") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a13") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a14") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a15") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a16") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a17") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a18") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a19") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a110") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a111") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a112") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a113") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a114") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a115") + .appendField(new Blockly.FieldCheckbox("FALSE"), "a116"); + this.setOutput(true, Number); + this.setTooltip(); + } +}; + +//物联网_点阵屏_清除显示 +export const HT16K33_Displayclear = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_monitor); + this.appendDummyInput("") + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_MICROBIT_Clear_display); + this.setInputsInline(true); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(); + } +}; + +export const HT16K33_show_image = { + init: function () { + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_ESP32_SHOW_IMAGE_OR_STRING_OR_ANIMATION) + .appendField(new Blockly.FieldDropdown([ + ["❤", "0100038007c00fe01ff01ff00ee00640"], + ["♥", "00000100038007c00fe00ee004400000"], + ["▲", "00003ffc1ff80ff007e003c001800000"], + ["▼", "0000018003c007e00ff01ff83ffc0000"], + ["◄", "100030007000f000f000700030001000"], + // ["↓", "18181818db7e3c18"], + // ["←", "103060ffff603010"], + // ["→", "080c06ffff060c08"], + // ["►", "080c0e0f0f0e0c08"], + // ["△", "182442ff00000000"], + // ["▽", "00000000ff422418"], + // ["☺", "3c42a581a599423c"], + // ["○", "3c4281818181423c"], + // ["◑", "3c4e8f8f8f8f4e3c"], + // ["◐", "3c72f1f1f1f1723c"], + // ["¥", "4224ff08ff080808"], + // ["Χ", "8142241818244281"], + // ["✓", "0000010204885020"], + // ["□", "007e424242427e00"], + // ["▣", "007e425a5a427e00"], + // ["◇", "1824428181422418"], + // ["♀", "3844444438107c10"], + // ["♂", "0f030579d888d870"], + // ["♪", "0c0e0b080878f860"], + // ["✈", "203098ffff983020"], + // //["卍", "00f21212fe90909e"], + // //["卐", "009e9090fe1212f2"], + // ["︱", "1010101010101010"], + // ["—", "000000ff00000000"], + // ["╱", "0102040810204080"], + // ["\", "8040201008040201"], + // ["大", "1010fe1010284482"], + // ["中", "1010fe9292fe1010"], + // ["小", "1010105454921070"], + // ["米", "00925438fe385492"], + // ["正", "00fe10105e5050fc"], + // ["囧", "ffa5a5c3bda5a5ff"] + ]), "img_"); + this.setOutput(true); + this.setTooltip(''); + this.setColour(DISPLAY_HUE); + this.setTooltip(Blockly.Msg.OLED_BITMAP_OR_STRING); + this.setHelpUrl(''); + } +}; + +export const HT16K33_blink_rate = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_monitor); + this.appendValueInput('x') + .setCheck(Number) + .appendField(Blockly.Msg.MIXLY_ESP32_JS_MONITOR_SET_BLINK_RATE) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_JS_MONITOR_SET_BLINK_RATE); + } +}; + +export const HT16K33_brightness = { + init: function () { + this.setColour(DISPLAY_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_MICROBIT_monitor); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_JS_MONITOR_SET_SCREEN_BRIGHTNESS); + } +}; + +export const mixgo_button_is_pressed = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUTTON); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'PIN'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_PRESSED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_SENOR_IS_PRESSED); + } +}; + +export const sensor_mixgo_light = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_LIGHT); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_LIGHT_TOOLTIP); + } +}; + +export const sensor_mixgo_sound = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_SOUND); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_SOUND_TOOLTIP); + } +}; + +export const mixgo_touch_pin = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_TOUCH) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.touch), 'touch_pin'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_TOUCHED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_sensor_pin_pressed); + } +}; + +export const sensor_mixgo_pin_near = { + init: function () { + this.setColour(Blockly.Msg['SENSOR_HUE']); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.TEXT_TRIM_LEFT, "34"], + [Blockly.Msg.TEXT_TRIM_RIGHT, "36"] + ]), "direction") + .appendField(Blockly.Msg.MIXLY_ESP32_NEAR); + this.setOutput(true, Boolean); + this.setInputsInline(true); + var thisBlock = this; + this.setTooltip(function () { + var mode = thisBlock.getFieldValue('direction'); + var mode0 = Blockly.Msg.MIXLY_ESP32_SENSOR_MIXGO_PIN_NEAR_TOOLTIP; + var mode1 = Blockly.Msg.MIXLY_ESP32_NEAR; + var TOOLTIPS = { + 'left': Blockly.Msg.TEXT_TRIM_LEFT, + 'right': Blockly.Msg.TEXT_TRIM_RIGHT, + }; + return mode0 + TOOLTIPS[mode] + mode1 + }); + } +}; + +export const mixGo_led = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETTING) + .appendField(Blockly.Msg.MIXLY_BUILDIN_LED) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_LEFT, "0"], + [Blockly.Msg.MIXLY_RIGHT, "5"] + ]), 'STAT'); + this.appendValueInput('bright') + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_LED_SETONOFF); + } +}; + +export const mixGo_led_brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETTING) + .appendField(Blockly.Msg.MIXLY_BUILDIN_LED) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_LEFT, "0"], + [Blockly.Msg.MIXLY_RIGHT, "5"] + ]), 'STAT'); + this.appendValueInput('bright') + .appendField(Blockly.Msg.MIXLY_PULSEIN_STAT) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_ESP32_LED_SETONOFF); + } +}; + +export const MixGo_rgb_rainbow1 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("WAIT") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGBdisplay_rgb_rainbow1); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const MixGo_rgb_rainbow3 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(MixGo_rgb_rainbow3.DISPLAY_RAINBOW_TYPE), "TYPE"); + this.appendValueInput("rainbow_color") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_display_rgb_rainbow3); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + }, + DISPLAY_RAINBOW_TYPE: [ + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_1, "normal"], + [Blockly.Msg.MIXLY_RGB_DISPLAY_RAINBOW_TYPE_2, "change"] + ] +}; + +export const MixGo_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("_LED_") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_RGB_NUM); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const MixGo_rgb2 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField("1") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR1", Number) + .setCheck(Number); + this.appendDummyInput("") + .appendField("2") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR2", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const MixGo_rgb_Brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const MixGo_rgb_show = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_SHOW) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/pinout.js b/mixly/boards/default_src/arduino_esp32/blocks/pinout.js new file mode 100644 index 00000000..7e1b1e07 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/pinout.js @@ -0,0 +1,163 @@ +import * as Blockly from 'blockly/core'; + +const PINOUT_HUE = '#555555'; + +export const esp32_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32.png'), 525, 265, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const handbit_A = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/HandbitA.jpg'), 525, 260, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const handbit_B = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/HandbitB.jpg'), 460, 260, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const handbit_pin_A = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/HandbitPinA.jpg'), 270, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const handbit_pin_B = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/HandbitPinB.jpg'), 270, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const mixgo_pin_A = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/MixGoPinA.png'), 525, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const mixgo_pin_B = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/MixGoPinB.png'), 525, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const PocketCard_A = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/PocketCardA.jpg'), 525, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const PocketCard_B = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/PocketCardB.jpg'), 525, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const esp32_cam_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32Cam.png'), 525, 270, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const esp32_pico_kit_1_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32PicoKit.png'), 525, 230, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const nodemcu_32s_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/NodeMCU32S.png'), 380, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const esp32c3_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32C3.jpg'), 525, 365, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const core_esp32c3_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/CoreESP32C3.png'), 500, 376, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const esp32s3_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32S3.jpg'), 470, 350, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const esp32s2_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/ESP32S2.jpg'), 500, 350, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/pins.js b/mixly/boards/default_src/arduino_esp32/blocks/pins.js new file mode 100644 index 00000000..935a7c33 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/pins.js @@ -0,0 +1,220 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const PINS_HUE = 230; + +export const pins_dac = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.dac), 'PIN'); + this.setOutput(true); + } +}; + +export const pins_button = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_sda = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.SDA), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_tx = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.tx), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_scl = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.SCL), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_touch = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.touch), 'PIN'); + this.setOutput(true); + } +}; + +export const pins_serial = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.serial_pin), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_playlist = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.playlist), 'PIN'); + this.setOutput(true); + } +}; + +export const pins_exlcdh = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.exlcdh), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_exlcdv = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.exlcdv), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_axis = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.axis), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_brightness = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.brightness), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_tone_notes = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.tone_notes), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_radio_power = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.radio_power), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_radio_datarate = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.radio_datarate), 'PIN'); + this.setOutput(true, Number); + } +}; + +export const pins_one_more = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.one_more), 'PIN'); + this.setOutput(true); + } +}; + +export const serial_select = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.serial_select), 'PIN'); + this.setOutput(true); + } +}; + +export const serial_HardwareSelect = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), 'PIN'); + this.setOutput(true); + } +}; + +export const brightness = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.brightness), 'PIN'); + this.setOutput(true); + } +}; + +export const CHANNEL = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.CHANNEL), 'PIN'); + this.setOutput(true); + } +}; + +export const PWM_RESOLUTION = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.PWM_RESOLUTION), 'PIN'); + this.setOutput(true); + } +}; + +export const OCTAVE = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.OCTAVE), 'PIN'); + this.setOutput(true); + } +}; + +export const TONE_NOTE = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.TONE_NOTE), 'PIN'); + this.setOutput(true); + } +}; + +export const pins_digitalWrite = { + init: function () { + this.setColour(PINS_HUE); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.digitalWrite), 'PIN'); + this.setOutput(true, Number); + } +}; diff --git a/mixly/boards/default_src/arduino_esp32/blocks/pocketcard.js b/mixly/boards/default_src/arduino_esp32/blocks/pocketcard.js new file mode 100644 index 00000000..60c7525d --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/pocketcard.js @@ -0,0 +1,170 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; +import { sensor_mixgo_pin_near } from './mixgo'; + +const SENSOR_HUE = 40; +const ACTUATOR_HUE = 100; + +export const mixgo_button_is_pressed = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUTTON); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'PIN'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_PRESSED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_SENOR_IS_PRESSED); + } +}; + +export const sensor_mixgo_sound = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_SOUND); + this.setOutput(true, Number); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.ESP32_SENSOR_NIXGO_SOUND_TOOLTIP); + } +}; + +export const mixgo_touch_pin = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_TOUCH) + .appendField(Blockly.Msg.MIXLY_PIN) + .appendField(new Blockly.FieldDropdown(Profile.default.touch), 'touch_pin'); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_IS_TOUCHED); + this.setOutput(true, Boolean); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_sensor_pin_pressed); + } +}; + +export const sensor_mixgo_light = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_ESP32_LIGHT) + .appendField(new Blockly.FieldDropdown([["A", "39"], ["B", "36"]]), "direction"); + this.setOutput(true, Number); + this.setInputsInline(true); + } +}; + +//NTC电阻 +export const NTC_TEMP = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("NTC") + .appendField(Blockly.Msg.MIXLY_TEMP); + + this.setInputsInline(false); + this.setOutput(true, Number); + this.setTooltip(); + } +}; + +export const MPU9250_update = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField("MPU9250" + Blockly.Msg.MIXLY_update_data); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setInputsInline(true); + } +}; + +export const Pocket_rgb = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const Pocket_rgb2 = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendDummyInput("") + .appendField(Blockly.Msg.HTML_COLOUR); + this.appendValueInput("COLOR1", Number) + .setCheck(Number); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const Pocket_rgb_Brightness = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("Brightness") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.MIXLY_BRIGHTNESS); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(''); + } +}; + +export const Pocket_rgb_show = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB_SHOW) + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + } +}; + +export const pocket_RGB_color_HSV = { + init: function () { + this.setColour(ACTUATOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_RGB); + this.appendValueInput("H") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_H); + this.appendValueInput("S") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_S); + this.appendValueInput("V") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT) + .appendField(Blockly.Msg.HSV_V); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip('色调范围0-65536;饱和度范围0-255;明度范围0-255'); + } +}; + +export const sensor_button_is_pressed = mixgo_button_is_pressed; +export const sensor_pin_near = sensor_mixgo_pin_near; +export const sensor_light = sensor_mixgo_light; +export const sensor_sound = sensor_mixgo_sound; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/sensor.js b/mixly/boards/default_src/arduino_esp32/blocks/sensor.js new file mode 100644 index 00000000..df873a43 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/sensor.js @@ -0,0 +1,68 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const SENSOR_HUE = 40; + +//ESP32片内霍尔传感器值 +export const ESP32_hallRead = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.ESP32_HALL); + this.setOutput(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +//ESP32片内温度传感器值 +export const ESP32_temprature = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.ESP32_TEMP); + this.setOutput(true, null); + this.setColour(SENSOR_HUE); + this.setTooltip(); + this.setHelpUrl(""); + } +}; + +export const OneButton = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_JS_CURRENT); + this.appendDummyInput("") + .appendField(new Blockly.FieldDropdown(Profile.default.button), 'PIN'); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_BUTTON) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_CLICK, "attachClick"], + [Blockly.Msg.MIXLY_DOUBLE_CLICK, "attachDoubleClick"], + [Blockly.Msg.MIXLY_LONG_PRESS_START, "attachLongPressStart"], + [Blockly.Msg.MIXLY_DURING_LONG_PRESS, "attachDuringLongPress"], + [Blockly.Msg.MIXLY_LONG_PRESS_END, "attachLongPressStop"] + ]), "mode"); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_INOUT_ATTACHINTERRUPT); + this.setInputsInline(true); + this.setHelpUrl(); + } +}; + +export const ESP_TCS34725_Get_RGB = { + init: function () { + this.setColour(SENSOR_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.TCS34725_Get_RGB) + .appendField(new Blockly.FieldDropdown(ESP_TCS34725_Get_RGB.TCS34725_COLOR), "TCS34725_COLOR"); + this.setInputsInline(true); + this.setOutput(true); + }, + TCS34725_COLOR: [ + [Blockly.Msg.COLOUR_RGB_RED, "r"], + [Blockly.Msg.COLOUR_RGB_GREEN, "g"], + [Blockly.Msg.COLOUR_RGB_BLUE, "b"], + ] +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/serial.js b/mixly/boards/default_src/arduino_esp32/blocks/serial.js new file mode 100644 index 00000000..403a35d5 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/serial.js @@ -0,0 +1,223 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +const SERIAL_HUE = 65; + +export const serial_HardwareSerial = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.Hardware_Serial) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select"); + this.appendValueInput("RX", Number) + .setCheck(Number) + .appendField("RX#") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("TX", Number) + .appendField("TX#") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("CONTENT", Number) + .appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SOFTSERIAL.replace('%1', Blockly.Arduino.valueToCode(this, 'RX', Blockly.Arduino.ORDER_ATOMIC)) + .replace('%2', Blockly.Arduino.valueToCode(this, 'TX', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const serial_begin = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_BEGIN) + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_BEGIN); + } +}; + +export const serial_write = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_WRITE); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_WRITE_TOOLTIP); + } +}; + +export const serial_print = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"], + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"] + ]), "new_line"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP); + } +}; + +export const serial_println = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", String) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"], + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"] + ]), "new_line"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.TEXT_PRINT_TOOLTIP); + } +}; + +export const serial_print_num = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_PRINT) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MIXLY_PRINT_INLINE, "print"], + [Blockly.Msg.TEXT_PRINT_Huanhang_TOOLTIP, "println"] + ]), "new_line") + .appendField(Blockly.Msg.MIXLY_NUMBER); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown([ + [Blockly.Msg.MATH_HEX, "HEX"], + [Blockly.Msg.MATH_BIN, "BIN"], + [Blockly.Msg.MATH_OCT, "OCT"], + [Blockly.Msg.MATH_DEC, "DEC"] + ]), "STAT") + .setCheck(Number); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.TEXT_PRINT_HEX_TOOLTIP); + } +}; + +export const serial_print_hex = serial_print_num; + +export const serial_available = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_AVAILABLE); + this.setOutput(true, Boolean); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_AVAILABLE); + } +}; + +export const serial_readstr = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_READSTR); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_STR); + } +}; + +export const serial_readstr_until = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendValueInput("CONTENT", Number) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_READSTR_UNTIL) + .setCheck(Number); + this.setInputsInline(true); + this.setOutput(true, String); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_READSTRUNITL.replace('%1', Blockly.Arduino.valueToCode(this, 'CONTENT', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const serial_parseInt_Float = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + //.appendField(Blockly.Msg.MIXLY_SERIAL_READ) + .appendField(new Blockly.FieldDropdown([ + ["read", "read"], + ["peek", "peek"], + ["parseInt", "parseInt"], + ["parseFloat", "parseFloat"] + ]), "STAT"); + this.setOutput(true, Number); + var thisBlock = this; + this.setTooltip(function () { + var op = thisBlock.getFieldValue('STAT'); + var TOOLTIPS = { + 'parseInt': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_INT, + 'parseFloat': Blockly.Msg.MIXLY_TOOLTIP_BLOCKGROUP_SERIAL_READ_FLOAT + }; + return TOOLTIPS[op]; + }); + } +}; + +export const serial_flush = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_FLUSH); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIAL_FLUSH); + } +}; + +export const serial_softserial = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput("") + .appendField(Blockly.Msg.MIXLY_SETUP) + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select"); + this.appendValueInput("RX", Number) + .setCheck(Number) + .appendField("RX#") + .setAlign(Blockly.inputs.Align.RIGHT); + this.appendValueInput("TX", Number) + .appendField("TX#") + .setCheck(Number) + .setAlign(Blockly.inputs.Align.RIGHT); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SOFTSERIAL.replace('%1', Blockly.Arduino.valueToCode(this, 'RX', Blockly.Arduino.ORDER_ATOMIC)) + .replace('%2', Blockly.Arduino.valueToCode(this, 'TX', Blockly.Arduino.ORDER_ATOMIC))); + } +}; + +export const serial_event = { + init: function () { + this.setColour(SERIAL_HUE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(Profile.default.serial_HardwareSelect), "serial_select") + .appendField(Blockly.Msg.MIXLY_SERIAL_EVENT); + this.appendStatementInput('DO') + .appendField(Blockly.Msg.MIXLY_DO); + this.setPreviousStatement(true); + this.setNextStatement(true); + this.setTooltip(Blockly.Msg.MIXLY_TOOLTIP_SERIALEVENT); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/sidan.js b/mixly/boards/default_src/arduino_esp32/blocks/sidan.js new file mode 100644 index 00000000..bf6b4900 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/sidan.js @@ -0,0 +1,97 @@ +import * as Blockly from 'blockly/core'; + +const ACTUATOR_HUE = 100; + +Blockly.Msg.TURN_OFF_BLUETOOTH_TO_CONNECT = "关闭蓝牙可连接"; +Blockly.Msg.TURN_ON_BLUETOOTH_TO_CONNECT = "打开蓝牙可连接"; +Blockly.Msg.RANGE_0 = "范围0-30"; +Blockly.Msg.HSC025A_CONTROL_INSTRUCTION = "HSC025A控制指令"; +Blockly.Msg.HSC025A_DESIGNATED_PLAYBACK = "HSC025A指定播放"; +Blockly.Msg.HSC025A_DESIGNATED_PLAYBACK1 = "HSC025A指定播放歌曲名0000-0255"; +Blockly.Msg.HSC025A_VOLUME_IS_SET_TO = "HSC025A音量设置为"; +Blockly.Msg.BLUETOOTH_ON = "蓝牙开启"; +Blockly.Msg.BLUETOOTH_OFF = "蓝牙关闭"; +Blockly.Msg.MUTE = "静音"; +Blockly.Msg.RESTORE_SOUND = "恢复声音"; +Blockly.Msg.STANDBY = "待机"; +Blockly.Msg.BOOT = "开机"; +Blockly.Msg.PLAY_PAUSE = "播放/暂停"; +Blockly.Msg.SHUTDOWN = "关机"; +Blockly.Msg.SD_CARD_MODE = "SD卡模式"; +Blockly.Msg.BLUETOOTH_MODE = "蓝牙模式"; +Blockly.Msg.RESET = "恢复出厂设置"; +Blockly.Msg.STOP_PLAYING = "放完停止"; +Blockly.Msg.BLUETOOTH_CONNECT = "蓝牙回连"; +Blockly.Msg.MATH_DEC_MODE = "方式"; +Blockly.Msg.REQUEST_SUCCEEDED = "请求成功"; +Blockly.Msg.MIXLY_FAILED = "请求失败"; +Blockly.Msg.MODE_SWITCH = "模式切换"; +//HSC025A 蓝牙MP3指令 +var hsc025a_mode = [ + [Blockly.Msg.MODE_SWITCH, "1"], + [Blockly.Msg.MIXLY_MP3_PLAY, "2"], + [Blockly.Msg.MIXLY_MP3_PAUSE, "3"], + [Blockly.Msg.MIXLY_MP3_NEXT, "4"], + [Blockly.Msg.MIXLY_MP3_PREV, "5"], + [Blockly.Msg.MIXLY_MP3_VOL_UP, "6"], + [Blockly.Msg.MIXLY_MP3_VOL_DOWN, "7"], + [Blockly.Msg.STANDBY, "8"], + [Blockly.Msg.BOOT, "9"], + [Blockly.Msg.PLAY_PAUSE, "10"], + [Blockly.Msg.MIXLY_MICROBIT_Stop_music, "11"], + [Blockly.Msg.SHUTDOWN, "12"], + [Blockly.Msg.SD_CARD_MODE, "13"], + [Blockly.Msg.BLUETOOTH_MODE, "14"], + [Blockly.Msg.RESET, "15"], + [Blockly.Msg.STOP_PLAYING, "16"], + [Blockly.Msg.BLUETOOTH_CONNECT, "17"], + [Blockly.Msg.TURN_OFF_BLUETOOTH_TO_CONNECT, "18"], + [Blockly.Msg.TURN_ON_BLUETOOTH_TO_CONNECT, "19"], + [Blockly.Msg.BLUETOOTH_ON, "20"], + [Blockly.Msg.BLUETOOTH_OFF, "21"], + [Blockly.Msg.MUTE, "22"], + [Blockly.Msg.RESTORE_SOUND, "23"] +]; + +export const hsc025a_instruction = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.HSC025A_CONTROL_INSTRUCTION) + .appendField(new Blockly.FieldDropdown(hsc025a_mode), "instruction"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//指定播放歌曲 +export const hsc025a_play = { + init: function () { + this.appendValueInput("num") + .setCheck(null) + .appendField(Blockly.Msg.HSC025A_DESIGNATED_PLAYBACK); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.HSC025A_DESIGNATED_PLAYBACK1); + this.setHelpUrl(""); + } +}; + +//音量设置 +export const hsc025a_volume = { + init: function () { + this.appendValueInput("num") + .setCheck(null) + .appendField(Blockly.Msg.HSC025A_VOLUME_IS_SET_TO); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ACTUATOR_HUE); + this.setTooltip(Blockly.Msg.RANGE_0); + this.setHelpUrl(""); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/blocks/storage.js b/mixly/boards/default_src/arduino_esp32/blocks/storage.js new file mode 100644 index 00000000..d54d10c0 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/blocks/storage.js @@ -0,0 +1,149 @@ +import * as Blockly from 'blockly/core'; + +const STORAGE_HUE = 0; + +//初始化SPIFFS +export const initialize_spiffs = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_SETUP + "SPIFFS"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//打开文件并向其中写入数据 +export const spiffs_open_file = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_FILE_PATH); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("/fileName.txt"), "file_path"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MODE); + this.appendDummyInput() + .appendField(new Blockly.FieldDropdown(spiffs_open_file.OPEN_MODE), 'MODE'); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + }, + OPEN_MODE: [ + [Blockly.Msg.MIXLY_READONLY, 'FILE_READ'], + [Blockly.Msg.TEXT_WRITE_TEXT, 'FILE_WRITE'], + [Blockly.Msg.TEXT_APPEND_APPENDTEXT, 'FILE_APPEND'] + ] +}; + +//打开文件并向其中写入数据 +export const spiffs_close_file = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_CLOSE_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(STORAGE_HUE); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//将数据追加到文件 +export const spiffs_write_data = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_OPEN_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_WRITE); + this.appendValueInput("data") + .setCheck(null); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//文件可读 +export const spiffs_read_available = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.HTML_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_AVAILABLE); + this.setColour(STORAGE_HUE); + this.setOutput(true, null); + this.setInputsInline(true); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//读取文件内容 +export const spiffs_read_data = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_GET_FILE_SIZE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.appendDummyInput() + .appendField(Blockly.Msg.OLED_STRING); + this.setOutput(true, null); + this.setInputsInline(true); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//检查文件大小 +export const spiffs_file_size = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.HTML_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("myFile"), "file_var"); + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_SIZE); + this.setOutput(true, null); + this.setInputsInline(true); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; + +//删除文件 +export const spiffs_delete_file = { + init: function () { + this.appendDummyInput() + .appendField(Blockly.Msg.MIXLY_MICROBIT_PY_STORAGE_DELETE_FILE); + this.appendDummyInput() + .appendField(new Blockly.FieldTextInput("/fileName.txt"), "file_path"); + this.appendDummyInput(); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setInputsInline(true); + this.setColour(STORAGE_HUE); + this.setTooltip(""); + this.setHelpUrl(""); + } +}; diff --git a/mixly/boards/default_src/arduino_esp32/css/color_esp32_arduino.css b/mixly/boards/default_src/arduino_esp32/css/color_esp32_arduino.css new file mode 100644 index 00000000..6bbf3969 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/css/color_esp32_arduino.css @@ -0,0 +1,327 @@ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/resources2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/act.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/act2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/WIFI.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/WIFI2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/iot.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/iot2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/weather.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(16)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/weather2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory3.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory4.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(19)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(19)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool2.png') no-repeat; + background-size: 100% auto; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/export.js b/mixly/boards/default_src/arduino_esp32/export.js new file mode 100644 index 00000000..f33cf1db --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/export.js @@ -0,0 +1,74 @@ +import ArduinoESP32Pins from './pins/pins'; + +import * as ArduinoESP32ActuatorBlocks from './blocks/actuator'; +import * as ArduinoESP32CommunicateBlocks from './blocks/communicate'; +import * as ArduinoESP32ControlBlocks from './blocks/control'; +import * as ArduinoESP32EthernetBlocks from './blocks/ethernet'; +import * as ArduinoESP32HandbitBlocks from './blocks/handbit'; +import * as ArduinoESP32InoutBlocks from './blocks/inout'; +import * as ArduinoESP32MixePiBlocks from './blocks/mixepi'; +import * as ArduinoESP32MixGoBlocks from './blocks/mixgo'; +import * as ArduinoESP32PinoutBlocks from './blocks/pinout'; +import * as ArduinoESP32PinsBlocks from './blocks/pins'; +import * as ArduinoESP32PocketCardBlocks from './blocks/pocketcard'; +import * as ArduinoESP32SensorBlocks from './blocks/sensor'; +import * as ArduinoESP32SerialBlocks from './blocks/serial'; +import * as ArduinoESP32SidanBlocks from './blocks/sidan'; +import * as ArduinoESP32StorageBlocks from './blocks/storage'; + +import * as ArduinoESP32ActuatorGenerators from './generators/actuator'; +import * as ArduinoESP32CommunicateGenerators from './generators/communicate'; +import * as ArduinoESP32ControlGenerators from './generators/control'; +import * as ArduinoESP32EthernetGenerators from './generators/ethernet'; +import * as ArduinoESP32HandbitGenerators from './generators/handbit'; +import * as ArduinoESP32InoutGenerators from './generators/inout'; +import * as ArduinoESP32MixePiGenerators from './generators/mixepi'; +import * as ArduinoESP32MixGoGenerators from './generators/mixgo'; +import * as ArduinoESP32PinoutGenerators from './generators/pinout'; +import * as ArduinoESP32PinsGenerators from './generators/pins'; +import * as ArduinoESP32PocketCardGenerators from './generators/pocketcard'; +import * as ArduinoESP32SensorGenerators from './generators/sensor'; +import * as ArduinoESP32SerialGenerators from './generators/serial'; +import * as ArduinoESP32SidanGenerators from './generators/sidan'; +import * as ArduinoESP32StorageGenerators from './generators/storage'; + +import ArduinoESP32ZhHans from './language/zh-hans'; +import ArduinoESP32ZhHant from './language/zh-hant'; +import ArduinoESP32En from './language/en'; + +export { + ArduinoESP32Pins, + ArduinoESP32ActuatorBlocks, + ArduinoESP32CommunicateBlocks, + ArduinoESP32ControlBlocks, + ArduinoESP32EthernetBlocks, + ArduinoESP32HandbitBlocks, + ArduinoESP32InoutBlocks, + ArduinoESP32MixePiBlocks, + ArduinoESP32MixGoBlocks, + ArduinoESP32PinoutBlocks, + ArduinoESP32PinsBlocks, + ArduinoESP32PocketCardBlocks, + ArduinoESP32SensorBlocks, + ArduinoESP32SerialBlocks, + ArduinoESP32SidanBlocks, + ArduinoESP32StorageBlocks, + ArduinoESP32ActuatorGenerators, + ArduinoESP32CommunicateGenerators, + ArduinoESP32ControlGenerators, + ArduinoESP32EthernetGenerators, + ArduinoESP32HandbitGenerators, + ArduinoESP32InoutGenerators, + ArduinoESP32MixePiGenerators, + ArduinoESP32MixGoGenerators, + ArduinoESP32PinoutGenerators, + ArduinoESP32PinsGenerators, + ArduinoESP32PocketCardGenerators, + ArduinoESP32SensorGenerators, + ArduinoESP32SerialGenerators, + ArduinoESP32SidanGenerators, + ArduinoESP32StorageGenerators, + ArduinoESP32ZhHans, + ArduinoESP32ZhHant, + ArduinoESP32En +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/actuator.js b/mixly/boards/default_src/arduino_esp32/generators/actuator.js new file mode 100644 index 00000000..9b2b096c --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/actuator.js @@ -0,0 +1,179 @@ +export const display_rgb_show = function () { + var dropdown_rgbpin = this.getFieldValue('PIN'); + var code = 'rgb_display_' + dropdown_rgbpin + '.show();\n' + // +'rgb_display_' + dropdown_rgbpin + '.show();\n' + //+"delay(1);" + return code; +} + +export const servo_move = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + var delay_time = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ATOMIC) || '0' + generator.definitions_['include_ESP32Servo'] = '#include '; + generator.definitions_[`var_declare_servo_${dropdown_pin}`] = `Servo servo_${dropdown_pin};`; + generator.setups_['setup_servo'] = 'ESP32PWM::allocateTimer(0);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(1);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(2);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(3);\n'; + generator.setups_[`setup_servo_${dropdown_pin}`] = `servo_${dropdown_pin}.setPeriodHertz(50);\n` + + generator.INDENT + `servo_${dropdown_pin}.attach(${dropdown_pin}, 500, 2500);`; + var code = `servo_${dropdown_pin}.write(${value_degree});\ndelay(${delay_time});\n`; + return code; +} + +export const servo_writeMicroseconds = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + generator.definitions_['include_ESP32Servo'] = '#include '; + generator.definitions_[`var_declare_servo_${dropdown_pin}`] = `Servo servo_${dropdown_pin};`; + generator.setups_['setup_servo'] = 'ESP32PWM::allocateTimer(0);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(1);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(2);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(3);\n'; + generator.setups_[`setup_servo_${dropdown_pin}`] = `servo_${dropdown_pin}.attach(${dropdown_pin});`; + var code = `servo_${dropdown_pin}.writeMicroseconds(${value_degree});\n`; + return code; +} + +export const servo_read_degrees = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + generator.definitions_['include_ESP32Servo'] = '#include '; + generator.definitions_[`var_declare_servo_${dropdown_pin}`] = `Servo servo_${dropdown_pin};`; + generator.setups_['setup_servo'] = 'ESP32PWM::allocateTimer(0);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(1);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(2);\n' + + generator.INDENT + 'ESP32PWM::allocateTimer(3);\n'; + generator.setups_[`setup_servo_${dropdown_pin}`] = `servo_${dropdown_pin}.setPeriodHertz(50);\n` + + generator.INDENT + `servo_${dropdown_pin}.attach(${dropdown_pin}, 500, 2500);`; + var code = `servo_${dropdown_pin}.read()`; + return [code, generator.ORDER_ATOMIC]; +} + +export const controls_tone = function (_, generator) { + generator.definitions_['include_ESP32Tone'] = '#include '; + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var fre = generator.valueToCode(this, 'FREQUENCY', generator.ORDER_ASSIGNMENT) || '0'; + var channel = generator.valueToCode(this, 'CHANNEL', generator.ORDER_ASSIGNMENT) || '0'; + var DELAY_TIME = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ASSIGNMENT) || '0'; + var code = ""; + code = " tone(" + dropdown_pin + ", " + fre + ", " + DELAY_TIME + ", " + channel + ");\n"; + return code; +} + +export const controls_notone = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var channel = generator.valueToCode(this, 'CHANNEL', generator.ORDER_ASSIGNMENT) || '0'; + var code = ""; + code = " noTone(" + dropdown_pin + ", " + channel + ");\n"; + return code; +} + +export const onboard_tone = function (_, generator) { + generator.definitions_['include_ESP32Tone'] = '#include '; + var fre = generator.valueToCode(this, 'FREQUENCY', generator.ORDER_ASSIGNMENT) || '0'; + var channel = generator.valueToCode(this, 'CHANNEL', generator.ORDER_ASSIGNMENT) || '0'; + var DELAY_TIME = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ASSIGNMENT) || '0'; + var code = ""; + code = " tone(BUZZER, " + fre + ", " + DELAY_TIME + ", " + channel + ");\n"; + return code; +} + +export const onboard_notone = function (_, generator) { + var channel = generator.valueToCode(this, 'CHANNEL', generator.ORDER_ASSIGNMENT) || '0'; + var code = ""; + code = " noTone(BUZZER, " + channel + ");\n"; + return code; +} + +// 执行器-电机转动 +export const Mixly_motor = function (_, generator) { + var SPEED_PIN = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var DIR_PIN = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'speed', generator.ORDER_ASSIGNMENT) || '0'; + var code = 'setMotor(' + SPEED_PIN + ', ' + DIR_PIN + ', ' + speed + ');\n'; + generator.definitions_['include_Arduino'] = '#include '; + generator.setups_['setup_output_' + SPEED_PIN + DIR_PIN + '_S'] = 'pinMode(' + SPEED_PIN + ', OUTPUT);'; + generator.setups_['setup_output_' + SPEED_PIN + DIR_PIN + '_D'] = 'pinMode(' + DIR_PIN + ', OUTPUT);'; + generator.setups_['setup_output_' + SPEED_PIN + DIR_PIN + '_S_W'] = 'digitalWrite(' + SPEED_PIN + ', LOW);'; + generator.setups_['setup_output_' + SPEED_PIN + DIR_PIN + '_D_W'] = 'digitalWrite(' + DIR_PIN + ', LOW);'; + var funcName = 'setMotor'; + var code2 = 'void ' + funcName + '(int speedpin,int dirpin, int speed)\n ' + + '{\n' + + ' if (speed == 0)\n' + + ' {\n' + + ' digitalWrite(dirpin, LOW);\n' + + ' analogWrite(speedpin, 0);\n' + + ' } \n' + + ' else if (speed > 0)\n' + + ' {\n' + + ' digitalWrite(dirpin, LOW);\n' + + ' analogWrite(speedpin, speed);\n' + + ' }\n' + + ' else\n' + + ' {\n' + + ' if(speed < -255)\n' + + ' speed = -255;\n' + + ' digitalWrite(dirpin, HIGH);\n' + + ' analogWrite(speedpin, 255 + speed);\n' + + ' }\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const motor_id = function (_, generator) { + var code = this.getFieldValue('CHANNEL'); + return [code, generator.ORDER_ATOMIC]; +} + +export const HR8833_Motor_Setup = function (_, generator) { + var motor_id = generator.valueToCode(this, 'MOTOR_ID', generator.ORDER_ATOMIC); + var pin1 = generator.valueToCode(this, 'PIN1', generator.ORDER_ATOMIC); + var pin2 = generator.valueToCode(this, 'PIN2', generator.ORDER_ATOMIC); + generator.definitions_['HR8833_Motor_Setup_fun'] = 'void HR8833_Motor_Setup(int motorID,int pin1,int pin2){//电机初始化 ID=1~4 定义四组电机\n' + + ' ledcSetup(motorID*2-2, 5000, 8);\n' + + ' ledcAttachPin(pin1, motorID*2-2);\n' + + ' ledcSetup(motorID*2-1, 5000, 8);\n' + + ' ledcAttachPin(pin2, motorID*2-1);\n' + + '}'; + generator.setups_['motorID_' + motor_id] = 'HR8833_Motor_Setup(' + motor_id + ',' + pin1 + ',' + pin2 + ');'; + var code = ''; + return code; +} + +export const HR8833_Motor_Speed = function (_, generator) { + var motor_id = generator.valueToCode(this, 'MOTOR_ID', generator.ORDER_ATOMIC); + var speed = generator.valueToCode(this, 'SPEED', generator.ORDER_ATOMIC); + generator.definitions_['HR8833_Motor_Speed_fun'] = 'void HR8833_Motor_Speed(int motorID,int speed){//电机速度设置 ID=1~4,speed=-255~255\n' + + ' if (speed == 0){ \n' + + ' ledcWrite(motorID*2-2, 0);\n' + + ' ledcWrite(motorID*2-1, 0);\n' + + ' }\n' + + ' else if (speed > 0){\n' + + ' ledcWrite(motorID*2-2, speed);\n' + + ' ledcWrite(motorID*2-1, 0);\n' + + ' }\n' + + ' else{\n' + + ' ledcWrite(motorID*2-2, 0);\n' + + ' ledcWrite(motorID*2-1, -speed);\n' + + ' }\n' + + '}\n'; + var code = 'HR8833_Motor_Speed(' + motor_id + ',' + speed + ');\n'; + return code; +} + +export const handbit_motor_move = function (_, generator) { + var dropdown_type = this.getFieldValue('type'); + var value_speed = generator.valueToCode(this, 'speed', generator.ORDER_ATOMIC); + generator.definitions_['include_Wire'] = '#include '; + generator.setups_['setup_i2c_23_22'] = 'Wire.begin(23, 22);'; + generator.definitions_['HandBit_Motor_Speed_fun'] = 'void HandBit_Motor_Speed(int pin, int speed){//电机速度设置 pin=1~2,speed=--100~100\n' + + ' Wire.beginTransmission(0x10);\n' + + ' Wire.write(pin);\n' + + ' Wire.write(speed);\n' + + ' Wire.endTransmission();\n' + + '}'; + var code = 'HandBit_Motor_Speed(' + dropdown_type + ', ' + value_speed + ');\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/communicate.js b/mixly/boards/default_src/arduino_esp32/generators/communicate.js new file mode 100644 index 00000000..65b0d4d3 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/communicate.js @@ -0,0 +1,38 @@ +import { Profile } from 'mixly'; + +export const spi_transfer = function (_, generator) { + generator.definitions_['include_SPI'] = '#include '; + generator.setups_['setup_spi'] = 'SPI.begin();'; + var pin = generator.valueToCode(this, 'pin', generator.ORDER_ATOMIC); + var value = generator.valueToCode(this, 'value', generator.ORDER_ATOMIC); + generator.setups_['setup_output_' + pin] = 'pinMode(' + pin + ', OUTPUT);'; + var code = "digitalWrite(" + pin + ", LOW);\n"; + code += "SPI.transfer(" + value + ");\n"; + code += "digitalWrite(" + pin + ", HIGH);\n"; + return code; +} + +export const serialBT_Init = function (_, generator) { + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || Profile.default.serial; + generator.definitions_['include_BluetoothSerial'] = '#include "BluetoothSerial.h"'; + generator.definitions_['var_declare_BluetoothSerial'] = 'BluetoothSerial SerialBT;'; + generator.setups_['setup_serial_BT'] = 'SerialBT.begin(' + content + ');'; + generator.setups_['setup_serial_started'] = 'Serial.println("The device started, now you can pair it with bluetooth!");'; + return ''; +} + +export const serialBT_available = function (_, generator) { + var code = "SerialBT.available() > 0"; + return [code, generator.ORDER_ATOMIC]; +} + +export const serialBT_read = function (_, generator) { + var code = 'SerialBT.read()'; + return [code, generator.ORDER_ATOMIC]; +} + +export const serialBT_write = function (_, generator) { + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) || '""'; + var code = 'SerialBT.write(' + content + ');\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/control.js b/mixly/boards/default_src/arduino_esp32/generators/control.js new file mode 100644 index 00000000..82700bcf --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/control.js @@ -0,0 +1,67 @@ +import { controls_delay } from '@mixly/arduino-avr/generators/control'; + +export const controls_runnig_core = function (_, generator) { + var task = this.getFieldValue('task'); + var core = this.getFieldValue('core'); + var value_length = generator.valueToCode(this, 'length', generator.ORDER_ATOMIC); + var branch = generator.statementToCode(this, 'setup'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var branch1 = generator.statementToCode(this, 'loop'); + branch1 = branch1.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_['esp32_task_' + task] = 'void task_' + task + '( void * pvParameters ){\nfor(;;){\n ' + branch1 + '\n vTaskDelay(1);\n}\n}\n'; + generator.setups_['setups_esp32_task_' + task] = '' + branch + '\n xTaskCreatePinnedToCore(task_' + task + ', "task_' + task + '", ' + value_length + ', NULL, 2, NULL, ' + core + ');\n'; + return 'vTaskDelay(1);\n'; +} + +export const control_core_delay = function (_, generator) { + var value_sleeplength = generator.valueToCode(this, 'sleeplength', generator.ORDER_ATOMIC); + var code = 'vTaskDelay(' + value_sleeplength + ');\n' + return code; +} + +export const controls_hw_timer = function (_, generator) { + var time = generator.valueToCode(this, 'TIME', generator.ORDER_ATOMIC); + var TIMER_NUM = this.getFieldValue('TIMER_NUM'); + var mode = this.getFieldValue('mode'); + generator.definitions_['hw_timer_t' + TIMER_NUM] = 'hw_timer_t * timer' + TIMER_NUM + ' =NULL;'; + var funcName = 'IRAM_ATTR onTimer' + TIMER_NUM; + var branch = generator.statementToCode(this, 'DO'); + var code = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + if (!isNaN(parseInt(time))) { + generator.setups_begin_['setup_hw_timer' + funcName] = 'timer' + TIMER_NUM + '=timerBegin(' + TIMER_NUM + ', 80, true);\n timerAttachInterrupt(timer' + TIMER_NUM + ', &onTimer' + TIMER_NUM + ', true);\n timerAlarmWrite(timer' + TIMER_NUM + ', ' + time * 1000 + ', ' + mode + ');'; + } else { + generator.setups_begin_['setup_hw_timer' + funcName] = 'timer' + TIMER_NUM + '=timerBegin(' + TIMER_NUM + ', 80, true);\n timerAttachInterrupt(timer' + TIMER_NUM + ', &onTimer' + TIMER_NUM + ', true);\n timerAlarmWrite(timer' + TIMER_NUM + ', ' + time + ', ' + mode + ');'; + } + generator.definitions_[funcName] = code; + return ''; +} + +export const controls_hw_timer_start = function () { + var TIMER_NUM = this.getFieldValue('TIMER_NUM'); + return 'timerAlarmEnable(timer' + TIMER_NUM + ');\n'; +} + +export const controls_hw_timer_stop = function () { + var TIMER_NUM = this.getFieldValue('TIMER_NUM'); + return 'timerEnd(timer' + TIMER_NUM + ');\n'; +} + +export const controls_end_program = function () { + return 'while(true);\n'; +} + +export const controls_interrupts = function () { + return 'interrupts();\n'; +} + +export const controls_nointerrupts = function () { + return 'noInterrupts();\n'; +} + +export const esp32_deep_sleep = function () { + var time = this.getFieldValue('time'); + var code = 'esp_sleep_enable_timer_wakeup(' + time + ' * 1000000);\nesp_deep_sleep_start();\n'; + return code; +} + +export const base_delay = controls_delay; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/ethernet.js b/mixly/boards/default_src/arduino_esp32/generators/ethernet.js new file mode 100644 index 00000000..c54fbd7a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/ethernet.js @@ -0,0 +1,119 @@ +export const WIFI_info = function (_, generator) { + var SSID = generator.valueToCode(this, 'SSID', generator.ORDER_ATOMIC); + var PWD = generator.valueToCode(this, 'PWD', generator.ORDER_ATOMIC); + generator.definitions_['include_WiFi'] = '#include '; + generator.setups_['setup_WiFi_begin'] = 'WiFi.begin(' + SSID + ', ' + PWD + ');\n' + + ' while (WiFi.status() != WL_CONNECTED) {\n' + + ' delay(500);\n' + + ' Serial.print(".");\n' + + ' }\n' + + ' Serial.println("Local IP:");\n' + + ' Serial.print(WiFi.localIP());\n' + return ""; +} + +// esp_now发送数据 +export const esp_now_send = function (_, generator) { + var mac = generator.valueToCode(this, 'mac', generator.ORDER_ATOMIC); + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var branch = generator.statementToCode(this, 'success'); + //branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var branch1 = generator.statementToCode(this, 'failure'); + //branch1 = branch1.replace(/(^\s*)|(\s*$)/g, ""); + mac = mac.replaceAll('"', ''); + mac = mac.toUpperCase(); + const macList = mac.split(':'); + mac = macList.join(', 0x'); + mac = '0x' + mac; + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_WifiEspNow'] = '#include '; + const macName = macList.join(''); + generator.definitions_['var_declare_PEER_' + macName] = 'uint8_t PEER_' + macName + '[] = {' + mac + '};\n'; + generator.definitions_['function_sendMessage'] = 'bool sendMessage(uint8_t *macAddress, String _data) {\n' + + ' bool ok = WifiEspNow.addPeer(macAddress, 0, nullptr, WIFI_IF_STA);\n' + + ' if (!ok) return false;\n' + + ' uint16_t length = _data.length();\n' + + ' char _msg[length];\n' + + ' strcpy(_msg, _data.c_str());\n' + + ' return WifiEspNow.send(macAddress, reinterpret_cast(_msg), length);\n' + + '}\n'; + generator.setups_['setup_esp_now'] = ` + WiFi.mode(WIFI_STA); + + Serial.print("当前设备MAC:"); + Serial.println(WiFi.macAddress()); + + bool ok = WifiEspNow.begin(); + if (!ok) { + Serial.println("WifiEspNow初始化失败"); + ESP.restart(); + }`; + var code = `if (sendMessage(PEER_${macName}, ${data})) {\n` + + branch + + '} else {\n' + + branch1 + + '}\n'; + return code; +} + +// esp_now接收数据 +export const esp_now_receive = function (_, generator) { + var branch = generator.statementToCode(this, 'receive_data'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_WifiEspNow'] = '#include '; + generator.definitions_['function_onMessageRecv'] = 'void OnMessageRecv(const uint8_t _mac[WIFIESPNOW_ALEN], const uint8_t* _buf, size_t _count, void* arg) {\n' + + ' // Serial.printf("从MAC:%02X:%02X:%02X:%02X:%02X:%02X处收到数据\\n", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);\n' + + ' String myData = "";\n' + + ' for (int i = 0; i < static_cast(_count); i++) {\n' + + ' myData += String(static_cast(_buf[i]));\n' + + ' }\n' + + ' ' + branch + '\n' + + '}\n'; + + generator.setups_['setup_esp_now_message_receive_cb'] = 'WifiEspNow.onReceive(OnMessageRecv, nullptr);'; + generator.setups_['setup_esp_now'] = ` + WiFi.mode(WIFI_STA); + + Serial.print("当前设备MAC:"); + Serial.println(WiFi.macAddress()); + + bool ok = WifiEspNow.begin(); + if (!ok) { + Serial.println("WifiEspNow初始化失败"); + ESP.restart(); + }`; + var code = ''; + return code; +} + +export const esp32_wifi_connection_event = function (_, generator) { + var type = this.getFieldValue('type'); + var branch = generator.statementToCode(this, 'event'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_['include_WiFi'] = '#include '; + if (type == 1) { + generator.definitions_['function_WiFiStationConnected'] = 'void WiFiStationConnected(WiFiEvent_t event, WiFiEventInfo_t info){\n' + + ' ' + branch + '\n' + + '}\n'; + + generator.setups_['esp32_wifi_WiFiStationConnected'] = 'WiFi.onEvent(WiFiStationConnected, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_CONNECTED);'; + } + if (type == 2) { + generator.definitions_['function_WiFiGotIP'] = 'void WiFiGotIP(WiFiEvent_t event, WiFiEventInfo_t info){\n' + + ' ' + branch + '\n' + + '}\n'; + + generator.setups_['esp32_wifi_WiFiGotIP'] = 'WiFi.onEvent(WiFiGotIP, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP);'; + } + if (type == 3) { + generator.definitions_['function_WiFiStationDisconnected'] = 'void WiFiStationDisconnected(WiFiEvent_t event, WiFiEventInfo_t info){\n' + + ' ' + branch + '\n' + + '}\n'; + + generator.setups_['esp32_wifi_WiFiStationDisconnected'] = 'WiFi.onEvent(WiFiStationDisconnected, WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);'; + } + + var code = ''; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/handbit.js b/mixly/boards/default_src/arduino_esp32/generators/handbit.js new file mode 100644 index 00000000..a988b32f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/handbit.js @@ -0,0 +1,181 @@ +import { sensor_light, sensor_sound } from './sensor'; + +export const handbit_button_is_pressed = function (_, generator) { + var btn = this.getFieldValue('btn'); + generator.setups_['setup_btn' + btn] = 'pinMode(' + btn + ',INPUT);'; + var code = '!digitalRead(' + btn + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const handbit_light = sensor_light; +export const handbit_sound = sensor_sound; + +// 传感器_重力感应块 +export const handbit_MSA300 = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_MSA300'] = '#include '; + generator.definitions_['var_declare_MSA300'] = 'MSA300 msa;\n'; + generator.setups_['setup_msa.begin'] = 'msa.begin();'; + generator.setups_['setup_Wire.begin'] = 'Wire.begin();'; + var dropdown_type = this.getFieldValue('HANDBIT_MSA300_GETAB'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +// 传感器_重力感应块 +export const handbit_MSA300_action = function (_, generator) { + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_['include_MSA300'] = '#include '; + generator.definitions_['var_declare_MSA300'] = 'MSA300 msa;\n'; + generator.setups_['setup_msa.begin'] = 'msa.begin();'; + generator.setups_['setup_Wire.begin'] = 'Wire.begin();'; + var dropdown_type = this.getFieldValue('HANDBIT_MSA300_ACTION'); + var code = dropdown_type; + return [code, generator.ORDER_ATOMIC]; +} + +export const touchAttachInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var threshold = generator.valueToCode(this, 'threshold', generator.ORDER_ATOMIC); + generator.setups_['touchAttachInterrupt' + dropdown_pin] = 'touchAttachInterrupt(' + dropdown_pin + ',gotTouch' + dropdown_pin + ', ' + threshold + ');'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var code = ''; + var funcName = 'gotTouch' + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const inout_touchRead = function (_, generator) { + var pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = 'touchRead(' + pin + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const handbit_rgb = function (_, generator) { + var value_led = generator.valueToCode(this, '_LED_', generator.ORDER_ATOMIC); + var COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setPixelColor(' + value_led + ' - 1,' + COLOR + ');\n'; + return code; +} + +export const handbit_rgb2 = function (_, generator) { + var COLOR1 = generator.valueToCode(this, 'COLOR1', generator.ORDER_ATOMIC); + var COLOR2 = generator.valueToCode(this, 'COLOR2', generator.ORDER_ATOMIC); + var COLOR3 = generator.valueToCode(this, 'COLOR3', generator.ORDER_ATOMIC); + COLOR1 = COLOR1.replace(/#/g, "0x"); + COLOR2 = COLOR2.replace(/#/g, "0x"); + COLOR3 = COLOR3.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setPixelColor(0,' + COLOR1 + ');\n'; + code += 'rgb_display_17.setPixelColor(1,' + COLOR2 + ');\n'; + code += 'rgb_display_17.setPixelColor(2,' + COLOR3 + ');\n'; + return code; +} + +export const handbit_rgb_Brightness = function (_, generator) { + var Brightness = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setBrightness(' + Brightness + ');\n'; + return code; +} + +export const handbit_rgb_show = function () { + var code = 'rgb_display_17.show();\n' + // +'rgb_display_17.show();\ndelay(1);\n' + return code; +} + +export const handbit_rgb_rainbow1 = function (_, generator) { + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_GRB + NEO_KHZ800);'; + var wait_time = generator.valueToCode(this, 'WAIT', generator.ORDER_ATOMIC); + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var funcName2 = 'Wheel'; + var code2 = 'uint32_t Wheel(byte WheelPos) {\n'; + code2 += 'if(WheelPos < 85) \n{\nreturn rgb_display_17.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n} \n'; + code2 += 'else if(WheelPos < 170) \n{\nWheelPos -= 85; \nreturn rgb_display_17.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n}\n '; + code2 += 'else\n {\nWheelPos -= 170;\nreturn rgb_display_17.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n}\n'; + code2 += '}\n'; + generator.definitions_[funcName2] = code2; + var funcName3 = 'rainbow'; + var code3 = 'void rainbow(uint8_t wait) {\n uint16_t i, j;\n'; + code3 += 'for(j=0; j<256; j++) {\n'; + code3 += 'for(i=0; i1) + // var colour = parseInt(R).toString(16); + // else + // var colour = 0+parseInt(R).toString(16); + // if(parseInt(G).toString(16).length>1) + // colour += parseInt(G).toString(16); + // else + // colour += 0+parseInt(G).toString(16); + // if(parseInt(B).toString(16).length>1) + // colour += parseInt(B).toString(16); + // else + // colour += 0+parseInt(B).toString(16); + // colour="#"+colour; + var colour = R + "*65536" + "+" + G + "*256" + "+" + B; + return [colour, generator.ORDER_NONE]; +} + +export const mixepi_rgb = function (_, generator) { + var value_led = generator.valueToCode(this, '_LED_', generator.ORDER_ATOMIC); + var COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_RGB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setPixelColor(' + value_led + '-1,' + COLOR + ');\n'; + code += 'rgb_display_17.show();\nrgb_display_17.show();\n'; + return code; +} + +export const mixepi_rgb2 = function (_, generator) { + var COLOR1 = generator.valueToCode(this, 'COLOR1', generator.ORDER_ATOMIC); + var COLOR2 = generator.valueToCode(this, 'COLOR2', generator.ORDER_ATOMIC); + var COLOR3 = generator.valueToCode(this, 'COLOR3', generator.ORDER_ATOMIC); + COLOR1 = COLOR1.replace(/#/g, "0x"); + COLOR2 = COLOR2.replace(/#/g, "0x"); + COLOR3 = COLOR3.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_RGB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setPixelColor(0,' + COLOR1 + ');\n'; + code += 'rgb_display_17.setPixelColor(1,' + COLOR2 + ');\n'; + code += 'rgb_display_17.setPixelColor(2,' + COLOR3 + ');\n'; + code += 'rgb_display_17.show();\nrgb_display_17.show();\n'; + return code; +} + +export const mixepi_rgb_Brightness = function (_, generator) { + var Brightness = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_RGB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var code = 'rgb_display_17.setBrightness(' + Brightness + ');\n'; + code += 'rgb_display_17.show();\nrgb_display_17.show();\n'; + return code; +} + +export const mixepi_rgb_rainbow1 = function (_, generator) { + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display17'] = 'Adafruit_NeoPixel rgb_display_17= Adafruit_NeoPixel(3,17,NEO_RGB + NEO_KHZ800);'; + var wait_time = generator.valueToCode(this, 'WAIT', generator.ORDER_ATOMIC); + generator.setups_['setup_rgb_display_begin_17'] = 'rgb_display_17.begin();'; + var funcName2 = 'Wheel'; + var code2 = 'uint32_t Wheel(byte WheelPos) {\n'; + code2 += 'if(WheelPos < 85) \n{\nreturn rgb_display_17.Color(WheelPos * 3, 255 - WheelPos * 3, 0);\n} \n'; + code2 += 'else if(WheelPos < 170) \n{\nWheelPos -= 85; \nreturn rgb_display_17.Color(255 - WheelPos * 3, 0, WheelPos * 3);\n}\n '; + code2 += 'else\n {\nWheelPos -= 170;\nreturn rgb_display_17.Color(0, WheelPos * 3, 255 - WheelPos * 3);\n}\n'; + code2 += '}\n'; + generator.definitions_[funcName2] = code2; + var funcName3 = 'rainbow'; + var code3 = 'void rainbow(uint8_t wait) {\n uint16_t i, j;\n'; + code3 += 'for(j=0; j<256; j++) {\n'; + code3 += 'for(i=0; imagUpdate();\n' + + 'magXMin = magXMax = sensor->magX();\n' + + 'magYMin = magYMax = sensor->magY();\n' + + 'magZMin = magZMax = sensor->magZ();\n' + + 'while(millis() - calibStartAt < (unsigned long) seconds * 1000) {\n' + + ' delay(100);\n' + + ' sensor->magUpdate();\n' + + ' magX = sensor->magX();\n' + + ' magY = sensor->magY();\n' + + ' magZ = sensor->magZ();\n' + + ' if (magX > magXMax) magXMax = magX;\n' + + ' if (magY > magYMax) magYMax = magY;\n' + + ' if (magZ > magZMax) magZMax = magZ;\n' + + ' if (magX < magXMin) magXMin = magX;\n' + + ' if (magY < magYMin) magYMin = magY;\n' + + ' if (magZ < magZMin) magZMin = magZ;\n' + + '}\n' + + 'sensor->magXOffset = - (magXMax + magXMin) / 2;\n' + + 'sensor->magYOffset = - (magYMax + magYMin) / 2;\n' + + 'sensor->magZOffset = - (magZMax + magZMin) / 2;\n' + + '}' + var code = ''; + if (dropdown_type == "a") code += 'myMPU9250.accelX()'; + if (dropdown_type == "b") code += 'myMPU9250.accelY()'; + if (dropdown_type == "c") code += 'myMPU9250.accelZ()'; + if (dropdown_type == "d") code += 'myMPU9250.gyroX()'; + if (dropdown_type == "e") code += 'myMPU9250.gyroY()'; + if (dropdown_type == "f") code += 'myMPU9250.gyroZ()'; + if (dropdown_type == "g") code += 'myMPU9250.magX()'; + if (dropdown_type == "h") code += 'myMPU9250.magY()'; + if (dropdown_type == "i") code += 'myMPU9250.magZ()'; + if (dropdown_type == "j" || dropdown_type == "h" || dropdown_type == "g" || dropdown_type == "i") { + generator.setups_['setup_magnetometer'] = 'Serial.println("Start scanning values of magnetometer to get offset values.Rotate your device for " + String(CALIB_SEC) + " seconds.");'; + generator.setups_['setup_setMagMinMaxAndSetOffset'] = 'setMagMinMaxAndSetOffset(&myMPU9250, CALIB_SEC);'; + generator.setups_['setup_magnetometerFinished'] = ' Serial.println("Finished setting offset values.");'; + generator.definitions_[func_setMagMinMaxAndSetOffset] = func_setMagMinMaxAndSetOffset; + code += 'myMPU9250.magHorizDirection()'; + } + return [code, generator.ORDER_ATOMIC]; +} + +//传感器-MPU9250-更新数据 +export const MPU9250_update = function () { + var code = 'myMPU9250.accelUpdate();\nmyMPU9250.gyroUpdate();\nmyMPU9250.magUpdate();\n'; + return code; +} + +export const Pocket_rgb = function (_, generator) { + var COLOR = generator.valueToCode(this, 'COLOR', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display12'] = 'Adafruit_NeoPixel rgb_display_12= Adafruit_NeoPixel(1,12,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_12'] = 'rgb_display_12.begin();'; + var code = 'rgb_display_12.setPixelColor(0,' + COLOR + ');\n'; + return code; +} + +export const Pocket_rgb2 = function (_, generator) { + var COLOR = generator.valueToCode(this, 'COLOR1', generator.ORDER_ATOMIC); + COLOR = COLOR.replace(/#/g, "0x"); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display12'] = 'Adafruit_NeoPixel rgb_display_12= Adafruit_NeoPixel(1,12,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_12'] = 'rgb_display_12.begin();'; + var code = 'rgb_display_12.setPixelColor(0,' + COLOR + ');\n'; + return code; +} + +export const Pocket_rgb_Brightness = function (_, generator) { + var Brightness = generator.valueToCode(this, 'Brightness', generator.ORDER_ATOMIC); + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display12'] = 'Adafruit_NeoPixel rgb_display_12= Adafruit_NeoPixel(1,12,NEO_GRB + NEO_KHZ800);'; + generator.setups_['setup_rgb_display_begin_12'] = 'rgb_display_12.begin();'; + var code = 'rgb_display_12.setBrightness(' + Brightness + ');\n'; + return code; +} + +export const Pocket_rgb_show = function () { + var code = 'rgb_display_12.show();\ndelay(1);\n'; + return code; +} + +export const pocket_RGB_color_HSV = function (_, generator) { + generator.definitions_['include_Adafruit_NeoPixel'] = '#include '; + generator.definitions_['var_declare_rgb_display12'] = 'Adafruit_NeoPixel rgb_display_12= Adafruit_NeoPixel(1,12,NEO_GRB + NEO_KHZ800);'; + var dropdown_rgbpin = 12; + var H = generator.valueToCode(this, 'H', generator.ORDER_ATOMIC); + var S = generator.valueToCode(this, 'S', generator.ORDER_ATOMIC); + var V = generator.valueToCode(this, 'V', generator.ORDER_ATOMIC); + var code = 'rgb_display_' + dropdown_rgbpin + '.setPixelColor(' + '0, ' + 'rgb_display_' + dropdown_rgbpin + '.ColorHSV(' + H + ',' + S + ',' + V + '));\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/sensor.js b/mixly/boards/default_src/arduino_esp32/generators/sensor.js new file mode 100644 index 00000000..c5c69492 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/sensor.js @@ -0,0 +1,93 @@ +import { ArduinoESP8266SensorGenerators } from '@mixly/arduino-esp8266'; + + +export const chaoshengbo = function (_, generator) { + var dropdown_pin1 = this.getFieldValue('PIN1'); + var dropdown_pin2 = this.getFieldValue('PIN2'); + generator.setups_['setup_output_' + dropdown_pin1] = 'pinMode(' + dropdown_pin1 + ', OUTPUT);'; + generator.setups_['setup_output_' + dropdown_pin2] = 'pinMode(' + dropdown_pin2 + ', INPUT);'; + var funcName = 'checkdistance_' + dropdown_pin1 + '_' + dropdown_pin2; + var code = 'float' + ' ' + funcName + '() {\n' + + ' digitalWrite(' + dropdown_pin1 + ', LOW);\n' + ' delayMicroseconds(2);\n' + + ' digitalWrite(' + dropdown_pin1 + ', HIGH);\n' + ' delayMicroseconds(10);\n' + + ' digitalWrite(' + dropdown_pin1 + ', LOW);\n' + + ' float distance = pulseIn(' + dropdown_pin2 + ', HIGH) / 58.00;\n' + + ' delay(10);\n' + ' return distance;\n' + + '}\n'; + generator.definitions_[funcName] = code; + return [funcName + '()', generator.ORDER_ATOMIC]; +} + +export const DHT = function (_, generator) { + var sensor_type = this.getFieldValue('TYPE'); + var dropdown_pin = this.getFieldValue('PIN'); + var what = this.getFieldValue('WHAT'); + generator.definitions_['include_DHT'] = '#include '; + //generator.definitions_['define_dht_pin' + dropdown_pin] = '#define DHTPIN'+dropdown_pin +' ' + dropdown_pin ; + //generator.definitions_['define_dht_type' + dropdown_pin] = '#define DHTTYPE'+dropdown_pin +' '+ sensor_type ; + generator.definitions_['var_declare_dht' + dropdown_pin] = 'DHT dht' + dropdown_pin + '(' + dropdown_pin + ', ' + sensor_type + ');' + generator.setups_['DHT_SETUP' + dropdown_pin] = ' dht' + dropdown_pin + '.begin();'; + var code; + if (what == "temperature") + code = 'dht' + dropdown_pin + '.readTemperature()' + else + code = 'dht' + dropdown_pin + '.readHumidity()' + return [code, generator.ORDER_ATOMIC]; +} + +//ESP32片内霍尔传感器值 +export const ESP32_hallRead = function (_, generator) { + var code = 'hallRead()'; + return [code, generator.ORDER_ATOMIC]; +} + +//ESP32片内温度传感器值 +export const ESP32_temprature = function (_, generator) { + generator.definitions_['wendu'] = 'extern "C"\n{\nuint8_t temprature_sens_read();\n}\nuint8_t temprature_sens_read();\n'; + var code = '(temprature_sens_read() - 32) / 1.8'; + return [code, generator.ORDER_ATOMIC]; +} + +export const sensor_light = function (_, generator) { + return ['analogRead(LIGHT)', generator.ORDER_ATOMIC]; +} + +export const sensor_sound = function (_, generator) { + return ['analogRead(SOUND)', generator.ORDER_ATOMIC]; +} + +export const ESP_TCS34725_Get_RGB = function (_, generator) { + generator.definitions_['include_Adafruit_TCS34725'] = '#include '; + generator.definitions_['var_declare_TCS34725'] = 'Adafruit_TCS34725 tcs34725 = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_24MS, TCS34725_GAIN_1X);\n'; + generator.definitions_['function_TCS34725_getRGB'] = 'uint16_t getRGB(char _type) {\n' + + ' uint16_t _red, _green, _blue, _c;\n' + + ' tcs34725.getRawData(&_red, &_green, &_blue, &_c);\n' + + ' switch (_type) {\n' + + ' case \'r\':\n' + + ' return _red;\n' + + ' case \'g\':\n' + + ' return _green;\n' + + ' case \'b\':\n' + + ' return _blue;\n' + + ' default:\n' + + ' return _c;\n' + + ' }\n' + + '}\n'; + generator.setups_['setup_Adafruit_TCS34725'] = 'tcs34725.begin(0x29);'; + const RGB = this.getFieldValue('TCS34725_COLOR'); + return ['getRGB(\'' + RGB + '\')', generator.ORDER_ATOMIC]; +} + +export const DS1307_init = ArduinoESP8266SensorGenerators.DS1307_init; + +export const gps_init = function (_, generator) { + generator.definitions_['include_TinyGPS++'] = '#include '; + generator.definitions_['include_HardwareSerial'] = '#include '; + var rx = generator.valueToCode(this, 'RX', generator.ORDER_ATOMIC); + var tx = generator.valueToCode(this, 'TX', generator.ORDER_ATOMIC); + var bt = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC) + generator.definitions_['var_declare_TinyGPSPlus_gps'] = 'TinyGPSPlus gps;'; + generator.definitions_['var_declare_gps_ss'] = 'HardwareSerial gps_ss(2);'; + generator.setups_['setup_serial_gps_ss'] = `gps_ss.begin(${bt}, SERIAL_8N1, ${rx}, ${tx});`; + return ''; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/serial.js b/mixly/boards/default_src/arduino_esp32/generators/serial.js new file mode 100644 index 00000000..38d6403c --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/serial.js @@ -0,0 +1,10 @@ +export const serial_HardwareSerial = function (_, generator) { + var serial_select = this.getFieldValue('serial_select'); + var content = generator.valueToCode(this, 'CONTENT', generator.ORDER_ATOMIC); + //var serial_no=serial_select.charAt(serial_select.length – 1); + generator.definitions_['include_HardwareSerial'] = '#include '; + var RX = generator.valueToCode(this, 'RX', generator.ORDER_ATOMIC); + var TX = generator.valueToCode(this, 'TX', generator.ORDER_ATOMIC); + generator.setups_['setup_serial_' + serial_select] = '' + serial_select + '.begin(' + content + ', SERIAL_8N1, ' + RX + ', ' + TX + ');'; + return ''; +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/sidan.js b/mixly/boards/default_src/arduino_esp32/generators/sidan.js new file mode 100644 index 00000000..1ac25728 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/sidan.js @@ -0,0 +1,92 @@ +// HSC025A 蓝牙MP3指令 +export const hsc025a_instruction = function (_, generator) { + var instruction = this.getFieldValue('instruction'); + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = ""; + if (instruction == 1) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x00);\n Serial.write(0xEF);\n'; + } + if (instruction == 2) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x01);\n Serial.write(0xEF);\n'; + } + if (instruction == 3) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x02);\n Serial.write(0xEF);\n'; + } + if (instruction == 4) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x03);\n Serial.write(0xEF);\n'; + } + if (instruction == 5) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x04);\n Serial.write(0xEF);\n'; + } + if (instruction == 6) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x05);\n Serial.write(0xEF);\n'; + } + if (instruction == 7) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x06);\n Serial.write(0xEF);\n'; + } + if (instruction == 8) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x07);\n Serial.write(0xEF);\n'; + } + if (instruction == 9) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x08);\n Serial.write(0xEF);\n'; + } + if (instruction == 10) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x09);\n Serial.write(0xEF);\n'; + } + if (instruction == 11) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x0A);\n Serial.write(0xEF);\n'; + } + if (instruction == 12) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x0D);\n Serial.write(0x00);\n Serial.write(0xEF);\n'; + } + if (instruction == 13) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x0D);\n Serial.write(0x02);\n Serial.write(0xEF);\n'; + } + if (instruction == 14) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x0D);\n Serial.write(0x04);\n Serial.write(0xEF);\n'; + } + if (instruction == 15) { + code = ' Serial.write(0x7E);\n Serial.write(0x02);\n Serial.write(0x17);\n Serial.write(0xEF);\n'; + } + if (instruction == 16) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x46);\n Serial.write(0x01);\n Serial.write(0xEF);\n'; + } + if (instruction == 17) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x51);\n Serial.write(0x00);\n Serial.write(0xEF);\n'; + } + if (instruction == 18) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x51);\n Serial.write(0x0B);\n Serial.write(0xEF);\n'; + } + if (instruction == 19) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x51);\n Serial.write(0x0C);\n Serial.write(0xEF);\n'; + } + if (instruction == 20) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x51);\n Serial.write(0x45);\n Serial.write(0xEF);\n'; + } + if (instruction == 21) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x51);\n Serial.write(0x44);\n Serial.write(0xEF);\n'; + } + if (instruction == 22) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x15);\n Serial.write(0x00);\n Serial.write(0xEF);\n'; + } + if (instruction == 23) { + code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x15);\n Serial.write(0x01);\n Serial.write(0xEF);\n'; + } + return code; +} + +// 指定播放歌曲 +export const hsc025a_play = function (_, generator) { + var num = generator.valueToCode(this, 'num', generator.ORDER_ATOMIC); + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = ' Serial.write(0x7E);\n Serial.write(0x04);\n Serial.write(0x40);\n Serial.write(0x00);\n Serial.write(' + num + ');\n Serial.write(0xEF);\n'; + return code; +} + +// 音量设置 +export const hsc025a_volume = function (_, generator) { + var num = generator.valueToCode(this, 'num', generator.ORDER_ATOMIC); + generator.setups_['setup_serial_Serial'] = 'Serial.begin(9600);'; + var code = ' Serial.write(0x7E);\n Serial.write(0x03);\n Serial.write(0x0F);\n Serial.write(' + num + ');\n Serial.write(0xEF);\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/generators/storage.js b/mixly/boards/default_src/arduino_esp32/generators/storage.js new file mode 100644 index 00000000..45ca1d0a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/generators/storage.js @@ -0,0 +1,155 @@ +// 初始化SPIFFS +export const initialize_spiffs = function (_, generator) { + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File myFile;\n'; + generator.setups_['setup_SPIFFS.begin'] = 'SPIFFS.begin(true);'; + var code = ''; + return code; +} + +// 打开文件 +export const spiffs_open_file = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + var file_path = this.getFieldValue('file_path'); + file_path = '"' + file_path + '"'; + var mode = this.getFieldValue('MODE'); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + return file_var + '= SPIFFS.open(String(' + file_path + '), ' + mode + ');\n'; +} + +export const spiffs_close_file = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + return file_var + '.close();\n'; +} + +// 将数据追加到文件 +export const spiffs_write_data = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + return file_var + '.print(String(' + data + '));\n'; +} + +// 文件可读 +export const spiffs_read_available = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + var code = file_var + '.available()'; + return [code, generator.ORDER_ATOMIC]; +} + +// 读取文件内容 +export const spiffs_read_data = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + var code = file_var + '.read()'; + return [code, generator.ORDER_ATOMIC]; +} + +// 检查文件大小 +export const spiffs_file_size = function (_, generator) { + var file_var = this.getFieldValue('file_var'); + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + generator.definitions_['esp32_spiffs'] = 'File ' + file_var + ';\n'; + var code = file_var + '.size()'; + return [code, generator.ORDER_ATOMIC]; +} + +// 删除文件 +export const spiffs_delete_file = function (_, generator) { + generator.definitions_['include_FS'] = '#include "FS.h"'; + generator.definitions_['include_SPIFFS'] = '#include "SPIFFS.h"'; + var file_path = this.getFieldValue('file_path'); + file_path = '"' + file_path + '"'; + return 'SPIFFS.remove(String(' + file_path + '));'; +} + +export const store_eeprom_write_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var funcName = 'eepromWriteLong'; + var code2 = 'void ' + funcName + '(int address, unsigned long value) {\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.ULtime=value;\n' + + ' EEPROM.write(address, time.b[0]);\n' + + ' EEPROM.write(address+1, time.b[1]);\n' + + ' if (time.b[2] != EEPROM.read(address+2) ) EEPROM.write(address+2, time.b[2]);\n' + + ' if (time.b[3] != EEPROM.read(address+3) ) EEPROM.write(address+3, time.b[3]);\n' + + ' EEPROM.commit();\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return 'eepromWriteLong(' + address + ', ' + data + ');\n'; +} + +export const store_eeprom_read_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var code = 'eepromReadLong(' + address + ')'; + var funcName = 'eepromReadLong'; + var code2 = 'unsigned long ' + funcName + '(int address) {\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.b[0] = EEPROM.read(address);\n' + + ' time.b[1] = EEPROM.read(address+1);\n' + + ' time.b[2] = EEPROM.read(address+2);\n' + + ' time.b[3] = EEPROM.read(address+3);\n' + + ' return time.ULtime;\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_write_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + return 'EEPROM.write(' + address + ', ' + data + ');\nEEPROM.commit();\n'; +} + +export const store_eeprom_read_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var code = 'EEPROM.read(' + address + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_put = function (_, generator) { + generator.setups_['setup_EEPROM_begin'] = 'EEPROM.begin(4000);'; + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.put(' + address + ', ' + data + ');\nEEPROM.commit();'; +} + +export const store_eeprom_get = function (_, generator) { + generator.setups_['setup_EEPROM_begin'] = 'EEPROM.begin(4000);'; + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.get(' + address + ', ' + data + ');\n'; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/index.js b/mixly/boards/default_src/arduino_esp32/index.js new file mode 100644 index 00000000..de1c58d5 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/index.js @@ -0,0 +1,190 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +import { + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + Procedures, + Variables, + Arduino +} from '@mixly/arduino'; + +import { + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators +} from '@mixly/arduino-avr'; + +import { + ArduinoESP32Pins, + ArduinoESP32ActuatorBlocks, + ArduinoESP32CommunicateBlocks, + ArduinoESP32ControlBlocks, + ArduinoESP32EthernetBlocks, + ArduinoESP32HandbitBlocks, + ArduinoESP32InoutBlocks, + ArduinoESP32MixePiBlocks, + ArduinoESP32MixGoBlocks, + ArduinoESP32PinoutBlocks, + ArduinoESP32PinsBlocks, + ArduinoESP32PocketCardBlocks, + ArduinoESP32SensorBlocks, + ArduinoESP32SerialBlocks, + ArduinoESP32SidanBlocks, + ArduinoESP32StorageBlocks, + ArduinoESP32ActuatorGenerators, + ArduinoESP32CommunicateGenerators, + ArduinoESP32ControlGenerators, + ArduinoESP32EthernetGenerators, + ArduinoESP32HandbitGenerators, + ArduinoESP32InoutGenerators, + ArduinoESP32MixePiGenerators, + ArduinoESP32MixGoGenerators, + ArduinoESP32PinoutGenerators, + ArduinoESP32PinsGenerators, + ArduinoESP32PocketCardGenerators, + ArduinoESP32SensorGenerators, + ArduinoESP32SerialGenerators, + ArduinoESP32SidanGenerators, + ArduinoESP32StorageGenerators, + ArduinoESP32ZhHans, + ArduinoESP32ZhHant, + ArduinoESP32En +} from './'; + +import addBoardFSItem from './mixly-modules/loader'; + +import './css/color_esp32_arduino.css'; + +Blockly.Arduino = Arduino; +Blockly.generator = Arduino; + +Object.assign(Blockly.Variables, Variables); +Object.assign(Blockly.Procedures, Procedures); + +Profile.default = {}; +Object.assign(Profile, ArduinoESP32Pins); +Object.assign(Profile.default, ArduinoESP32Pins.arduino_esp32); + +Object.assign(Blockly.Lang.ZhHans, ArduinoESP32ZhHans); +Object.assign(Blockly.Lang.ZhHant, ArduinoESP32ZhHant); +Object.assign(Blockly.Lang.En, ArduinoESP32En); + +addBoardFSItem(); + +Object.assign( + Blockly.Blocks, + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoESP32ActuatorBlocks, + ArduinoESP32CommunicateBlocks, + ArduinoESP32ControlBlocks, + ArduinoESP32EthernetBlocks, + ArduinoESP32HandbitBlocks, + ArduinoESP32InoutBlocks, + ArduinoESP32MixePiBlocks, + ArduinoESP32MixGoBlocks, + ArduinoESP32PinoutBlocks, + ArduinoESP32PinsBlocks, + ArduinoESP32PocketCardBlocks, + ArduinoESP32SensorBlocks, + ArduinoESP32SerialBlocks, + ArduinoESP32SidanBlocks, + ArduinoESP32StorageBlocks +); + +Object.assign( + Blockly.Arduino.forBlock, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators, + ArduinoESP32ActuatorGenerators, + ArduinoESP32CommunicateGenerators, + ArduinoESP32ControlGenerators, + ArduinoESP32EthernetGenerators, + ArduinoESP32HandbitGenerators, + ArduinoESP32InoutGenerators, + ArduinoESP32MixePiGenerators, + ArduinoESP32MixGoGenerators, + ArduinoESP32PinoutGenerators, + ArduinoESP32PinsGenerators, + ArduinoESP32PocketCardGenerators, + ArduinoESP32SensorGenerators, + ArduinoESP32SerialGenerators, + ArduinoESP32SidanGenerators, + ArduinoESP32StorageGenerators +); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/jsconfig.json b/mixly/boards/default_src/arduino_esp32/jsconfig.json new file mode 100644 index 00000000..7841fe4f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/jsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "baseUrl": "./", + "paths": { + "@mixly/arduino": [ + "../arduino" + ], + "@mixly/arduino-avr": [ + "../arduino_avr" + ], + "@mixly/arduino-esp8266": [ + "../arduino_esp8266" + ] + } + }, + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/language/en.js b/mixly/boards/default_src/arduino_esp32/language/en.js new file mode 100644 index 00000000..1ca696ae --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/language/en.js @@ -0,0 +1,139 @@ +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const En = {}; +const { XML } = Mixly; + +En.ESP32_CONFIG_TEMPLATE = TEMPLATE; + +En.ESP32_CONFIG_INTRODUCE = 'For more information, please visit'; + +En.ESP32_CONFIG_MESSAGE_PSRAM = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'PSRAM', + message: 'The PSRAM is an internal or external extended RAM present on some boards, modules or SoC.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#psram', + name: 'PSRAM' +}); + +En.ESP32_CONFIG_MESSAGE_PARTITION_SCHEME = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Partition Scheme', + message: 'This option is used to select the partition model according to the flash size and the resources needed, like storage area and OTA (Over The Air updates). Be careful selecting the right partition according to the flash size. If you select the wrong partition, the system will crash.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Partition Scheme' +}); + +En.ESP32_CONFIG_MESSAGE_CPU_FREQUENCY = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'CPU Frequency', + message: 'On this option, you can select the CPU clock frequency. This option is critical and must be selected according to the high-frequency crystal present on the board and the radio usage (Wi-Fi and Bluetooth). In some applications, reducing the CPU clock frequency is recommended in order to reduce power consumption. If you don’t know why you should change this frequency, leave the default option.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#cpu-frequency', + name: 'CPU Frequency' +}); + +En.ESP32_CONFIG_MESSAGE_FLASH_MODE = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Flash Mode', + message: 'This option is used to select the SPI communication mode with the flash memory. Depending on the application, this mode can be changed in order to increase the flash communication speed.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-mode', + name: 'Flash Mode' +}); + +En.ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Flash Frequency', + message: 'Use this function to select the flash memory frequency. The frequency will be dependent on the memory model.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Flash Frequency' +}); + +En.ESP32_CONFIG_MESSAGE_FLASH_SIZE = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Flash Size', + message: 'This option is used to select the flash size. The flash size should be selected according to the flash model used on your board. If you choose the wrong size, you may have issues when selecting the partition scheme.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-size', + name: 'Flash Size' +}); + +En.ESP32_CONFIG_MESSAGE_UPLOAD_SPEED = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Upload Speed', + message: 'To select the flashing speed, change the Upload Speed. This value will be used for flashing the code to the device. If you have issues while flashing the device at high speed, try to decrease this value. This could be due to the external serial-to-USB chip limitations.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#upload-speed', + name: 'Upload Speed' +}); + +En.ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Arduino Runs On', + message: 'This function is used to select the core that runs the Arduino core. This is only valid if the target SoC has 2 cores. When you have some heavy task running, you might want to run this task on a different core than the Arduino tasks. For this reason, you have this configuration to select the right core.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#arduino-runs-on', + name: 'Arduino Runs On' +}); + +En.ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Events Run On', + message: 'This function is also used to select the core that runs the Arduino events. This is only valid if the target SoC has 2 cores.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#events-run-on', + name: 'Events Run On' +}); + +En.ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'USB CDC On Boot', + message: 'The USB Communications Device Class, or USB CDC, is a class used for basic communication to be used as a regular serial controller (like RS-232). This class is used for flashing the device without any other external device attached to the SoC. This option can be used to Enable or Disable this function at the boot. If this option is Enabled, once the device is connected via USB, one new serial port will appear in the list of the serial ports. Use this new serial port for flashing the device.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-cdc-on-boot', + name: 'USB CDC On Boot' +}); + +En.ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'USB Firmware MSC On Boot', + message: 'The USB Mass Storage Class, or USB MSC, is a class used for storage devices, like a USB flash drive. This option can be used to Enable or Disable this function at the boot. If this option is Enabled, once the device is connected via USB, one new storage device will appear in the system as a storage drive. Use this new storage drive to write and read files or to drop a new firmware binary to flash the device.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-firmware-msc-on-boot', + name: 'USB Firmware MSC On Boot' +}); + +En.ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'USB DFU On Boot', + message: 'The USB Device Firmware Upgrade is a class used for flashing the device through USB. This option can be used to Enable or Disable this function at the boot. If this option is Enabled, once the device is connected via USB, the device will appear as a USB DFU capable device.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-dfu-on-boot', + name: 'USB DFU On Boot' +}); + +En.ESP32_CONFIG_MESSAGE_UPLOAD_MODE = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Upload Mode', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: '#', + name: 'None' +}); + +En.ESP32_CONFIG_MESSAGE_USB_MODE = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'USB Mode', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: '#', + name: 'None' +}); + +En.ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Core Debug Level', + message: 'This option is used to select the Arduino core debugging level to be printed to the serial debug.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#core-debug-level', + name: 'Core Debug Level' +}); + +En.ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD = XML.render(En.ESP32_CONFIG_TEMPLATE, { + title: 'Erase All Flash Before Sketch Upload', + message: 'This option selects the flash memory region to be erased before uploading the new sketch.', + moreInfo: En.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#erase-all-flash-before-sketch-upload', + name: 'Erase All Flash Before Sketch Upload' +}); + +En.BOARD_FS = 'Board FS'; + +export default En; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/language/zh-hans.js b/mixly/boards/default_src/arduino_esp32/language/zh-hans.js new file mode 100644 index 00000000..d4d27277 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/language/zh-hans.js @@ -0,0 +1,139 @@ +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const ZhHans = {}; +const { XML } = Mixly; + +ZhHans.ESP32_CONFIG_TEMPLATE = TEMPLATE; + +ZhHans.ESP32_CONFIG_INTRODUCE = '详细介绍请参考'; + +ZhHans.ESP32_CONFIG_MESSAGE_PSRAM = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'PSRAM', + message: 'PSRAM是存在于某些板、模块或SoC上的内部或外部扩展RAM。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#psram', + name: 'PSRAM' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_PARTITION_SCHEME = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '分区方案', + message: '此选项用于根据闪存大小和所需资源(如存储区域和OTA(空中更新))选择分区方案。请注意根据闪存大小选择正确的分区,如果你选择了错误的分区,系统将崩溃。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Partition Scheme' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_CPU_FREQUENCY = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'CPU时钟频率', + message: '在此选项上,你可以选择CPU时钟频率。此选项至关重要,必须根据板上的晶振和无线模块使用情况(Wi-Fi和蓝牙)进行选择。在某些应用中,建议降低CPU时钟频率以降低功耗。如果你不知道为什么要更改此频率,请保留默认选项。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#cpu-frequency', + name: 'CPU Frequency' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_FLASH_MODE = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '烧录方式', + message: '此选项用于选择与闪存的SPI通信模式。根据应用程序的不同,可以更改此模式以提高闪存通信速度。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-mode', + name: 'Flash Mode' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '闪存频率', + message: '使用此功能可选择闪存频率。频率取决于内存型号,如果你不知道内存是否支持80Mhz,你可以尝试使用80Mhz选项上传草图,并通过串行监视器查看日志输出。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Flash Frequency' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_FLASH_SIZE = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '闪存大小', + message: '此选项用于选择闪存大小。应该根据你板上使用的闪存型号来确定闪存大小,如果你选择了错误的大小,则在选择分区方案时可能会出现问题。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-size', + name: 'Flash Size' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_UPLOAD_SPEED = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '上传速度', + message: '要选择上传速度,请更改“上载速度”,此值将用于向设备烧录代码。如果在用较高的上传速度时出现问题,请尝试减小此值,这可能是由于外部串行到USB芯片的限制。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#upload-speed', + name: 'Upload Speed' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'Arduino循环核心', + message: '此选项用于选择运行Arduino核心任务的内核。只有当目标SoC有2个核心时才有效。当你有一些繁重的任务在运行时,你可能想在与Arduino任务不同的核心上运行此任务。出于这个原因,你可以使用此配置来选择正确的核心。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#arduino-runs-on', + name: 'Arduino Runs On' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'Arduino事件核心', + message: '此选项用于选择运行Arduino事件的核心,这仅在目标SoC具有2个核心的情况下有效。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#events-run-on', + name: 'Events Run On' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'USB CDC On Boot', + message: 'USB通信设备类,或USB CDC,是一个用于基本通信的类,被用作常规串行控制器。该类用于在没有任何其他外部设备连接到SoC的情况下烧写设备。该选项可用于在启动时启用或禁用该功能。如果此选项为E启用,则一旦设备通过USB连接,一个新的串行端口将出现在串行端口列表中,使用这个新的串行端口来烧写设备。这个选项也可以用于使用CDC而不是UART0通过串行监视器进行调试。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-cdc-on-boot', + name: 'USB CDC On Boot' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'USB Firmware MSC On Boot', + message: 'USB大容量存储类或USB MSC是用于存储设备(如USB闪存驱动器)的类,此选项可用于在启动时启用或禁用此功能。如果此选项为启用,则一旦设备通过USB连接,系统中将显示一个新的存储设备作为存储驱动器。使用这个新的存储驱动器来写入和读取文件,或者拖拽新的二进制固件来烧写设备。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-firmware-msc-on-boot', + name: 'USB Firmware MSC On Boot' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'USB DFU On Boot', + message: 'USB设备固件升级是一个用于通过USB烧写设备的类,此选项可用于在启动时启用或禁用此功能。如果此选项为启用,则一旦设备通过USB连接,该设备将显示为支持USB DFU的设备。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-dfu-on-boot', + name: 'USB DFU On Boot' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_UPLOAD_MODE = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '上传方式', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: '#', + name: '无' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_USB_MODE = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: 'USB模式', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: '#', + name: '无' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '核心调试级别', + message: '此选项用于选择要打印到串行调试的Arduino核心调试级别。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#core-debug-level', + name: 'Core Debug Level' +}); + +ZhHans.ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD = XML.render(ZhHans.ESP32_CONFIG_TEMPLATE, { + title: '草图上传前擦除所有闪存', + message: '此选项选择在上传新草图之前要擦除的闪存区域。', + moreInfo: ZhHans.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#erase-all-flash-before-sketch-upload', + name: 'Erase All Flash Before Sketch Upload' +}); + +ZhHans.BOARD_FS = '板卡文件管理'; + +export default ZhHans; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/language/zh-hant.js b/mixly/boards/default_src/arduino_esp32/language/zh-hant.js new file mode 100644 index 00000000..2c81d211 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/language/zh-hant.js @@ -0,0 +1,139 @@ +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const ZhHant = {}; +const { XML } = Mixly; + +ZhHant.ESP32_CONFIG_TEMPLATE = TEMPLATE; + +ZhHant.ESP32_CONFIG_INTRODUCE = '詳細介紹請參攷'; + +ZhHant.ESP32_CONFIG_MESSAGE_PSRAM = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'PSRAM', + message: 'PSRAM是存在於某些板、模塊或SoC上的內部或外部擴展RAM。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#psram', + name: 'PSRAM' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_PARTITION_SCHEME = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '分區方案', + message: '此選項用於根據閃存大小和所需資源(如存儲區域和OTA(空中更新))選擇分區方案。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Partition Scheme' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_CPU_FREQUENCY = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'CPU時鐘頻率', + message: '在此選項上,你可以選擇CPU時鐘頻率。 此選項至關重要,必須根據板上的晶振和無線模塊使用情况(Wi-Fi和藍牙)進行選擇。 在某些應用中,建議降低CPU時鐘頻率以降低功耗。 如果你不知道為什麼要更改此頻率,請保留默認選項。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#cpu-frequency', + name: 'CPU Frequency' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_FLASH_MODE = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '燒錄管道', + message: '此選項用於選擇與閃存的SPI通信模式。 根據應用程序的不同,可以更改此模式以提高閃存通信速度。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-mode', + name: 'Flash Mode' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '閃存頻率', + message: '使用此功能可選擇閃存頻率。 頻率取決於記憶體型號,如果你不知道記憶體是否支持80Mhz,你可以嘗試使用80Mhz選項上傳草圖,並通過串列監視器查看日誌輸出。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#partition-scheme', + name: 'Flash Frequency' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_FLASH_SIZE = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '閃存大小', + message: '此選項用於選擇閃存大小。 應該根據你板上使用的閃存型號來確定閃存大小,如果你選擇了錯誤的大小,則在選擇分區方案時可能會出現問題。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#flash-size', + name: 'Flash Size' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_UPLOAD_SPEED = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '上傳速度', + message: '要選擇上傳速度,請更改“上載速度”,此值將用於向設備燒錄程式碼。 如果在用較高的上傳速度時出現問題,請嘗試减小此值,這可能是由於外部串列到USB晶片的限制。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#upload-speed', + name: 'Upload Speed' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'Arduino迴圈覈心', + message: '此選項用於選擇運行Arduino覈心任務的內核。 只有當目標SoC有2個覈心時才有效。 當你有一些繁重的任務在運行時,你可能想在與Arduino任務不同的覈心上運行此任務。 出於這個原因,你可以使用此配寘來選擇正確的覈心。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#arduino-runs-on', + name: 'Arduino Runs On' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'Arduino事件覈心', + message: '此選項用於選擇運行Arduino事件的覈心,這僅在目標SoC具有2個覈心的情况下有效。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#events-run-on', + name: 'Events Run On' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'USB CDC On Boot', + message: 'USB通信設備類,或USB CDC,是一個用於基本通信的類,被用作常規串列控制器。 該類用於在沒有任何其他外部設備連接到SoC的情况下燒寫設備。 該選項可用於在啟動時啟用或禁用該功能。 如果此選項為E啟用,則一旦設備通過USB連接,一個新的串列埠將出現在串列埠清單中,使用這個新的串列埠來燒寫設備。 這個選項也可以用於使用CDC而不是UART0通過串列監視器進行調試。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-cdc-on-boot', + name: 'USB CDC On Boot' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'USB Firmware MSC On Boot', + message: 'USB大容量存儲類或USB MSC是用於儲存設備(如USB閃存驅動器)的類,此選項可用於在啟動時啟用或禁用此功能。 如果此選項為啟用,則一旦設備通過USB連接,系統中將顯示一個新的儲存設備作為存儲驅動器。 使用這個新的存儲驅動器來寫入和讀取檔案,或者拖拽新的二進位固件來燒寫設備。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-firmware-msc-on-boot', + name: 'USB Firmware MSC On Boot' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'USB DFU On Boot', + message: 'USB設備固件升級是一個用於通過USB燒寫設備的類,此選項可用於在啟動時啟用或禁用此功能。 如果此選項為啟用,則一旦設備通過USB連接,該設備將顯示為支持USB DFU的設備。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#usb-dfu-on-boot', + name: 'USB DFU On Boot' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_UPLOAD_MODE = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '上传方式', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: '#', + name: '無' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_USB_MODE = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: 'USB模式', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: '#', + name: '無' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '核心調試等級', + message: '此選項用於選擇要列印到串行調試的Arduino核心調試等級。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#core-debug-level', + name: 'Core Debug Level' +}); + +ZhHant.ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD = XML.render(ZhHant.ESP32_CONFIG_TEMPLATE, { + title: '草圖上傳前擦除所有快閃記憶體', + message: '此選項選擇在上傳新草圖之前要擦除的快閃記憶體區域。', + moreInfo: ZhHant.ESP32_CONFIG_INTRODUCE, + href: 'https://docs.espressif.com/projects/arduino-esp32/en/latest/guides/tools_menu.html#erase-all-flash-before-sketch-upload', + name: 'Erase All Flash Before Sketch Upload' +}); + +ZhHant.BOARD_FS = '闆卡文件管理'; + +export default ZhHant; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/CoreESP32C3.png b/mixly/boards/default_src/arduino_esp32/media/boards/CoreESP32C3.png new file mode 100644 index 00000000..3c835bb7 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/CoreESP32C3.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32.png b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32.png new file mode 100644 index 00000000..042b9e9b Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32C3.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32C3.jpg new file mode 100644 index 00000000..02990dd8 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32C3.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32Cam.png b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32Cam.png new file mode 100644 index 00000000..a57825e8 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32Cam.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32PicoKit.png b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32PicoKit.png new file mode 100644 index 00000000..03e851a1 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32PicoKit.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S2.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S2.jpg new file mode 100644 index 00000000..3f426887 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S2.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S3.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S3.jpg new file mode 100644 index 00000000..ad8ac62d Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/ESP32S3.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/HandbitA.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitA.jpg new file mode 100644 index 00000000..b363694a Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitA.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/HandbitB.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitB.jpg new file mode 100644 index 00000000..3e17c19e Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitB.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinA.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinA.jpg new file mode 100644 index 00000000..a8aba72b Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinA.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinB.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinB.jpg new file mode 100644 index 00000000..c30c7eb6 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/HandbitPinB.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinA.png b/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinA.png new file mode 100644 index 00000000..0d86aeaa Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinA.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinB.png b/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinB.png new file mode 100644 index 00000000..7a8d9741 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/MixGoPinB.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/NodeMCU32S.png b/mixly/boards/default_src/arduino_esp32/media/boards/NodeMCU32S.png new file mode 100644 index 00000000..07375aba Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/NodeMCU32S.png differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardA.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardA.jpg new file mode 100644 index 00000000..7b840237 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardA.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardB.jpg b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardB.jpg new file mode 100644 index 00000000..8fa36498 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardB.jpg differ diff --git a/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardPin.png b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardPin.png new file mode 100644 index 00000000..d7b836ce Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/media/boards/PocketCardPin.png differ diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/boards-partitions-info.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/boards-partitions-info.js new file mode 100644 index 00000000..818c5e34 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/boards-partitions-info.js @@ -0,0 +1,673 @@ +export default { + 'esp32:esp32:esp32c3': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:esp32s2': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:esp32': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB', + 'rainmaker' + ], + 'esp32:esp32:esp32wrover': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:pico32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32wroverkit': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:tinypico': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:feathers2': [ + 'fatflash', + 'app3M_fat9M_16MB', + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:tinys2': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:S_ODI_Ultra': [ + 'default' + ], + 'esp32:esp32:micros2': [ + 'fatflash', + 'app3M_fat9M_16MB', + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:magicbit': [ + 'default' + ], + 'esp32:esp32:turta_iot_node': [ + 'default' + ], + 'esp32:esp32:ttgo-lora32-v1': [ + 'default' + ], + 'esp32:esp32:ttgo-t1': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:ttgo-t7-v13-mini32': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:ttgo-t7-v14-mini32': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:cw02': [ + 'default' + ], + 'esp32:esp32:esp32thing': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32thing_plus': [ + 'default', + 'large_spiffs' + ], + 'esp32:esp32:sparkfun_esp32s2_thing_plus': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:sparkfun_lora_gateway_1-channel': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:nina_w10': [ + 'minimal' + ], + 'esp32:esp32:widora-air': [ + 'default' + ], + 'esp32:esp32:esp320': [ + 'default' + ], + 'esp32:esp32:nano32': [ + 'default' + ], + 'esp32:esp32:d32': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:d32_pro': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:lolin32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:lolin32-lite': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:pocket_32': [ + 'default' + ], + 'esp32:esp32:WeMosBat': [ + 'default' + ], + 'esp32:esp32:espea32': [ + 'default' + ], + 'esp32:esp32:quantum': [ + 'default' + ], + 'esp32:esp32:node32s': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:hornbill32dev': [ + 'default' + ], + 'esp32:esp32:hornbill32minima': [ + 'default' + ], + 'esp32:esp32:firebeetle32': [ + 'default' + ], + 'esp32:esp32:intorobot-fig': [ + 'default' + ], + 'esp32:esp32:onehorse32dev': [ + 'default' + ], + 'esp32:esp32:featheresp32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:adafruit_metro_esp32s2': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:adafruit_magtag29_esp32s2': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:adafruit_funhouse_esp32s2': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:adafruit_feather_esp32s2_nopsram': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:nodemcu-32s': [ + 'default' + ], + 'esp32:esp32:mhetesp32devkit': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:mhetesp32minikit': [ + 'default', + 'defaultffat', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32vn-iot-uno': [ + 'default' + ], + 'esp32:esp32:esp32doit-devkit-v1': [ + 'default' + ], + 'esp32:esp32:esp32doit-espduino': [ + 'default' + ], + 'esp32:esp32:esp32-evb': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32-gateway': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32-poe': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32-poe-iso': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32-DevKitLipo': [ + 'default', + 'minimal', + 'no_ota', + 'huge_app', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:espino32': [ + 'default' + ], + 'esp32:esp32:m5stack-core-esp32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:m5stack-fire': [ + 'default', + 'large_spiffs' + ], + 'esp32:esp32:m5stick-c': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:m5stack-atom': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:m5stack-core2': [ + 'default', + 'large_spiffs', + 'minimal', + 'no_ota', + 'noota_3g', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:m5stack-timer-cam': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:m5stack-coreink': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:odroid_esp32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:heltec_wifi_kit_32': [ + 'default' + ], + 'esp32:esp32:heltec_wifi_lora_32': [ + 'default' + ], + 'esp32:esp32:heltec_wifi_lora_32_V2': [ + 'default_8MB' + ], + 'esp32:esp32:heltec_wireless_stick': [ + 'default_8MB' + ], + 'esp32:esp32:heltec_wireless_stick_lite': [ + 'default' + ], + 'esp32:esp32:espectro32': [ + 'default' + ], + 'esp32:esp32:CoreESP32': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:alksesp32': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:wipy3': [ + 'default' + ], + 'esp32:esp32:bpi-bit': [ + 'default' + ], + 'esp32:esp32:wesp32': [ + 'default' + ], + 'esp32:esp32:t-beam': [ + 'default' + ], + 'esp32:esp32:d-duino-32': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:lopy': [ + 'default' + ], + 'esp32:esp32:lopy4': [ + 'default' + ], + 'esp32:esp32:oroca_edubot': [ + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:fm-devkit': [ + 'default' + ], + 'esp32:esp32:frogboard': [ + 'default', + 'minimal', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:esp32cam': [ + 'huge_app' + ], + 'esp32:esp32:twatch': [ + 'default', + 'large_spiffs' + ], + 'esp32:esp32:d1_mini32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:gpy': [ + 'default' + ], + 'esp32:esp32:vintlabs-devkit-v1': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:honeylemon': [ + 'default' + ], + 'esp32:esp32:mgbot-iotik32a': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:mgbot-iotik32b': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:piranha_esp-32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:metro_esp-32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:sensesiot_weizen': [ + 'default' + ], + 'esp32:esp32:kits-edu': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:mPython': [ + 'huge_app', + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:OpenKB': [ + 'default' + ], + 'esp32:esp32:wifiduino32': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:ttgo-lora32-v21new': [ + 'default' + ], + 'esp32:esp32:imbrios-logsens-v1p1': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:healthypi4': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:ET-Board': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:ch_denky': [ + 'default', + 'no_ota', + 'min_spiffs' + ], + 'esp32:esp32:uPesy_wrover': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:uPesy_wroom': [ + 'default', + 'defaultffat', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs' + ], + 'esp32:esp32:kb32': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash', + 'app3M_fat9M_16MB' + ], + 'esp32:esp32:deneyapkart': [ + 'default', + 'defaultffat', + 'default_8MB', + 'minimal', + 'no_ota', + 'noota_3g', + 'noota_ffat', + 'noota_3gffat', + 'huge_app', + 'min_spiffs', + 'fatflash' + ], + 'esp32:esp32:esp32-trueverit-iot-driver': [ + 'default' + ], + 'esp32:esp32:esp32-trueverit-iot-driver-mkii': [ + 'default' + ] +} +; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/commands.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/commands.js new file mode 100644 index 00000000..1d959755 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/commands.js @@ -0,0 +1,14 @@ +export default { + littlefs: { + download: "{{&esptool}} --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}} && {{&esptool}} --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + }, + spiffs: { + download: "{{&esptool}} --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}} && {{&esptool}} --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + }, + fatfs: { + download: "{{&esptool}} --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -t fatfs -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -t fatfs -s {{&size}} {{&img}} && {{&esptool}} --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-board-handler.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-board-handler.js new file mode 100644 index 00000000..377c8a1e --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-board-handler.js @@ -0,0 +1,91 @@ +import { Env, Boards, FSBoardHandler } from 'mixly'; +import * as path from 'path'; +import COMMANDS from './commands'; +import PARTITIONS from './partitions'; +import BOARDS_PARTITIONS_INFO from './boards-partitions-info'; +import MENU from './menu'; +import FS_INFO from './fs-info'; + +export default class FSArduEsp32Handler extends FSBoardHandler { + constructor() { + super(); + for (let key in COMMANDS) { + this.setFSCommands(key, COMMANDS[key]); + } + } + + onBeforeUpload() { + const boardKey = Boards.getSelectedBoardKey(); + const flashMode = Boards.getSelectedBoardConfigParam('FlashMode') || 'keep'; + let flashFreq = Boards.getSelectedBoardConfigParam('FlashFreq') || 'keep'; + if (flashFreq !== 'keep') { + flashFreq += 'm'; + } + let flashSize = Boards.getSelectedBoardConfigParam('FlashSize') || 'detect'; + if (flashSize !== 'detect') { + flashSize += 'B'; + } + const baud = Boards.getSelectedBoardConfigParam('UploadSpeed') || '115200'; + let partitionScheme = Boards.getSelectedBoardConfigParam('PartitionScheme'); + let partitionsType = BOARDS_PARTITIONS_INFO[boardKey] ?? []; + if (!partitionsType.includes(partitionScheme)) { + if (partitionsType.length) { + partitionScheme = partitionsType[0]; + } else { + partitionScheme = 'default'; + } + } + const partition = { ...PARTITIONS[partitionScheme] }; + if (this.getFSType() === 'default') { + this.setFSType(partition.type); + } + const fsTool = this.getFSToolPath(); + const img = path.join(Env.boardDirPath, 'build', 'script.img'); + this.updateConfig({ fsTool, img, flashMode, flashFreq, flashSize, baud, ...partition }); + } + + onBeforeDownload() { + const boardKey = Boards.getSelectedBoardKey(); + const baud = Boards.getSelectedBoardConfigParam('UploadSpeed') || '115200'; + let partitionScheme = Boards.getSelectedBoardConfigParam('PartitionScheme'); + let partitionsType = BOARDS_PARTITIONS_INFO[boardKey] ?? []; + if (!partitionsType.includes(partitionScheme)) { + if (partitionsType.length) { + partitionScheme = partitionsType[0]; + } else { + partitionScheme = 'default'; + } + } + const partition = { ...PARTITIONS[partitionScheme] }; + if (this.getFSType() === 'default') { + this.setFSType(partition.type); + } + const fsTool = this.getFSToolPath(); + const img = path.join(Env.boardDirPath, 'build', 'script.img'); + this.updateConfig({ fsTool, img, baud, ...partition }); + } + + getFSMenu() { + return MENU; + } + + getFSToolPath() { + const fsType = this.getFSType(); + let arch = 'x64'; + switch (process.arch) { + case 'arm64': + case 'arm': + arch = 'arm'; + break; + case 'ia32': + arch = 'x32'; + break; + case 'x64': + default: + arch = 'x64'; + } + const platform = Env.currentPlatform; + const fsToolInfo = FS_INFO[`mk${fsType}`]; + return path.join(Env.boardDirPath, 'build/tools', fsToolInfo[platform][arch]); + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-info.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-info.js new file mode 100644 index 00000000..d477b40a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/fs-info.js @@ -0,0 +1,50 @@ +export default { + "mkspiffs": { + "version": "0.2.3", + "linux": { + "x32": "./mkspiffs/linux/mkspiffs-x32.bin", + "x64": "./mkspiffs/linux/mkspiffs-x64.bin", + "arm": "./mkspiffs/linux/mkspiffs-arm.bin" + }, + "darwin": { + "x64": "./mkspiffs/darwin/mkspiffs.bin", + "arm": "./mkspiffs/darwin/mkspiffs.bin" + }, + "win32": { + "x32": "./mkspiffs/win32/mkspiffs.exe", + "x64": "./mkspiffs/win32/mkspiffs.exe" + } + }, + "mklittlefs": { + "version": "3.2.0", + "linux": { + "x32": "./mklittlefs/linux/mklittlefs-x64.bin", + "x64": "./mklittlefs/linux/mklittlefs-x64.bin", + "arm": "./mklittlefs/linux/mklittlefs-arm.bin" + }, + "darwin": { + "x64": "./mklittlefs/darwin/mklittlefs.bin", + "arm": "./mklittlefs/darwin/mklittlefs.bin" + }, + "win32": { + "x32": "./mklittlefs/win32/mklittlefs-x32.exe", + "x64": "./mklittlefs/win32/mklittlefs-x64.exe" + } + }, + "mkfatfs": { + "version": "2.0.1", + "linux": { + "x32": "./mkfatfs/linux/mkfatfs-x64.bin", + "x64": "./mkfatfs/linux/mkfatfs-x64.bin", + "arm": "./mkfatfs/linux/mkfatfs-arm.bin" + }, + "darwin": { + "x64": "./mkfatfs/darwin/mkfatfs.bin", + "arm": "./mkfatfs/darwin/mkfatfs.bin" + }, + "win32": { + "x32": "./mkfatfs/win32/mkfatfs.exe", + "x64": "./mkfatfs/win32/mkfatfs.exe" + } + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/loader.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/loader.js new file mode 100644 index 00000000..c2c277a9 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/loader.js @@ -0,0 +1,42 @@ +import * as goog from 'goog'; +import { Msg } from 'blockly/core'; +import { Workspace, Menu } from 'mixly'; +import FSArduEsp32Handler from './fs-board-handler'; + + +export default function addBoardFSItem () { + const mainWorkspace = Workspace.getMain(); + const statusBarsManager = mainWorkspace.getStatusBarsManager(); + const dropdownMenu = statusBarsManager.getDropdownMenu(); + const menu = dropdownMenu.getItem('menu'); + menu.add({ + weight: 2, + type: 'sep1', + preconditionFn: () => { + return goog.isElectron; + }, + data: '---------' + }); + menu.add({ + weight: 3, + type: 'filesystem-tool', + preconditionFn: () => { + return goog.isElectron; + }, + data: { + isHtmlName: true, + name: Menu.getItem(Msg.BOARD_FS), + callback: () => { + statusBarsManager.add({ + type: 'board-fs', + id: 'board-fs', + name: Msg.BOARD_FS, + title: Msg.BOARD_FS + }); + statusBarsManager.changeTo('board-fs'); + const fsStatusBar = statusBarsManager.getStatusBarById('board-fs'); + fsStatusBar.setHandler(new FSArduEsp32Handler()); + } + } + }); +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/menu.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/menu.js new file mode 100644 index 00000000..70cbfb4a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/menu.js @@ -0,0 +1,15 @@ +export default [ + { + id: 'default', + text: 'default' + }, { + id: 'spiffs', + text: 'spiffs' + }, { + id: 'fatfs', + text: 'fatfs' + }, { + id: 'littlefs', + text: 'littlefs' + } +]; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/mixly-modules/partitions.js b/mixly/boards/default_src/arduino_esp32/mixly-modules/partitions.js new file mode 100644 index 00000000..d32825a4 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/mixly-modules/partitions.js @@ -0,0 +1,107 @@ +import { FSBoardHandler } from 'mixly'; + +export default { + 'app3M_fat9M_16MB': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x610000, + size: 0x9F0000, + blockSize: 4096, + pageSize: 256 + }, + 'default': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x290000, + size: 0x160000, + blockSize: 4096, + pageSize: 256 + }, + 'default_8MB': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x670000, + size: 0x190000, + blockSize: 4096, + pageSize: 256 + }, + 'default_16MB': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0xc90000, + size: 0x370000, + blockSize: 4096, + pageSize: 256 + }, + 'defaultffat': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x290000 + 4096, + size: 0x160000 - 4096, + blockSize: 4096, + pageSize: 256 + }, + 'ffat': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x410000 + 4096, + size: 0xBF0000, + blockSize: 4096, + pageSize: 256 + }, + 'huge_app': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x310000, + size: 0xF0000, + blockSize: 4096, + pageSize: 256 + }, + 'large_spiffs_16MB': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x910000, + size: 0x6F0000, + blockSize: 4096, + pageSize: 256 + }, + 'min_spiffs': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x3D0000, + size: 0x30000, + blockSize: 4096, + pageSize: 256 + }, + 'minimal': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x150000, + size: 0xB0000 + }, + 'no_ota': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x210000, + size: 0x1F0000, + blockSize: 4096, + pageSize: 256 + }, + 'noota_3g': { + type: FSBoardHandler.FsType.SPIFFS, + offset: 0x110000, + size: 0x2F0000, + blockSize: 4096, + pageSize: 256 + }, + 'noota_3gffat': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x110000, + size: 0x2F0000, + blockSize: 4096, + pageSize: 256 + }, + 'noota_ffat': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x210000, + size: 0x1F0000, + blockSize: 4096, + pageSize: 256 + }, + 'rainmaker': { + type: FSBoardHandler.FsType.FATFS, + offset: 0x290000, + size: 0x160000, + blockSize: 4096, + pageSize: 256 + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/boards.json b/mixly/boards/default_src/arduino_esp32/origin/boards.json new file mode 100644 index 00000000..ed64a648 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/boards.json @@ -0,0 +1,2869 @@ +{ + "ESP32 Dev Module": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32", + "config": [ + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, + { + "key": "enabled", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi/BT)" + }, + { + "key": "160", + "label": "160MHz (WiFi/BT)" + }, + { + "key": "80", + "label": "80MHz (WiFi/BT)" + }, + { + "key": "40", + "label": "40MHz (40MHz XTAL)" + }, + { + "key": "26", + "label": "26MHz (26MHz XTAL)" + }, + { + "key": "20", + "label": "20MHz (40MHz XTAL)" + }, + { + "key": "13", + "label": "13MHz (26MHz XTAL)" + }, + { + "key": "10", + "label": "10MHz (40MHz XTAL)" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "2M", + "label": "2MB (16Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "LoopCore", + "label": "Arduino Runs On", + "messageId": "ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "EventsCore", + "label": "Events Run On", + "messageId": "ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "Node32s": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:node32s", + "config": [ + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default" + }, + { + "key": "no_ota", + "label": "No OTA (Large APP)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (Large APPS with OTA)" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "NodeMCU-32S": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:nodemcu-32s", + "config": [ + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "M5Stick-C": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:m5stick-c", + "config": [ + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default" + }, + { + "key": "no_ota", + "label": "No OTA (Large APP)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (Large APPS with OTA)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "1500000", + "label": "1500000" + }, + { + "key": "750000", + "label": "750000" + }, + { + "key": "500000", + "label": "500000" + }, + { + "key": "250000", + "label": "250000" + }, + { + "key": "115200", + "label": "115200" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "M5Stack-Core-ESP32": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:m5stack-core-esp32", + "config": [ + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default" + }, + { + "key": "no_ota", + "label": "No OTA (Large APP)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (Large APPS with OTA)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "M5Stack-FIRE": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:m5stack-fire", + "config": [ + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "enabled", + "label": "Enabled" + }, + { + "key": "disabled", + "label": "Disabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default (2 x 6.5 MB app, 3.6 MB SPIFFS)" + }, + { + "key": "large_spiffs", + "label": "Large SPIFFS (7 MB)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "BPI-BIT": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:bpi-bit", + "config": [ + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "AI Thinker ESP32-CAM": { + "group": "ESP32", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32cam", + "config": [ + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi/BT)" + }, + { + "key": "160", + "label": "160MHz (WiFi/BT)" + }, + { + "key": "80", + "label": "80MHz (WiFi/BT)" + }, + { + "key": "40", + "label": "40MHz (40MHz XTAL)" + }, + { + "key": "26", + "label": "26MHz (26MHz XTAL)" + }, + { + "key": "20", + "label": "20MHz (40MHz XTAL)" + }, + { + "key": "13", + "label": "13MHz (26MHz XTAL)" + }, + { + "key": "10", + "label": "10MHz (40MHz XTAL)" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "default", + "label": "Regular 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Regular 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "Labplus mPython": { + "group": "ESP32", + "xmlPath": "./xml/mpython.xml", + "key": "esp32:esp32:mPython", + "config": [ + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, + { + "key": "enabled", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi/BT)" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "8M", + "label": "8MB (64Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "ESP32C3 Dev Module": { + "group": "ESP32C3", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32c3", + "config": [ + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "160", + "label": "160MHz (WiFi)" + }, + { + "key": "80", + "label": "80MHz (WiFi)" + }, + { + "key": "40", + "label": "40MHz" + }, + { + "key": "20", + "label": "20MHz" + }, + { + "key": "10", + "label": "10MHz" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "2M", + "label": "2MB (16Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "CORE-ESP32-C3": { + "group": "ESP32C3", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32c3@core", + "config": [ + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "160", + "label": "160MHz (WiFi)" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "dio", + "label": "DIO" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "WiFiduinoV2": { + "group": "ESP32C3", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:wifiduino32c3", + "config": [ + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "160", + "label": "160MHz (WiFi)" + }, + { + "key": "80", + "label": "80MHz (WiFi)" + }, + { + "key": "40", + "label": "40MHz" + }, + { + "key": "20", + "label": "20MHz" + }, + { + "key": "10", + "label": "10MHz" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "2M", + "label": "2MB (16Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "ESP32S2 Dev Module": { + "group": "ESP32S2", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32s2", + "config": [ + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "MSCOnBoot", + "label": "USB MSC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "msc", + "label": "Enabled" + } + ] + }, + { + "key": "DFUOnBoot", + "label": "USB DFU On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "dfu", + "label": "Enabled" + } + ] + }, + { + "key": "UploadMode", + "label": "Upload Mode", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_MODE", + "options": [ + { + "key": "default", + "label": "UART0" + }, + { + "key": "cdc", + "label": "Internal USB" + } + ] + }, + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, + { + "key": "enabled", + "label": "Enabled" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi)" + }, + { + "key": "160", + "label": "160MHz (WiFi)" + }, + { + "key": "80", + "label": "80MHz (WiFi)" + }, + { + "key": "40", + "label": "40MHz" + }, + { + "key": "20", + "label": "20MHz" + }, + { + "key": "10", + "label": "10MHz" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO" + }, + { + "key": "dio", + "label": "DIO" + }, + { + "key": "qout", + "label": "QOUT" + }, + { + "key": "dout", + "label": "DOUT" + } + ] + }, + { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_FREQUENCY", + "options": [ + { + "key": "80", + "label": "80MHz" + }, + { + "key": "40", + "label": "40MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "2M", + "label": "2MB (16Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "MixGo CE": { + "group": "ESP32S2", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32s2@MixGo CE" + }, + "MixGo Car": { + "group": "ESP32S2", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32s2@MixGo Car" + }, + "ESP32S3 Dev Module": { + "group": "ESP32S3", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:esp32s3", + "config": [ + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, + { + "key": "enabled", + "label": "QSPI PSRAM" + }, + { + "key": "opi", + "label": "OPI PSRAM" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO 80MHz" + }, + { + "key": "qio120", + "label": "QIO 120MHz" + }, + { + "key": "dio", + "label": "DIO 80MHz" + }, + { + "key": "opi", + "label": "OPI 80MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + }, + { + "key": "32M", + "label": "32MB (256Mb)" + } + ] + }, + { + "key": "LoopCore", + "label": "Arduino Runs On", + "messageId": "ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "EventsCore", + "label": "Events Run On", + "messageId": "ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "USBMode", + "label": "USB Mode", + "messageId": "ESP32_CONFIG_MESSAGE_USB_MODE", + "options": [ + { + "key": "hwcdc", + "label": "Hardware CDC and JTAG" + }, + { + "key": "default", + "label": "USB-OTG (TinyUSB)" + } + ] + }, + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "MSCOnBoot", + "label": "USB MSC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "msc", + "label": "Enabled (Requires USB-OTG Mode)" + } + ] + }, + { + "key": "DFUOnBoot", + "label": "USB DFU On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "dfu", + "label": "Enabled (Requires USB-OTG Mode)" + } + ] + }, + { + "key": "UploadMode", + "label": "Upload Mode", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_MODE", + "options": [ + { + "key": "default", + "label": "UART0 / Hardware CDC" + }, + { + "key": "cdc", + "label": "USB-OTG CDC (TinyUSB)" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi)" + }, + { + "key": "160", + "label": "160MHz (WiFi)" + }, + { + "key": "80", + "label": "80MHz (WiFi)" + }, + { + "key": "40", + "label": "40MHz" + }, + { + "key": "20", + "label": "20MHz" + }, + { + "key": "10", + "label": "10MHz" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + }, + "WiFiduino32S3": { + "group": "ESP32S3", + "xmlPath": "./xml/esp32.xml", + "key": "esp32:esp32:wifiduino32s3", + "config": [ + { + "key": "PSRAM", + "label": "PSRAM", + "messageId": "ESP32_CONFIG_MESSAGE_PSRAM", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, + { + "key": "enabled", + "label": "QSPI PSRAM" + }, + { + "key": "opi", + "label": "OPI PSRAM" + } + ] + }, + { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "qio", + "label": "QIO 80MHz" + }, + { + "key": "qio120", + "label": "QIO 120MHz" + }, + { + "key": "dio", + "label": "DIO 80MHz" + }, + { + "key": "opi", + "label": "OPI 80MHz" + } + ] + }, + { + "key": "FlashSize", + "label": "Flash Size", + "messageId": "ESP32_CONFIG_MESSAGE_FLASH_SIZE", + "options": [ + { + "key": "4M", + "label": "4MB (32Mb)" + }, + { + "key": "8M", + "label": "8MB (64Mb)" + }, + { + "key": "16M", + "label": "16MB (128Mb)" + } + ] + }, + { + "key": "LoopCore", + "label": "Arduino Runs On", + "messageId": "ESP32_CONFIG_MESSAGE_ARDUINO_RUNS_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "EventsCore", + "label": "Events Run On", + "messageId": "ESP32_CONFIG_MESSAGE_EVENTS_RUN_ON", + "options": [ + { + "key": "1", + "label": "Core 1" + }, + { + "key": "0", + "label": "Core 0" + } + ] + }, + { + "key": "USBMode", + "label": "USB Mode", + "messageId": "ESP32_CONFIG_MESSAGE_USB_MODE", + "options": [ + { + "key": "hwcdc", + "label": "Hardware CDC and JTAG" + }, + { + "key": "default", + "label": "USB-OTG (TinyUSB)" + } + ] + }, + { + "key": "CDCOnBoot", + "label": "USB CDC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_CDC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "cdc", + "label": "Enabled" + } + ] + }, + { + "key": "MSCOnBoot", + "label": "USB MSC On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_FIRMWARE_MSC_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "msc", + "label": "Enabled (Requires USB-OTG Mode)" + } + ] + }, + { + "key": "DFUOnBoot", + "label": "USB DFU On Boot", + "messageId": "ESP32_CONFIG_MESSAGE_USB_DFU_ON_BOOT", + "options": [ + { + "key": "default", + "label": "Disabled" + }, + { + "key": "dfu", + "label": "Enabled (Requires USB-OTG Mode)" + } + ] + }, + { + "key": "UploadMode", + "label": "Upload Mode", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_MODE", + "options": [ + { + "key": "default", + "label": "UART0 / Hardware CDC" + }, + { + "key": "cdc", + "label": "USB-OTG CDC (TinyUSB)" + } + ] + }, + { + "key": "PartitionScheme", + "label": "Partition Scheme", + "messageId": "ESP32_CONFIG_MESSAGE_PARTITION_SCHEME", + "options": [ + { + "key": "default", + "label": "Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)" + }, + { + "key": "defaultffat", + "label": "Default 4MB with ffat (1.2MB APP/1.5MB FATFS)" + }, + { + "key": "default_8MB", + "label": "8M with spiffs (3MB APP/1.5MB SPIFFS)" + }, + { + "key": "minimal", + "label": "Minimal (1.3MB APP/700KB SPIFFS)" + }, + { + "key": "no_ota", + "label": "No OTA (2MB APP/2MB SPIFFS)" + }, + { + "key": "noota_3g", + "label": "No OTA (1MB APP/3MB SPIFFS)" + }, + { + "key": "noota_ffat", + "label": "No OTA (2MB APP/2MB FATFS)" + }, + { + "key": "noota_3gffat", + "label": "No OTA (1MB APP/3MB FATFS)" + }, + { + "key": "huge_app", + "label": "Huge APP (3MB No OTA/1MB SPIFFS)" + }, + { + "key": "min_spiffs", + "label": "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)" + }, + { + "key": "fatflash", + "label": "16M Flash (2MB APP/12.5MB FATFS)" + }, + { + "key": "app3M_fat9M_16MB", + "label": "16M Flash (3MB APP/9.9MB FATFS)" + }, + { + "key": "rainmaker", + "label": "RainMaker" + } + ] + }, + { + "key": "CPUFreq", + "label": "CPU Frequency", + "messageId": "ESP32_CONFIG_MESSAGE_CPU_FREQUENCY", + "options": [ + { + "key": "240", + "label": "240MHz (WiFi)" + }, + { + "key": "160", + "label": "160MHz (WiFi)" + }, + { + "key": "80", + "label": "80MHz (WiFi)" + }, + { + "key": "40", + "label": "40MHz" + }, + { + "key": "20", + "label": "20MHz" + }, + { + "key": "10", + "label": "10MHz" + } + ] + }, + { + "key": "UploadSpeed", + "label": "Upload Speed", + "messageId": "ESP32_CONFIG_MESSAGE_UPLOAD_SPEED", + "options": [ + { + "key": "921600", + "label": "921600" + }, + { + "key": "115200", + "label": "115200" + }, + { + "key": "230400", + "label": "230400" + } + ] + }, + { + "key": "DebugLevel", + "label": "Core Debug Level", + "messageId": "ESP32_CONFIG_MESSAGE_CORE_DEBUG_LEVEL", + "options": [ + { + "key": "none", + "label": "None" + }, + { + "key": "error", + "label": "Error" + }, + { + "key": "warn", + "label": "Warn" + }, + { + "key": "info", + "label": "Info" + }, + { + "key": "debug", + "label": "Debug" + }, + { + "key": "verbose", + "label": "Verbose" + } + ] + }, + { + "key": "EraseFlash", + "label": "Erase All Flash", + "messageId": "ESP32_CONFIG_MESSAGE_ERASE_ALL_FLASH_BEFORE_SKETCH_UPLOAD", + "options": [ + { + "key": "none", + "label": "Disabled" + }, + { + "key": "all", + "label": "Enabled" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/darwin/mkfatfs.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/darwin/mkfatfs.bin new file mode 100644 index 00000000..6f773849 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/darwin/mkfatfs.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-arm64.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-arm64.bin new file mode 100644 index 00000000..f2d8b561 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-arm64.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-x64.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-x64.bin new file mode 100644 index 00000000..2a44d7bd Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/linux/mkfatfs-x64.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libgcc_s_sjlj-1.dll b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libgcc_s_sjlj-1.dll new file mode 100644 index 00000000..004e8985 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libgcc_s_sjlj-1.dll differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libstdc++-6.dll b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libstdc++-6.dll new file mode 100644 index 00000000..94867a58 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libstdc++-6.dll differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libwinpthread-1.dll b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libwinpthread-1.dll new file mode 100644 index 00000000..500de9d4 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/libwinpthread-1.dll differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/mkfatfs.exe b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/mkfatfs.exe new file mode 100644 index 00000000..f97e5bcd Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkfatfs/win32/mkfatfs.exe differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/drawin/mklittlefs.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/drawin/mklittlefs.bin new file mode 100644 index 00000000..07c0974a Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/drawin/mklittlefs.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin new file mode 100644 index 00000000..8ca6a37a Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin new file mode 100644 index 00000000..7903c146 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin new file mode 100644 index 00000000..59b803b4 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe new file mode 100644 index 00000000..20b0067f Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe new file mode 100644 index 00000000..5b0a2b55 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/darwin/mkspiffs.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/darwin/mkspiffs.bin new file mode 100644 index 00000000..ab2c7f79 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/darwin/mkspiffs.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin new file mode 100644 index 00000000..bd1e7da0 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin new file mode 100644 index 00000000..0fee49a9 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin new file mode 100644 index 00000000..2a7fd6ff Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/win32/mkspiffs.exe b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/win32/mkspiffs.exe new file mode 100644 index 00000000..d8987211 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/build/tools/mkspiffs/win32/mkspiffs.exe differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/config.json b/mixly/boards/default_src/arduino_esp32/origin/config.json new file mode 100644 index 00000000..74a02858 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/config.json @@ -0,0 +1,41 @@ +{ + "board": "./boards.json", + "language": "C/C++", + "burn": "None", + "upload": { + "portSelect": "all" + }, + "nav": { + "compile": true, + "upload": true, + "save": { + "ino": true, + "bin": true + }, + "setting": { + "thirdPartyLibrary": true + } + }, + "serial": { + "ctrlCBtn": false, + "ctrlDBtn": false, + "baudRates": 9600, + "yMax": 100, + "yMin": 0, + "pointNum": 100 + }, + "lib": { + "mixly": { + "url": [ + "http://download.mixlylibs.cloud/mixly3-packages/cloud-libs/arduino_esp32/libs.json" + ] + } + }, + "web": { + "devices": { + "serial": true, + "hid": false, + "usb": false + } + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/RGB LED.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/RGB LED.mix new file mode 100644 index 00000000..cb683127 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/RGB LED.mix @@ -0,0 +1 @@ +1\n 255002\n 025503\n 00255 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/buzzer play two tigers.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/buzzer play two tigers.mix new file mode 100644 index 00000000..066ce488 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/buzzer play two tigers.mix @@ -0,0 +1 @@ +i1210262300029430003303000262300delay20delay30i121033030003493000392300delay200delay50i121039215004401500392150034915003303000262300delay30delay20i121029430003923000262300delay250delay2000 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Chinese.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Chinese.mix new file mode 100644 index 00000000..995bcc6f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Chinese.mix @@ -0,0 +1 @@ +SH1106_128X64_NONAMEu8g2U8G2_R0SCLSDA0x3Cu8g2page1u8g2_t_gb2312wqy12u8g200\u6211\u7231\u7C73\u601D\u9F50 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Text.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Text.mix new file mode 100644 index 00000000..1f6d1445 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/Handbit/display Text.mix @@ -0,0 +1 @@ +\u5728\u638C\u63A7\u677F\u7684OLED\u4E0A\u663E\u793A\u6587\u5B57SH1106_128X64_NONAMEu8g2U8G2_R0SCLSDA0x3Cu8g2page1u8g2tim08Ru8g200Hello,World!u8g2helv14Ru8g2020Hello,Mixly! \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MPU6050打印数值.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MPU6050打印数值.mix new file mode 100644 index 00000000..20473f91 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MPU6050打印数值.mix @@ -0,0 +1 @@ +读取MPU6050数据\n连接方式:MPU6050连接主控板的IIC接口Serial9600Serialprint\nX轴加速度:SerialprintgetAccX()Serialprint\tY轴加速度:SerialprintgetAccY()Serialprint\tZ轴加速度:SerialprintlngetAccZ()SerialprintX轴角度:SerialprintgetAngleX()Serialprint\tY轴角度:SerialprintgetAngleY()Serialprint\tZ轴角度:SerialprintlngetAngleZ()Serialprint温度:SerialprintlngetTemp()Serialprint###############################################delay100{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"921600","LoopCore":"1","EventsCore":"1"}CiNpbmNsdWRlIDxNUFU2MDUwX3RvY2tuLmg+CiNpbmNsdWRlIDxXaXJlLmg+CgpNUFU2MDUwIG1wdTYwNTAoV2lyZSk7Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFdpcmUuYmVnaW4oKTsKICBtcHU2MDUwLmJlZ2luKCk7CiAgbXB1NjA1MC5jYWxjR3lyb09mZnNldHModHJ1ZSk7Cn0KCnZvaWQgbG9vcCgpewogIC8v6K+75Y+WTVBVNjA1MOaVsOaNrlxu6L+e5o6l5pa55byP77yaTVBVNjA1MOi/nuaOpeS4u+aOp+adv+eahElJQ+aOpeWPowogIG1wdTYwNTAudXBkYXRlKCk7CiAgU2VyaWFsLnByaW50KCJcbljovbTliqDpgJ/luqY6Iik7CiAgU2VyaWFsLnByaW50KG1wdTYwNTAuZ2V0QWNjWCgpKTsKICBTZXJpYWwucHJpbnQoIlx0Wei9tOWKoOmAn+W6pjoiKTsKICBTZXJpYWwucHJpbnQobXB1NjA1MC5nZXRBY2NZKCkpOwogIFNlcmlhbC5wcmludCgiXHRa6L205Yqg6YCf5bqmOiIpOwogIFNlcmlhbC5wcmludGxuKG1wdTYwNTAuZ2V0QWNjWigpKTsKICBTZXJpYWwucHJpbnQoIljovbTop5LluqY6Iik7CiAgU2VyaWFsLnByaW50KG1wdTYwNTAuZ2V0QW5nbGVYKCkpOwogIFNlcmlhbC5wcmludCgiXHRZ6L206KeS5bqmOiIpOwogIFNlcmlhbC5wcmludChtcHU2MDUwLmdldEFuZ2xlWSgpKTsKICBTZXJpYWwucHJpbnQoIlx0Wui9tOinkuW6pjoiKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldEFuZ2xlWigpKTsKICBTZXJpYWwucHJpbnQoIua4qeW6pjoiKTsKICBTZXJpYWwucHJpbnRsbihtcHU2MDUwLmdldFRlbXAoKSk7CiAgU2VyaWFsLnByaW50KCIjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyIpOwogIGRlbGF5KDEwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MixGo/MPU9250.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MixGo/MPU9250.mix new file mode 100644 index 00000000..d5d80a62 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/MixGo/MPU9250.mix @@ -0,0 +1 @@ +Seriala \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/PWM模拟输出.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/PWM模拟输出.mix new file mode 100644 index 00000000..75ec51be --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/PWM模拟输出.mix @@ -0,0 +1 @@ +i02551120ii2550-1120i \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/SPIFFS读写数据测试.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/SPIFFS读写数据测试.mix new file mode 100644 index 00000000..89907131 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/SPIFFS读写数据测试.mix @@ -0,0 +1 @@ +SPIFFS读写数据测试写入文本会覆盖原数据,追加文本会在原数据后追加数据,数据添加可以选择是否换行Serial9600/fileName.txt2/fileName.txthello worldTRUE2/fileName.txthello worldTRUESerialprintln/fileName.txt/fileName.txt{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"921600","LoopCore":"1","EventsCore":"1"}CiNpbmNsdWRlICJGUy5oIgojaW5jbHVkZSAiU1BJRkZTLmgiCgp2b2lkIGRlbGV0ZUZpbGUoZnM6OkZTICZmcywgY29uc3QgY2hhciAqIHBhdGgpIHsKICBpZiAoZnMucmVtb3ZlKHBhdGgpKSB7CiAgICBTZXJpYWwucHJpbnRsbigiLSBmaWxlIGRlbGV0ZWQiKTsKICB9IGVsc2UgewogICAgU2VyaWFsLnByaW50bG4oIi0gZGVsZXRlIGZhaWxlZCIpOwogIH0KfQp2b2lkIGFwcGVuZEZpbGUoZnM6OkZTICZmcywgY29uc3QgY2hhciAqIHBhdGgsIGNvbnN0IGNoYXIgKiBtZXNzYWdlKSB7CiAgRmlsZSBmaWxlID0gZnMub3BlbihwYXRoLCBGSUxFX0FQUEVORCk7CiAgaWYgKCFmaWxlKSB7CiAgICBTZXJpYWwucHJpbnRsbigiLSBmYWlsZWQgdG8gb3BlbiBmaWxlIGZvciBhcHBlbmRpbmciKTsKICAgIHJldHVybjsKICB9CiAgaWYgKGZpbGUucHJpbnQobWVzc2FnZSkpIHsKICAgIFNlcmlhbC5wcmludGxuKCItIG1lc3NhZ2UgYXBwZW5kZWQiKTsKICB9IGVsc2UgewogICAgU2VyaWFsLnByaW50bG4oIi0gYXBwZW5kIGZhaWxlZCIpOwogIH0KICBmaWxlLmNsb3NlKCk7Cn0KU3RyaW5nIHJlYWRGaWxlKGZzOjpGUyAmZnMsIGNvbnN0IGNoYXIgKiBwYXRoKSB7CiAgRmlsZSBmaWxlID0gZnMub3BlbihwYXRoKTsKICBpZiAoIWZpbGUgfHwgZmlsZS5pc0RpcmVjdG9yeSgpKSB7CiAgICBTZXJpYWwucHJpbnRsbigiLSBmYWlsZWQgdG8gb3BlbiBmaWxlIGZvciByZWFkaW5nIik7CiAgICBmaWxlLmNsb3NlKCk7CiAgICByZXR1cm4gIlNQSUZGU19lcnJvciI7CiAgfSBlbHNlIHsKICAgIFNlcmlhbC5wcmludGxuKCItIHJlYWQgZnJvbSBmaWxlOiIpOwogICAgU3RyaW5nIFNQSUZGU19kYXRhID0gIiI7CiAgICB3aGlsZSAoZmlsZS5hdmFpbGFibGUoKSkgewogICAgIFNQSUZGU19kYXRhID0gU3RyaW5nKFNQSUZGU19kYXRhKSArIFN0cmluZyhjaGFyKGZpbGUucmVhZCgpKSk7CiAgIH0KICAgZmlsZS5jbG9zZSgpOwogICByZXR1cm4gU1BJRkZTX2RhdGE7CiB9Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgICBpZiAoIVNQSUZGUy5iZWdpbih0cnVlKSkgewogICAgU2VyaWFsLnByaW50bG4oIlNQSUZGUyBNb3VudCBGYWlsZWQiKTsKICAgcmV0dXJuOwogfQogIGRlbGV0ZUZpbGUoU1BJRkZTLCAiL2ZpbGVOYW1lLnR4dCIpOwogIGFwcGVuZEZpbGUoU1BJRkZTLCAiL2ZpbGVOYW1lLnR4dCIsIFN0cmluZyhTdHJpbmcoImhlbGxvIHdvcmxkIikgKyBTdHJpbmcoIlxyXG4iKSkuY19zdHIoKSk7CiAgYXBwZW5kRmlsZShTUElGRlMsICIvZmlsZU5hbWUudHh0IiwgU3RyaW5nKFN0cmluZygiaGVsbG8gd29ybGQiKSArIFN0cmluZygiXHJcbiIpKS5jX3N0cigpKTsKICBTZXJpYWwucHJpbnRsbihyZWFkRmlsZShTUElGRlMsICIvZmlsZU5hbWUudHh0IikpOwogIGRlbGV0ZUZpbGUoU1BJRkZTLCAiL2ZpbGVOYW1lLnR4dCIpOwp9Cgp2b2lkIGxvb3AoKXsKICAvL1NQSUZGU+ivu+WGmeaVsOaNrua1i+ivlQogIC8v5YaZ5YWl5paH5pys5Lya6KaG55uW5Y6f5pWw5o2u77yM6L+95Yqg5paH5pys5Lya5Zyo5Y6f5pWw5o2u5ZCO6L+95Yqg5pWw5o2u77yM5pWw5o2u5re75Yqg5Y+v5Lul6YCJ5oup5piv5ZCm5o2i6KGMCgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/URL和Base64编解码.mix new file mode 100644 index 00000000..0c173451 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi/BT)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"230400","label":"230400"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"}}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/WiFi事件.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/WiFi事件.mix new file mode 100644 index 00000000..99c7e95d --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/WiFi事件.mix @@ -0,0 +1 @@ +WiFi已连接与路由器分配IP事件仅执行一次&#10;WiFi断开事件会重复执行直到WiFi重新连接&#10;可用该事件启用设备的离线模式或者掉线多久&#10;重启设备,注意WiFi事件必须放WiFi连接前面&#10;否则事件会无效且程序工作异常1SerialprintlnWiFi已连接2Serialprintln路由器分配IP成功SerialprintlnIP3SerialprintlnWiFi已断开Netcore-65080F1234567890{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"921600","LoopCore":"1","EventsCore":"1"}CiNpbmNsdWRlIDxXaUZpLmg+Cgp2b2lkIFdpRmlTdGF0aW9uQ29ubmVjdGVkKFdpRmlFdmVudF90IGV2ZW50LCBXaUZpRXZlbnRJbmZvX3QgaW5mbyl7CiAgU2VyaWFsLnByaW50bG4oIldpRmnlt7Lov57mjqUiKTsKfQoKdm9pZCBXaUZpR290SVAoV2lGaUV2ZW50X3QgZXZlbnQsIFdpRmlFdmVudEluZm9fdCBpbmZvKXsKICBTZXJpYWwucHJpbnRsbigi6Lev55Sx5Zmo5YiG6YWNSVDmiJDlip8iKTsKICBTZXJpYWwucHJpbnRsbihXaUZpLmxvY2FsSVAoKSk7Cn0KCnZvaWQgV2lGaVN0YXRpb25EaXNjb25uZWN0ZWQoV2lGaUV2ZW50X3QgZXZlbnQsIFdpRmlFdmVudEluZm9fdCBpbmZvKXsKICBTZXJpYWwucHJpbnRsbigiV2lGaeW3suaWreW8gCIpOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFdpRmkub25FdmVudChXaUZpU3RhdGlvbkNvbm5lY3RlZCwgV2lGaUV2ZW50X3Q6OkFSRFVJTk9fRVZFTlRfV0lGSV9TVEFfQ09OTkVDVEVEKTsKICBXaUZpLm9uRXZlbnQoV2lGaUdvdElQLCBXaUZpRXZlbnRfdDo6QVJEVUlOT19FVkVOVF9XSUZJX1NUQV9HT1RfSVApOwogIFdpRmkub25FdmVudChXaUZpU3RhdGlvbkRpc2Nvbm5lY3RlZCwgV2lGaUV2ZW50X3Q6OkFSRFVJTk9fRVZFTlRfV0lGSV9TVEFfRElTQ09OTkVDVEVEKTsKICBXaUZpLmJlZ2luKCJOZXRjb3JlLTY1MDgwRiIsICIxMjM0NTY3ODkwIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKfQoKdm9pZCBsb29wKCl7CiAgLy9XaUZp5bey6L+e5o6l5LiO6Lev55Sx5Zmo5YiG6YWNSVDkuovku7bku4XmiafooYzkuIDmrKEKICAvL1dpRmnmlq3lvIDkuovku7bkvJrph43lpI3miafooYznm7TliLBXaUZp6YeN5paw6L+e5o6lCiAgLy/lj6/nlKjor6Xkuovku7blkK/nlKjorr7lpIfnmoTnprvnur/mqKHlvI/miJbogIXmjonnur/lpJrkuYUKICAvL+mHjeWQr+iuvuWkh++8jOazqOaEj1dpRmnkuovku7blv4XpobvmlL5XaUZp6L+e5o6l5YmN6Z2iCiAgLy/lkKbliJnkuovku7bkvJrml6DmlYjkuJTnqIvluo/lt6XkvZzlvILluLgKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/wifi控制小车.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/wifi控制小车.mix new file mode 100644 index 00000000..cd452c24 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/wifi控制小车.mix @@ -0,0 +1 @@ +wifi小车\n利用Blynk控制小车ssidpassword9239561b5c1e4b7290a43324f4916b61Serial96001161721819V0x125522551020V1y1-2552-2551020V2a12552-2551020V3b1-25522551020 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/中断控制.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/中断控制.mix new file mode 100644 index 00000000..0042c861 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/中断控制.mix @@ -0,0 +1 @@ +GPIO18连接按钮\nGPIO19连接按钮\n分别按下按钮,可以通过串口监视器看到输出信息Serial9600RISING18SerialprintlnGPIO18 InterrputRISING19SerialprintlnGPIO19 Interrput \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/使用http发送POST请求.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/使用http发送POST请求.mix new file mode 100644 index 00000000..f35fffac --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/使用http发送POST请求.mix @@ -0,0 +1 @@ +WIFI名称WIFI密码POSThttp://IPAddress:3000/login/{\"name\":\"Mixly\"}SerialprintlnRequest_resultSerialprintlnInvalid response!delay1000{"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi/BT)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"230400","label":"230400"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxIVFRQQ2xpZW50Lmg+Cgp2b2lkIHNldHVwKCl7CiAgV2lGaS5iZWdpbigiV0lGSeWQjeensCIsICJXSUZJ5a+G56CBIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIGlmIChXaUZpLnN0YXR1cygpID09IFdMX0NPTk5FQ1RFRCkgewogICAgSFRUUENsaWVudCBodHRwOwogICAgaHR0cC5iZWdpbigiaHR0cDovL0lQQWRkcmVzczozMDAwL2xvZ2luLyIpOwogICAgaHR0cC5hZGRIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi9qc29uIik7CiAgICBpbnQgaHR0cENvZGUgPSBodHRwLlBPU1QoIntcIm5hbWVcIjpcIk1peGx5XCJ9Iik7CiAgICBpZiAoaHR0cENvZGUgPiAwKSB7CiAgICAgIFN0cmluZyBSZXF1ZXN0X3Jlc3VsdCA9IGh0dHAuZ2V0U3RyaW5nKCk7CiAgICAgIFNlcmlhbC5wcmludGxuKFJlcXVlc3RfcmVzdWx0KTsKICAgIH0KICAgIGVsc2UgewogICAgICBTZXJpYWwucHJpbnRsbigiSW52YWxpZCByZXNwb25zZSEiKTsKICAgIH0KICAgIGh0dHAuZW5kKCk7CiAgfQogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/定时器.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/定时器.mix new file mode 100644 index 00000000..89be4165 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/定时器.mix @@ -0,0 +1 @@ +0true50016HIGH160 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/心知天气.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/心知天气.mix new file mode 100644 index 00000000..1829399f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/心知天气.mix @@ -0,0 +1 @@ +Serial9600Xiaomi_043218768195210weather/nowzh-Hansc浙江杭州S9l2sb_ZK-UsWaynG15000weather/nowupdateSerialprintlngetWeatherText{"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi/BT)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"230400","label":"230400"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxFU1A4MjY2X1Nlbml2ZXJzZS5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KCldlYXRoZXJOb3cgd2VhdGhlck5vdzsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlmICh3ZWF0aGVyTm93LnVwZGF0ZSgpKSB7CiAgICBTZXJpYWwucHJpbnRsbih3ZWF0aGVyTm93LmdldFdlYXRoZXJUZXh0KCkpOwoKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5iZWdpbigiWGlhb21pXzA0MzIiLCAiMTg3NjgxOTUyMTAiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIHdlYXRoZXJOb3cuY29uZmlnKCJTOWwyc2JfWkstVXNXYXluRyIsICJoYW5nemhvdSIsICJjIiwgInpoLUhhbnMiKTsKICB0aW1lci5zZXRJbnRlcnZhbCg1MDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/旋转编码器读取数据.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/旋转编码器读取数据.mix new file mode 100644 index 00000000..3b37469c --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/旋转编码器读取数据.mix @@ -0,0 +1 @@ +Serial96001421resetPosition51setUpperBound101setLowerBound01setLeftRotationHandlerSerialprintln左转:Mixly1getPosition1setRightRotationHandlerSerialprintln右转:Mixly1getPosition1setChangedHandlerSerialprintln状态改变:MixlyEQ1getDirection1右转左转1setUpperOverflowHandlerSerialprintln高于上限:Mixly1getPosition1setLowerOverflowHandlerSerialprintln低于下限:Mixly1getPosition{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"921600","LoopCore":"1","EventsCore":"1"}CiNpbmNsdWRlIDxFU1BSb3RhcnkuaD4KCkVTUFJvdGFyeSBlbmNvZGVyMTsKCnZvaWQgZW5jb2RlcjFPbkxlZnRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuW3pui9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuWPs+i9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uQ2hhbmdlZChFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIueKtuaAgeaUueWPmO+8miIpICsgU3RyaW5nKCgoZW5jb2RlcjEuZ2V0RGlyZWN0aW9uKCkgPT0gMSk/IuWPs+i9rCI6IuW3pui9rCIpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPblVwcGVyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLpq5jkuo7kuIrpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPbkxvd2VyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLkvY7kuo7kuIvpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgZW5jb2RlcjEuYmVnaW4oMiwgNCk7CiAgZW5jb2RlcjEuc2V0U3RlcHNQZXJDbGljaygyKTsKICBlbmNvZGVyMS5yZXNldFBvc2l0aW9uKDUpOwogIGVuY29kZXIxLnNldFVwcGVyQm91bmQoMTApOwogIGVuY29kZXIxLnNldExvd2VyQm91bmQoMCk7CiAgZW5jb2RlcjEuc2V0TGVmdFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uTGVmdFJvdGF0aW9uKTsKICBlbmNvZGVyMS5zZXRSaWdodFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbik7CiAgZW5jb2RlcjEuc2V0Q2hhbmdlZEhhbmRsZXIoZW5jb2RlcjFPbkNoYW5nZWQpOwogIGVuY29kZXIxLnNldFVwcGVyT3ZlcmZsb3dIYW5kbGVyKGVuY29kZXIxT25VcHBlck92ZXJmbG93KTsKICBlbmNvZGVyMS5zZXRMb3dlck92ZXJmbG93SGFuZGxlcihlbmNvZGVyMU9uTG93ZXJPdmVyZmxvdyk7Cn0KCnZvaWQgbG9vcCgpewogIGVuY29kZXIxLmxvb3AoKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESP32双核的简单使用.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESP32双核的简单使用.mix new file mode 100644 index 00000000..50465c91 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESP32双核的简单使用.mix @@ -0,0 +1 @@ +ESP32拥有两个核心,核心0与核心1,默认程序运行在核心1&#10;可以使用Task调用核心0或者核心1执行不同任务且不会相互干扰&#10;(同一时刻,同一硬件资源,只能被一个核心调用,记住这个&#10;使用限制,使用需注意否则会导致开发板无限重启),双核是&#10;真正意义上的独立运行不会受到另一个核心的影响例如下方的&#10;例子当中主循环的延时函数并不会影响核心0的任务执行,Task&#10;使用类似于UNO多线程Serial9600Serialprintln开始任务1104096Serialprintln开始任务2Serialprintln任务2delay1000Serialprintln任务1delay2000{"PSRAM":"disabled","PartitionScheme":"default","CPUFreq":"240","FlashMode":"qio","FlashFreq":"80","FlashSize":"4M","UploadSpeed":"115200","LoopCore":"1","EventsCore":"1"}dm9pZCB0YXNrXzEoIHZvaWQgKiBwdlBhcmFtZXRlcnMgKXsKZm9yKDs7KXsKICBTZXJpYWwucHJpbnRsbigi5Lu75YqhMiIpOwogIGRlbGF5KDEwMDApOwogIHZUYXNrRGVsYXkoMSk7Cn0KfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBTZXJpYWwucHJpbnRsbigi5byA5aeL5Lu75YqhMSIpOwogIFNlcmlhbC5wcmludGxuKCLlvIDlp4vku7vliqEyIik7CiAgeFRhc2tDcmVhdGVQaW5uZWRUb0NvcmUodGFza18xLCAidGFza18xIiwgNDA5NiwgTlVMTCwgMiwgTlVMTCwgMCk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL0VTUDMy5oul5pyJ5Lik5Liq5qC45b+D77yM5qC45b+DMOS4juaguOW/gzHvvIzpu5jorqTnqIvluo/ov5DooYzlnKjmoLjlv4MxCiAgLy/lj6/ku6Xkvb/nlKhUYXNr6LCD55So5qC45b+DMOaIluiAheaguOW/gzHmiafooYzkuI3lkIzku7vliqHkuJTkuI3kvJrnm7jkupLlubLmibAKICAvL++8iOWQjOS4gOaXtuWIu++8jOWQjOS4gOehrOS7tui1hOa6kO+8jOWPquiDveiiq+S4gOS4quaguOW/g+iwg+eUqO+8jOiusOS9j+i/meS4qgogIC8v5L2/55So6ZmQ5Yi277yM5L2/55So6ZyA5rOo5oSP5ZCm5YiZ5Lya5a+86Ie05byA5Y+R5p2/5peg6ZmQ6YeN5ZCv77yJ77yM5Y+M5qC45pivCiAgLy/nnJ/mraPmhI/kuYnkuIrnmoTni6znq4vov5DooYzkuI3kvJrlj5fliLDlj6bkuIDkuKrmoLjlv4PnmoTlvbHlk43kvovlpoLkuIvmlrnnmoQKICAvL+S+i+WtkOW9k+S4reS4u+W+queOr+eahOW7tuaXtuWHveaVsOW5tuS4jeS8muW9seWTjeaguOW/gzDnmoTku7vliqHmiafooYzvvIxUYXNrCiAgLy/kvb/nlKjnsbvkvLzkuo5VTk/lpJrnur/nqIsKCiAgdlRhc2tEZWxheSgxKTsKCiAgU2VyaWFsLnByaW50bG4oIuS7u+WKoTEiKTsKICBkZWxheSgyMDAwKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESPnow无线通讯简单案例.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESPnow无线通讯简单案例.mix new file mode 100644 index 00000000..b6c6468a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/简明教程/ESPnow无线通讯简单案例.mix @@ -0,0 +1 @@ +ESPnow是一种短距离无线通讯方式,可以一对一或者一对多,多对多通讯&#10;一对一时需要获取对方的MAC地址作为信息接收地址,将发送地址修改为&#10;通配符FF:FF:FF:FF:FF:FF可向所有设备发送消息,使用两块开发板,一块先&#10;获取自身MAC地址并上传ESPnow接收程序,另一块开发板分别上传指定MAC&#10;地址与通配符MAC地址,对比其中差异思考如何使用通配符向多个设备发送消息,同时接收端进行区分消息来源提示发送与接收消息时都包含己方与接收方的MAC地址,通过MAC地址&#10;判断消息来源与接收者Serial9600SerialprintlnMAC11000将MAC地址修改为FF:FF:FF:FF:FF:FF可群发消息给所有设备FF:FF:FF:FF:FF:FFrandom Mixly1100SerialprintlnSent with successSerialprintlnError sending the data指定MAC地址可以发送消息给指定设备30:AE:A4:58:9D:7Crandom Mixly1100SerialprintlnSent with successSerialprintlnError sending the dataSerialprintlnmyData{"PartitionScheme":"default","UploadSpeed":"1500000"}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxXaWZpRXNwTm93Lmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKdWludDhfdCBQRUVSXzMwQUVBNDU4OUQ3Q1tdID0gezB4MzAsIDB4QUUsIDB4QTQsIDB4NTgsIDB4OUQsIDB4N0N9OwoKU2ltcGxlVGltZXIgdGltZXI7Cgpib29sIHNlbmRNZXNzYWdlKFN0cmluZyBfZGF0YSkgewogIGNoYXIgX21zZ1sxMDBdOwogIHVpbnQ4X3QgX2xlbiA9IHNucHJpbnRmKF9tc2csIDEwMCwgIiVzIiwgX2RhdGEpOwogIHJldHVybiBXaWZpRXNwTm93LnNlbmQoUEVFUl8zMEFFQTQ1ODlEN0MsIHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgdWludDhfdCo+KF9tc2cpLCBfbGVuKTsKfQoKdm9pZCBTaW1wbGVfdGltZXJfMSgpIHsKICBpZiAoc2VuZE1lc3NhZ2UoU3RyaW5nKCJyYW5kb20gIikgKyBTdHJpbmcoKHJhbmRvbSgxLCAxMDApKSkpKSB7CiAgICAgIFNlcmlhbC5wcmludGxuKCJTZW50IHdpdGggc3VjY2VzcyIpOwogICAgfSBlbHNlIHsKICAgICAgU2VyaWFsLnByaW50bG4oIkVycm9yIHNlbmRpbmcgdGhlIGRhdGEiKTsKICAgIH0KfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBTZXJpYWwucHJpbnRsbihXaUZpLm1hY0FkZHJlc3MoKSk7CgogIFdpRmkubW9kZShXSUZJX1NUQSk7CgogIFNlcmlhbC5wcmludCgi5b2T5YmN6K6+5aSHTUFDOiIpOwogIFNlcmlhbC5wcmludGxuKFdpRmkubWFjQWRkcmVzcygpKTsKCiAgYm9vbCBvayA9IFdpZmlFc3BOb3cuYmVnaW4oKTsKICBpZiAoIW9rKSB7CiAgICBTZXJpYWwucHJpbnRsbigiV2lmaUVzcE5vd+WIneWni+WMluWksei0pSIpOwogICAgRVNQLnJlc3RhcnQoKTsKICB9CgogIG9rID0gV2lmaUVzcE5vdy5hZGRQZWVyKFBFRVJfMzBBRUE0NTg5RDdDLCAwLCBudWxscHRyLCBXSUZJX0lGX1NUQSk7CiAgaWYgKCFvaykgewogICAgU2VyaWFsLnByaW50bG4oIldpZmlFc3BOb3cuYWRkUGVlcigpIGZhaWxlZCIpOwogICAgRVNQLnJlc3RhcnQoKTsKICB9CiAgdGltZXIuc2V0SW50ZXJ2YWwoMTAwMEwsIFNpbXBsZV90aW1lcl8xKTsKCn0KCnZvaWQgbG9vcCgpewogIC8vRVNQbm935piv5LiA56eN55+t6Led56a75peg57q/6YCa6K6v5pa55byP77yM5Y+v5Lul5LiA5a+55LiA5oiW6ICF5LiA5a+55aSa77yM5aSa5a+55aSa6YCa6K6vCiAgLy/kuIDlr7nkuIDml7bpnIDopoHojrflj5blr7nmlrnnmoRNQUPlnLDlnYDkvZzkuLrkv6Hmga/mjqXmlLblnLDlnYDvvIzlsIblj5HpgIHlnLDlnYDkv67mlLnkuLoKICAvL+mAmumFjeespkZGOkZGOkZGOkZGOkZGOkZG5Y+v5ZCR5omA5pyJ6K6+5aSH5Y+R6YCB5raI5oGv77yM5L2/55So5Lik5Z2X5byA5Y+R5p2/77yM5LiA5Z2X5YWICiAgLy/ojrflj5boh6rouqtNQUPlnLDlnYDlubbkuIrkvKBFU1Bub3fmjqXmlLbnqIvluo/vvIzlj6bkuIDlnZflvIDlj5Hmnb/liIbliKvkuIrkvKDmjIflrppNQUMKICAvL+WcsOWdgOS4jumAmumFjeespk1BQ+WcsOWdgO+8jOWvueavlOWFtuS4reW3ruW8ggogIC8v5oCd6ICD5aaC5L2V5L2/55So6YCa6YWN56ym5ZCR5aSa5Liq6K6+5aSH5Y+R6YCB5raI5oGv77yM5ZCM5pe25o6l5pS256uv6L+b6KGM5Yy65YiG5raI5oGv5p2l5rqQCiAgLy/mj5DnpLrlj5HpgIHkuI7mjqXmlLbmtojmga/ml7bpg73ljIXlkKvlt7HmlrnkuI7mjqXmlLbmlrnnmoRNQUPlnLDlnYDvvIzpgJrov4dNQUPlnLDlnYAKICAvL+WIpOaWrea2iOaBr+adpea6kOS4juaOpeaUtuiAhQoKICB0aW1lci5ydW4oKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/触摸中断.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/触摸中断.mix new file mode 100644 index 00000000..d9f5d3d7 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32 Dev Module/触摸中断.mix @@ -0,0 +1 @@ +22019HIGH19 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/URL和Base64编解码.mix new file mode 100644 index 00000000..99e7e43f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={"CDCOnBoot":{"key":"default","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"160","label":"160MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"230400","label":"230400"}}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/使用http发送POST请求.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/使用http发送POST请求.mix new file mode 100644 index 00000000..d351dc03 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/使用http发送POST请求.mix @@ -0,0 +1 @@ +WIFI名称WIFI密码POSThttp://IPAddress:3000/login/{\"name\":\"Mixly\"}SerialprintlnRequest_resultSerialprintlnInvalid response!delay1000{"CDCOnBoot":{"key":"default","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"160","label":"160MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"230400","label":"230400"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxIVFRQQ2xpZW50Lmg+Cgp2b2lkIHNldHVwKCl7CiAgV2lGaS5iZWdpbigiV0lGSeWQjeensCIsICJXSUZJ5a+G56CBIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIGlmIChXaUZpLnN0YXR1cygpID09IFdMX0NPTk5FQ1RFRCkgewogICAgSFRUUENsaWVudCBodHRwOwogICAgaHR0cC5iZWdpbigiaHR0cDovL0lQQWRkcmVzczozMDAwL2xvZ2luLyIpOwogICAgaHR0cC5hZGRIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi9qc29uIik7CiAgICBpbnQgaHR0cENvZGUgPSBodHRwLlBPU1QoIntcIm5hbWVcIjpcIk1peGx5XCJ9Iik7CiAgICBpZiAoaHR0cENvZGUgPiAwKSB7CiAgICAgIFN0cmluZyBSZXF1ZXN0X3Jlc3VsdCA9IGh0dHAuZ2V0U3RyaW5nKCk7CiAgICAgIFNlcmlhbC5wcmludGxuKFJlcXVlc3RfcmVzdWx0KTsKICAgIH0KICAgIGVsc2UgewogICAgICBTZXJpYWwucHJpbnRsbigiSW52YWxpZCByZXNwb25zZSEiKTsKICAgIH0KICAgIGh0dHAuZW5kKCk7CiAgfQogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/心知天气.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/心知天气.mix new file mode 100644 index 00000000..a5749229 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32C3 Dev Module/心知天气.mix @@ -0,0 +1 @@ +Serial9600Xiaomi_043218768195210weather/nowzh-Hansc浙江杭州S9l2sb_ZK-UsWaynG15000weather/nowupdateSerialprintlngetWeatherText{"CDCOnBoot":{"key":"cdc","label":"Enabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"160","label":"160MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxFU1A4MjY2X1Nlbml2ZXJzZS5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KCldlYXRoZXJOb3cgd2VhdGhlck5vdzsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlmICh3ZWF0aGVyTm93LnVwZGF0ZSgpKSB7CiAgICBTZXJpYWwucHJpbnRsbih3ZWF0aGVyTm93LmdldFdlYXRoZXJUZXh0KCkpOwoKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5iZWdpbigiWGlhb21pXzA0MzIiLCAiMTg3NjgxOTUyMTAiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIHdlYXRoZXJOb3cuY29uZmlnKCJTOWwyc2JfWkstVXNXYXluRyIsICJoYW5nemhvdSIsICJjIiwgInpoLUhhbnMiKTsKICB0aW1lci5zZXRJbnRlcnZhbCg1MDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/URL和Base64编解码.mix new file mode 100644 index 00000000..36324457 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0"},"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/使用http发送POST请求.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/使用http发送POST请求.mix new file mode 100644 index 00000000..2f70d161 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/使用http发送POST请求.mix @@ -0,0 +1 @@ +WIFI名称WIFI密码POSThttp://IPAddress:3000/login/{\"name\":\"Mixly\"}SerialprintlnRequest_resultSerialprintlnInvalid response!delay1000{"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0"},"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxIVFRQQ2xpZW50Lmg+Cgp2b2lkIHNldHVwKCl7CiAgV2lGaS5iZWdpbigiV0lGSeWQjeensCIsICJXSUZJ5a+G56CBIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIGlmIChXaUZpLnN0YXR1cygpID09IFdMX0NPTk5FQ1RFRCkgewogICAgSFRUUENsaWVudCBodHRwOwogICAgaHR0cC5iZWdpbigiaHR0cDovL0lQQWRkcmVzczozMDAwL2xvZ2luLyIpOwogICAgaHR0cC5hZGRIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi9qc29uIik7CiAgICBpbnQgaHR0cENvZGUgPSBodHRwLlBPU1QoIntcIm5hbWVcIjpcIk1peGx5XCJ9Iik7CiAgICBpZiAoaHR0cENvZGUgPiAwKSB7CiAgICAgIFN0cmluZyBSZXF1ZXN0X3Jlc3VsdCA9IGh0dHAuZ2V0U3RyaW5nKCk7CiAgICAgIFNlcmlhbC5wcmludGxuKFJlcXVlc3RfcmVzdWx0KTsKICAgIH0KICAgIGVsc2UgewogICAgICBTZXJpYWwucHJpbnRsbigiSW52YWxpZCByZXNwb25zZSEiKTsKICAgIH0KICAgIGh0dHAuZW5kKCk7CiAgfQogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/心知天气.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/心知天气.mix new file mode 100644 index 00000000..16e25849 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S2 Dev Module/心知天气.mix @@ -0,0 +1 @@ +Serial9600Xiaomi_043218768195210weather/nowzh-Hansc浙江杭州S9l2sb_ZK-UsWaynG15000weather/nowupdateSerialprintlngetWeatherText{"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0"},"PSRAM":{"key":"disabled","label":"Disabled"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"FlashMode":{"key":"qio","label":"QIO"},"FlashFreq":{"key":"80","label":"80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxFU1A4MjY2X1Nlbml2ZXJzZS5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KCldlYXRoZXJOb3cgd2VhdGhlck5vdzsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlmICh3ZWF0aGVyTm93LnVwZGF0ZSgpKSB7CiAgICBTZXJpYWwucHJpbnRsbih3ZWF0aGVyTm93LmdldFdlYXRoZXJUZXh0KCkpOwoKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5iZWdpbigiWGlhb21pXzA0MzIiLCAiMTg3NjgxOTUyMTAiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIHdlYXRoZXJOb3cuY29uZmlnKCJTOWwyc2JfWkstVXNXYXluRyIsICJoYW5nemhvdSIsICJjIiwgInpoLUhhbnMiKTsKICB0aW1lci5zZXRJbnRlcnZhbCg1MDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/URL和Base64编解码.mix new file mode 100644 index 00000000..7cf2185f --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={"PSRAM":{"key":"disabled","label":"Disabled"},"FlashMode":{"key":"qio","label":"QIO 80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"},"USBMode":{"key":"default","label":"USB-OTG (TinyUSB)"},"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0 / Hardware CDC"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/使用http发送POST请求.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/使用http发送POST请求.mix new file mode 100644 index 00000000..67e924d4 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/使用http发送POST请求.mix @@ -0,0 +1 @@ +WIFI名称WIFI密码POSThttp://IPAddress:3000/login/{\"name\":\"Mixly\"}SerialprintlnRequest_resultSerialprintlnInvalid response!delay1000{"PSRAM":{"key":"disabled","label":"Disabled"},"FlashMode":{"key":"qio","label":"QIO 80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"},"USBMode":{"key":"default","label":"USB-OTG (TinyUSB)"},"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0 / Hardware CDC"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxIVFRQQ2xpZW50Lmg+Cgp2b2lkIHNldHVwKCl7CiAgV2lGaS5iZWdpbigiV0lGSeWQjeensCIsICJXSUZJ5a+G56CBIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBTZXJpYWwuYmVnaW4oOTYwMCk7Cn0KCnZvaWQgbG9vcCgpewogIGlmIChXaUZpLnN0YXR1cygpID09IFdMX0NPTk5FQ1RFRCkgewogICAgSFRUUENsaWVudCBodHRwOwogICAgaHR0cC5iZWdpbigiaHR0cDovL0lQQWRkcmVzczozMDAwL2xvZ2luLyIpOwogICAgaHR0cC5hZGRIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi9qc29uIik7CiAgICBpbnQgaHR0cENvZGUgPSBodHRwLlBPU1QoIntcIm5hbWVcIjpcIk1peGx5XCJ9Iik7CiAgICBpZiAoaHR0cENvZGUgPiAwKSB7CiAgICAgIFN0cmluZyBSZXF1ZXN0X3Jlc3VsdCA9IGh0dHAuZ2V0U3RyaW5nKCk7CiAgICAgIFNlcmlhbC5wcmludGxuKFJlcXVlc3RfcmVzdWx0KTsKICAgIH0KICAgIGVsc2UgewogICAgICBTZXJpYWwucHJpbnRsbigiSW52YWxpZCByZXNwb25zZSEiKTsKICAgIH0KICAgIGh0dHAuZW5kKCk7CiAgfQogIGRlbGF5KDEwMDApOwoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/心知天气.mix b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/心知天气.mix new file mode 100644 index 00000000..d78eb8ef --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/ESP32S3 Dev Module/心知天气.mix @@ -0,0 +1 @@ +Serial9600Xiaomi_043218768195210weather/nowzh-Hansc浙江杭州S9l2sb_ZK-UsWaynG15000weather/nowupdateSerialprintlngetWeatherText{"PSRAM":{"key":"disabled","label":"Disabled"},"FlashMode":{"key":"qio","label":"QIO 80MHz"},"FlashSize":{"key":"4M","label":"4MB (32Mb)"},"LoopCore":{"key":"1","label":"Core 1"},"EventsCore":{"key":"1","label":"Core 1"},"USBMode":{"key":"default","label":"USB-OTG (TinyUSB)"},"CDCOnBoot":{"key":"default","label":"Disabled"},"MSCOnBoot":{"key":"default","label":"Disabled"},"DFUOnBoot":{"key":"default","label":"Disabled"},"UploadMode":{"key":"default","label":"UART0 / Hardware CDC"},"PartitionScheme":{"key":"default","label":"Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)"},"CPUFreq":{"key":"240","label":"240MHz (WiFi)"},"UploadSpeed":{"key":"921600","label":"921600"}}CiNpbmNsdWRlIDxXaUZpLmg+CiNpbmNsdWRlIDxFU1A4MjY2X1Nlbml2ZXJzZS5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KCldlYXRoZXJOb3cgd2VhdGhlck5vdzsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIGlmICh3ZWF0aGVyTm93LnVwZGF0ZSgpKSB7CiAgICBTZXJpYWwucHJpbnRsbih3ZWF0aGVyTm93LmdldFdlYXRoZXJUZXh0KCkpOwoKICB9Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5iZWdpbigiWGlhb21pXzA0MzIiLCAiMTg3NjgxOTUyMTAiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIHdlYXRoZXJOb3cuY29uZmlnKCJTOWwyc2JfWkstVXNXYXluRyIsICJoYW5nemhvdSIsICJjIiwgInpoLUhhbnMiKTsKICB0aW1lci5zZXRJbnRlcnZhbCg1MDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/examples/map.json b/mixly/boards/default_src/arduino_esp32/origin/examples/map.json new file mode 100644 index 00000000..8e86269b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/examples/map.json @@ -0,0 +1,142 @@ +{ + "ESP32 Dev Module": { + "Handbit": { + "buzzer play two tigers.mix": { + "__file__": true, + "__name__": "buzzer play two tigers.mix" + }, + "display Chinese.mix": { + "__file__": true, + "__name__": "display Chinese.mix" + }, + "display Text.mix": { + "__file__": true, + "__name__": "display Text.mix" + }, + "RGB LED.mix": { + "__file__": true, + "__name__": "RGB LED.mix" + }, + "__file__": false, + "__name__": "Handbit" + }, + "MixGo": { + "MPU9250.mix": { + "__file__": true, + "__name__": "MPU9250.mix" + }, + "__file__": false, + "__name__": "MixGo" + }, + "MPU6050打印数值.mix": { + "__file__": true, + "__name__": "MPU6050打印数值.mix" + }, + "PWM模拟输出.mix": { + "__file__": true, + "__name__": "PWM模拟输出.mix" + }, + "SPIFFS读写数据测试.mix": { + "__file__": true, + "__name__": "SPIFFS读写数据测试.mix" + }, + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "WiFi事件.mix": { + "__file__": true, + "__name__": "WiFi事件.mix" + }, + "wifi控制小车.mix": { + "__file__": true, + "__name__": "wifi控制小车.mix" + }, + "中断控制.mix": { + "__file__": true, + "__name__": "中断控制.mix" + }, + "使用http发送POST请求.mix": { + "__file__": true, + "__name__": "使用http发送POST请求.mix" + }, + "定时器.mix": { + "__file__": true, + "__name__": "定时器.mix" + }, + "心知天气.mix": { + "__file__": true, + "__name__": "心知天气.mix" + }, + "旋转编码器读取数据.mix": { + "__file__": true, + "__name__": "旋转编码器读取数据.mix" + }, + "简明教程": { + "ESP32双核的简单使用.mix": { + "__file__": true, + "__name__": "ESP32双核的简单使用.mix" + }, + "ESPnow无线通讯简单案例.mix": { + "__file__": true, + "__name__": "ESPnow无线通讯简单案例.mix" + }, + "__file__": false, + "__name__": "简明教程" + }, + "触摸中断.mix": { + "__file__": true, + "__name__": "触摸中断.mix" + }, + "__file__": false, + "__name__": "ESP32 Dev Module" + }, + "ESP32C3 Dev Module": { + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "使用http发送POST请求.mix": { + "__file__": true, + "__name__": "使用http发送POST请求.mix" + }, + "心知天气.mix": { + "__file__": true, + "__name__": "心知天气.mix" + }, + "__file__": false, + "__name__": "ESP32C3 Dev Module" + }, + "ESP32S2 Dev Module": { + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "使用http发送POST请求.mix": { + "__file__": true, + "__name__": "使用http发送POST请求.mix" + }, + "心知天气.mix": { + "__file__": true, + "__name__": "心知天气.mix" + }, + "__file__": false, + "__name__": "ESP32S2 Dev Module" + }, + "ESP32S3 Dev Module": { + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "使用http发送POST请求.mix": { + "__file__": true, + "__name__": "使用http发送POST请求.mix" + }, + "心知天气.mix": { + "__file__": true, + "__name__": "心知天气.mix" + }, + "__file__": false, + "__name__": "ESP32S3 Dev Module" + } +} diff --git a/mixly/boards/default_src/arduino_esp32/origin/media/esp32_compressed.png b/mixly/boards/default_src/arduino_esp32/origin/media/esp32_compressed.png new file mode 100644 index 00000000..53159600 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp32/origin/media/esp32_compressed.png differ diff --git a/mixly/boards/default_src/arduino_esp32/origin/xml/esp32.xml b/mixly/boards/default_src/arduino_esp32/origin/xml/esp32.xml new file mode 100644 index 00000000..d28f222e --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/xml/esp32.xml @@ -0,0 +1,3578 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + + + + + + + + + + 0 + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + + + + + + + + + + + + + + + 1000000 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + 1 + + + + + 10 + + + + + 1 + + + + + + + + + + + 4096 + + + + + + + 1000 + + + + + + + 500 + + + + + + + + + 1 + + + 1000 + + + + + + + + 1000 + + + + + 1 + + + + + + 1 + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + item + + + + + ++ + + + item + + + + + + + + + + + + + + + 1 + + + + + 2 + + + + + + + 997 + + + millis + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + 1 + + + + + 1000 + + + + + + + + + + + + + + + + + + + + + hello + + + a + + + + + Hello + + + + + Mixly + + + + + + + A + + + + + B + + + + + C + + + + + + + 123 + + + + + + + Mixly + + + + + y + + + + + + + substring + + + + + 0 + + + + + 3 + + + + + + + 6.666 + + + + + 2 + + + + + + + String + + + + + + + String + + + + + s + + + + + Q + + + + + + + String + + + + + + + substring + + + + + substring + + + + + + + substring + + + + + + + 0xff0000 + + + + + + + 223 + + + + + a + + + + + 0 + + + + + + + hello + + + + + + + hello + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + mylist + + + + + int + mylist + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + mylist + + + + + 2 + + + + + 2 + + + + + {0,0},{0,0} + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + + + + + + + + + + + 9600 + + + + + + + Serial + println + + + + + 0 + + + + + + + + + + + a + + + + + + + + + + + + + + + + + 9600 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10000 + + + + + 3950 + + + + + 10000 + + + + + + + 0x5A + + + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + + + + + + + + + + + + + + + 120 + + + + + + + 1992 + + + + + + + 0x77 + + + + + + + 2 + + + + + 3 + + + + + + + + + 0 + + + + + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + 0 + + + + + 1 + + + + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + Jan/01/2020 + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + 12:34:56 + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + + + + + + + 0 + + + + + 2 + + + + + 4 + + + + + 5 + + + + + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + + + + + + + + + 0 + + + + + 2 + + + + + 4800 + + + + + WHILE + + + + + + + + + + + + + location + + + + + Serial + + + location.lat + + + + + Serial + + + location.lng + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + 16 + + + + + 17 + + + + + + + 1 + + + + + 100 + + + + + + + 100 + + + + + + + 0 + + + + + 0 + + + + + + + 1500 + + + + + + + + + + + + 17 + + + + + 0 + + + + + + + + 1000 + + + + + + + 17 + + + + + + + + + + 1 + + + + + 2 + + + + + 100 + + + + + 10 + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 100 + + + + + 10 + + + + + + + 10 + + + + + #ff0000 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 4 + + + + + 20 + + + + + + + 20 + + + + + + + 1 + + + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + 0 + + + + + 255 + + + + + 255 + + + + + + + + + 20 + + + + + 20 + + + + + + + 20 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 2 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 20 + + + + + Serial1 + + + 12 + + + + + 13 + + + + + 9600 + + + + + myPlayer + + + mySerial1 + + + Serial1 + + + + + + + + + 500 + + + + + + + 15 + + + + + + + myPlayer + + + 0 + + + DFPLAYER_EQ_NORMAL + + + + + myPlayer + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + + + 1 + + + + + + + myPlayer + readFileCounts + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + 1 + + + + + + + + + + clear + + + + + abcd + + + + + + + + + + 7 + + + + + + + + 2345 + + + + + 300 + + + + + + + 12 + + + + + 30 + + + + + + + + + + + + + 0x27 + + + + + 2 + 4 + 5 + 12 + 13 + 14 + + + + + + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + + + + mylcd + 0 + + + 1 + + + + + 1 + + + + + + + + clear + + + + + + + 0x3C + + + + + + + + + + + + + + SSD1306_128X64_NONAME + U8G2_R0 + 10 + 9 + 8 + + + + + + + + + + + + U8G2_R0 + + + + + + + + + 10 + + + + + + + + + + + + U8G2_R0 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + + + + + + + + + + + + + + + + + page1 + + + timR08_tr + + + + + 0 + + + + + 20 + + + + + 1234 + + + + + + + + + + bitmap + 96 + TRUE + + + 1 + 2 + 2 + STHeiti + 16 + hz_up + 0 + hz_left + 0 + 48 + 16 + TRUE + 米思齐 + + + + + + + 0 + + + + + 0 + + + + + 128 + + + + + 64 + + + + + bitmap1 + + + + + + + + 100 + + + + + + + 20 + + + + + 0 + + + + + + + + 0 + + + + + 20 + + + + + + + + 64 + + + + + 32 + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + 15 + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + + + + + 9 + + + + + + + + + 1 + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + Mixly + + + + + 300 + + + + + + + 0 + + + + + + + + + + + + + + 5 + + + + + + + + + + ir_item + + + 0 + + + + + Serial + println + HEX + + + ir_item + + + + + + + + + ESP32BT + + + + + Serial + + + 115200 + + + + + + + + + + + Serial + + + + + + + + + + + Serial + + + + + + + Serial + read + + + + + + + delay + + + 20 + + + + + + + + + + + + + + + + + item + + + + + + + + + + 1 + + + + + + + 1 + + + + + + + mylist + + + + + 1 + + + + + + + + 0 + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + hello world + + + + + TRUE + + + + + + + + + /fileName.txt + + + + + hello world + + + + + TRUE + + + + + + + /fileName.txt + + + + + + + /fileName.txt + + + + + + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + item + + + + + + + + + + + ssid + + + + + password + + + + + + + + + + + + + ntp1.aliyun.com + + + + + 8 + + + + + 600 + + + + + + + + 30:AE:A4:58:9D:7C + + + + + + + random + + + + + Mixly + + + + + 1 + + + + + 100 + + + + + + + + + Serial + + + Sent with success + + + + + + + Serial + + + Error sending the data + + + + + + + + + Serial + + + myData + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + {\"name\":\"Mixly\"} + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654n + + + + wifi-ssid + + + + + wifi-pass + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + + V0 + + + Serial + + + vpin_value + + + + + + + + + + V0 + + + 1000 + + + + + V0 + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + + 0 + + + + + + + + + #ff0000 + + + + + + + example@blynk.cc + + + + + Subject + + + + + Content + + + + + + + Notify + + + + + V0 + + + Serial + + + terminal_text + + + + + + + + + + + Hello,World! + + + + + V0 + + + Serial + + + hour + + + + + Serial + + + minute + + + + + Serial + + + second + + + + + + + + + + + + + V0 + + + 0 + + + + + 0 + + + + + 923 + + + + + + + + + http://yourvideostream.url + + + + + + + Test row + + + + + hello + + + + + V0 + + + Serial + + + index + + + + + Serial + + + selected + + + + + + + + + V0 + + + Serial + + + indexFrom + + + + + Serial + + + indexTo + + + + + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + BLYNK_CONNECTED + + + V0 + + + n2KlfPGDyjDBluNi1G9DG5OEjqDT996L + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + BLYNK_CONNECTED + + + + + 10 + + + + + + + + + V0 + + + action + String + + + + + + + + + + + EQ + + + action + + + + + play + + + + + + + play(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + stop + + + + + + + pause(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + next + + + + + + + next(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + prev + + + + + + + prev(); + + + 4 + + + + + 5 + + + + + + + + + + + V0 + + + Serial + + + lx + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + + + + + + V0 + + + + + wifi_ssid + + + + + wifi_pass + + + + + + + wifi_ssid + + + + + wifi_pass + + + + + + + + + + d3zp3AugUO0Y0wetEbHmHDk192q2LwzA + + + + + + + + + + 39.98.114.122 + + + + + 1883 + + + + + ID + + + + + siot + + + + + siot + + + + + + + 120 + + + + + Topic_0 + + + + + + + Serial + + + + + + + + + + + mixio.mixly.cn + + + + + 1883 + + + + + 12345678@qq.com + + + + + d86d2e60b813590963e2641b44945154 + + + + + test + + + + + + + + text + + + + + Serial + println + + + mqtt_data + + + + + + + + + Hello + + + + + text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/origin/xml/mpython.xml b/mixly/boards/default_src/arduino_esp32/origin/xml/mpython.xml new file mode 100644 index 00000000..1ac6f4c5 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/origin/xml/mpython.xml @@ -0,0 +1,3537 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 + + + + + + + + + + + + + + + 1000000 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + 1 + + + + + 10 + + + + + 1 + + + + + + + + + + + 4096 + + + + + + + 1000 + + + + + + + 500 + + + + + + + + + 1 + + + 1000 + + + + + + + + 1000 + + + + + 1 + + + + + + 1 + + + + + + + + + + + 1 + + + + + 1 + + + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + item + + + + + ++ + + + item + + + + + + + + + + + + + + + 1 + + + + + 2 + + + + + + + 997 + + + millis + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + 1 + + + + + 1000 + + + + + + + + + + + + + + + + + + + + + hello + + + a + + + + + Hello + + + + + Mixly + + + + + + + A + + + + + B + + + + + C + + + + + + + 123 + + + + + + + Mixly + + + + + y + + + + + + + substring + + + + + 0 + + + + + 3 + + + + + + + 6.666 + + + + + 2 + + + + + + + String + + + + + + + String + + + + + s + + + + + Q + + + + + + + String + + + + + + + substring + + + + + substring + + + + + + + substring + + + + + + + 223 + + + + + a + + + + + 0 + + + + + + + hello + + + + + + + hello + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + 1 + + + + + + + mylist + + + + + int + mylist + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + mylist + + + + + 2 + + + + + 2 + + + + + {0,0},{0,0} + + + + + + + mylist + + + + + 1 + + + + + 1 + + + + + 0 + + + + + + + mylist + + + + + 1 + + + + + 1 + + + + + + + + + + + + + + + 9600 + + + + + + + Serial + println + + + + + 0 + + + + + + + + + + + a + + + + + + + + + + + + + + + + + 9600 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #ff0000 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 1 + + + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + #ffff33 + + + + + + + + + #00cccc + + + + + + + 1 + + + + + 0 + + + + + 255 + + + + + 255 + + + + + + + 20 + + + + + + + + + 0 + + + + + + + + 1000 + + + + + + + + + + + + SH1106_128X64_NONAME + SCL + SDA + + + 0x3C + + + + + + + + + + + + + + + + + + + + + page1 + + + timR08_tr + + + + + 0 + + + + + 20 + + + + + 1234 + + + + + + + + + + + + + 100 + + + + + + + 20 + + + + + 0 + + + + + + + + 0 + + + + + 20 + + + + + + bitmap + 96 + TRUE + + + 1 + 2 + 2 + STHeiti + 16 + hz_up + 0 + hz_left + 0 + 48 + 16 + TRUE + 米思齐 + + + + + + + 0 + + + + + 0 + + + + + 128 + + + + + 64 + + + + + bitmap1 + + + + + + + 64 + + + + + 32 + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + 15 + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 120 + + + + + + + 1992 + + + + + + + + + + + 0x77 + + + + + + + + + + + + + + + 5 + + + + + 4 + + + + + 100 + + + + + + + 100 + + + + + + + + + + 0 + + + + + 0 + + + + + + + + + + 1500 + + + + + + + + + + + + 17 + + + + + 0 + + + + + + + + 1000 + + + + + + + 17 + + + + + + + + + + 1 + + + + + 2 + + + + + 100 + + + + + 10 + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 100 + + + + + 10 + + + + + + + 10 + + + + + #ff0000 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + + + + 4 + + + + + 20 + + + + + + + + + + 20 + + + + + + + + + + 1 + + + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + + + + + + 1 + + + + + 0 + + + + + 255 + + + + + 255 + + + + + + + + + + + + 20 + + + + + 20 + + + + + + + + + + 20 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 2 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 20 + + + + + + + + + + + + 20 + + + + + + + + 2345 + + + + + 300 + + + + + + + 12 + + + + + 30 + + + + + + + + + + + + + 0x27 + + + + + 2 + 4 + 5 + 12 + 13 + 14 + + + + + + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + + + + clear + + + + + + + 0x3C + + + + + + + + + + + + + + + + + + + + page1 + + + timR08_tr + + + + + 0 + + + + + 20 + + + + + 1234 + + + + + + + + + + + + + 100 + + + + + + + 20 + + + + + 0 + + + + + + + + 0 + + + + + 20 + + + + + + + + 0 + + + + + 0 + + + + + 128 + + + + + 64 + + + + + bitmap1 + + + + + + + 64 + + + + + 32 + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + 15 + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + + + + + 9 + + + + + + + + + 1 + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + Mixly + + + + + 300 + + + + + + + 0 + + + + + + + + + + + + + + 5 + + + + + + + + + + + + ESP32BT + + + + + Serial + + + 115200 + + + + + + + + + + + Serial + + + + + + + + + + + Serial + + + + + + + Serial + read + + + + + + + delay + + + 20 + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + 1 + + + + + + + 1 + + + + + + + mylist + + + + + 1 + + + + + + + + 33 + + + + + + + + + + + + + + + + + 32 + + + + + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + hello world + + + + + TRUE + + + + + + + + + + + myFile + + + + + /fileName.txt + + + + + + + myFile + + + + + + + myFile + + + + + hello + + + + + + + myFile + + + + + + + myFile + + + + + + + myFile + + + + + + + /fileName.txt + + + + + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + item + + + + + + + + + + + ssid + + + + + password + + + + + + + + + + + ntp1.aliyun.com + + + + + 8 + + + + + 600 + + + + + + + + 30:AE:A4:58:9D:7C + + + + + + + random + + + + + Mixly + + + + + 1 + + + + + 100 + + + + + + + + + Serial + + + Sent with success + + + + + + + Serial + + + Error sending the data + + + + + + + + + Serial + + + myData + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + {\"name\":\"Mixly\"} + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + WIFI-SSID + + + + + WIFI-PSK + + + + + 192.168.43.214 + + + + + 192.168.43.197 + + + + + 192.168.43.255 + + + + + 8080 + + + + + + + WIFI-STA-SSID + + + + + WIFI-STA-PSK + + + + + WIFI-AP-SSID + + + + + WIFI-AP-PSK + + + + + 192.168.4.2 + + + + + 192.168.4.3 + + + + + 192.168.4.255 + + + + + 8080 + + + + + + + COM + + + + + + + hello + + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654n + + + + < + < + < + < + < + < + < HEAD + + ======= + wifi-ssid + >>>>>>> 99dec2be3373b98e44a30ad45c21ce3ebf67bbc0 + + + + + < + < + < + < + < + < + < HEAD + d9efdd0413ec4b74ab0057a0b8675654n + + + + + wifi-ssid + + + + + wifi-pass + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + + V0 + + + Serial + + + vpin_value + + + + + + + + + + V0 + + + 1000 + + + + + V0 + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + 59d948d79fe642aab95c1577b1ad419d + + + + + Blynk + + + + + + + + V0 + + + Serial + + + vpin_value + + + + + + + + + + V0 + + + 1000 + + + + + V0 + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + + 0 + + + + + + + + + #ff0000 + + + + + + + example@blynk.cc + + + + + Subject + + + + + Content + + + + + + + Notify + + + + + V0 + + + Serial + + + terminal_text + + + + + + + + + + + Hello,World! + + + + + V0 + + + Serial + + + hour + + + + + Serial + + + minute + + + + + Serial + + + second + + + + + + + + + + + + + V0 + + + 0 + + + + + 0 + + + + + 923 + + + + + + + + + http://yourvideostream.url + + + + + + + Test row + + + + + hello + + + + + V0 + + + Serial + + + index + + + + + Serial + + + selected + + + + + + + + + V0 + + + Serial + + + indexFrom + + + + + Serial + + + indexTo + + + + + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + BLYNK_CONNECTED + + + V0 + + + n2KlfPGDyjDBluNi1G9DG5OEjqDT996L + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + BLYNK_CONNECTED + + + + + 10 + + + + + + + + + V0 + + + action + String + + + + + + + + + + + EQ + + + action + + + + + play + + + + + + + play(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + stop + + + + + + + pause(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + next + + + + + + + next(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + prev + + + + + + + prev(); + + + 4 + + + + + 5 + + + + + + + + + + + V0 + + + Serial + + + lx + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + + + + + + V0 + + + + + + + 39.98.114.122 + + + + + 1883 + + + + + ID + + + + + siot + + + + + siot + + + + + + + 120 + + + + + Topic_0 + + + + + + + Topic + + + + + Serial + + + + + Topic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/package.json b/mixly/boards/default_src/arduino_esp32/package.json new file mode 100644 index 00000000..6446fc53 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/package.json @@ -0,0 +1,33 @@ +{ + "name": "@mixly/arduino-esp32", + "version": "1.4.0", + "description": "适用于mixly的arduino esp32模块", + "scripts": { + "serve": "webpack-dev-server --config=webpack.dev.js", + "build:dev": "webpack --config=webpack.dev.js", + "build:prod": "npm run build:examples & webpack --config=webpack.prod.js", + "build:examples": "node ../../../scripts/build-examples.js -t special", + "build:examples:ob": "node ../../../scripts/build-examples.js -t special --obfuscate", + "publish:board": "npm publish --registry https://registry.npmjs.org/" + }, + "main": "./export.js", + "author": "Mixly Team", + "keywords": [ + "mixly", + "mixly-plugin", + "arduino-esp32" + ], + "homepage": "https://gitee.com/bnu_mixly/mixly3/tree/master/boards/default_src/arduino_esp32", + "bugs": { + "url": "https://gitee.com/bnu_mixly/mixly3/issues" + }, + "repository": { + "type": "git", + "url": "https://gitee.com/bnu_mixly/mixly3.git", + "directory": "default_src/arduino_esp32" + }, + "publishConfig": { + "access": "public" + }, + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/pins/pins.js b/mixly/boards/default_src/arduino_esp32/pins/pins.js new file mode 100644 index 00000000..c89e9a99 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/pins/pins.js @@ -0,0 +1,310 @@ +import { Profile } from 'mixly'; + +const pins = {}; + +pins.arduino_esp32 = { + description: "esp32_Arduino", + digital: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + digitalWrite: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"]], + interrupt: [["0", "0"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + pwm: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"]], + analog: [["0", "0"], ["2", "2"], ["4", "4"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + tx: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["31", "31"]], + dac: [["25", "25"], ["26", "26"]], + SDA: [["21", "21"]], + SCL: [["22", "22"]], + MOSI: [["23", "23"]], + MISO: [["19", "19"]], + SCK: [["18", "18"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + touch: [["0", "0"], ["2", "2"], ["4", "4"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["27", "27"], ["32", "32"], ["33", "33"]], + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.arduino_esp32s2 = { + description: "esp32s2_Arduino", + digital: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"], ["46", "46"]], + digitalWrite: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"]], + interrupt: [["0", "0"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + pwm: [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["24", "24"], ["25", "25"], ["26", "26"], ["27", "27"], ["28", "28"], ["29", "29"], ["30", "30"], ["31", "31"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["37", "37"], ["38", "38"], ["39", "39"], ["40", "40"], ["41", "41"], ["42", "42"], ["43", "43"], ["44", "44"], ["45", "45"]], + analog: [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + tx: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["31", "31"]], + dac: [["17", "17"], ["18", "18"]], + SDA: [["8", "8"]], + SCL: [["9", "9"]], + MOSI: [["41", "41"]], + MISO: [["40", "40"]], + SCK: [["39", "39"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + touch: [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"]], + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.esp32_handbit = { + description: "esp32_handbit", + digital: [["P0", "33"], ["P1", "32"], ["P2", "35"], ["P3", "34"], ["P4", "39"], ["P5", "0"], ["P6", "16"], ["P7", "17"], ["P8", "26"], ["P9", "25"], ["P10", "36"], ["P11", "2"], ["P13", "18"], ["P14", "19"], ["P15", "21"], ["P16", "5"], ["P19", "22"], ["P20", "23"]], + digitalWrite: [["P0", "33"], ["P1", "32"], ["P2", "35"], ["P3", "34"], ["P4", "39"], ["P5", "0"], ["P6", "16"], ["P7", "17"], ["P8", "26"], ["P9", "25"], ["P10", "36"], ["P11", "2"], ["P13", "18"], ["P14", "19"], ["P15", "21"], ["P16", "5"], ["P19", "22"], ["P20", "23"]], + interrupt: [["P0", "33"], ["P1", "32"], ["P2", "35"], ["P3", "34"], ["P4", "39"], ["P5", "0"], ["P6", "16"], ["P7", "17"], ["P8", "26"], ["P9", "25"], ["P10", "36"], ["P11", "2"], ["P13", "18"], ["P14", "19"], ["P15", "21"], ["P16", "5"], ["P19", "22"], ["P20", "23"]], + pwm: [["P0", "33"], ["P1", "32"], ["P8", "26"], ["P9", "25"], ["P13", "18"], ["P14", "19"], ["P15", "21"], ["P16", "5"]], + analog: [["P11", "2"], ["P28", "4"], ["P25", "12"], ["P26", "13"], ["P24", "14"], ["P27", "15"], ["P6", "16"], ["P9", "25"], ["P8", "26"], ["P23", "27"], ["P1", "32"], ["P0", "33"], ["P3", "34"], ["P2", "35"],], + tx: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["P23", "27"], ["31", "31"]], + dac: [["P9", "25"], ["P8", "26"]], + SDA: [["P20", "23"]], + SCL: [["P19", "22"]], + MOSI: [["P20", "23"]], + MISO: [["P14", "19"]], + SCK: [["P13", "18"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + touch: [["P", "27"], ["Y", "14"], ["T", "12"], ["H", "13"], ["O", "15"], ["N", "4"]], + button: [["A", "0"], ["B", "2"]], + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.esp32_MixGo = { + description: "esp32_MixGo", + digital: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"]], + digitalWrite: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"]], + interrupt: [["0", "0"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + pwm: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"]], + analog: [["0", "0"], ["2", "2"], ["4", "4"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["25", "25"], ["26", "26"], ["27", "27"], ["32", "32"], ["33", "33"], ["34", "34"], ["35", "35"], ["36", "36"], ["39", "39"]], + tx: [["0", "0"], ["2", "2"], ["4", "4"], ["5", "5"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"], ["21", "21"], ["22", "22"], ["23", "23"], ["25", "25"], ["26", "26"], ["27", "27"], ["31", "31"]], + dac: [["25", "25"], ["26", "26"]], + SDA: [["21", "21"]], + SCL: [["22", "22"]], + MOSI: [["23", "23"]], + MISO: [["19", "19"]], + SCK: [["18", "18"]], + button: [["A", "17"], ["B", "16"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + touch: [["1", "32"], ["2", "33"], ["3", "25"], ["4", "26"]], + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.PocketCard = { + description: "PocketCard", + digital: [["P0", "26"], ["P1", "33"], ["P2", "32"], ["P3", "35"], ["P4", "4"], ["P5", "14"], ["P6", "16"], ["P7", "17"], ["P8", "27"], ["P9", "13"], ["P10", "2"], ["P11", "25"], ["P12", "15"], ["P13", "18"], ["P14", "19"], ["P15", "23"], ["P16", "5"], ["P19", "22"], ["P20", "21"]], + digitalWrite: [["P0", "26"], ["P1", "33"], ["P2", "32"], ["P4", "4"], ["P5", "14"], ["P6", "16"], ["P7", "17"], ["P8", "27"], ["P9", "13"], ["P10", "2"], ["P11", "25"], ["P12", "15"], ["P13", "18"], ["P14", "19"], ["P15", "23"], ["P16", "5"], ["P19", "22"], ["P20", "21"]], + interrupt: [["P0", "26"], ["P1", "33"], ["P2", "32"], ["P4", "4"], ["P5", "14"], ["P6", "16"], ["P7", "17"], ["P8", "27"], ["P9", "13"], ["P10", "2"], ["P11", "25"], ["P12", "15"], ["P13", "18"], ["P14", "19"], ["P15", "23"], ["P16", "5"], ["P19", "22"], ["P20", "21"]], + pwm: [["P0", "26"], ["P1", "33"], ["P2", "32"], ["P4", "4"], ["P5", "14"], ["P6", "16"], ["P7", "17"], ["P8", "27"], ["P9", "13"], ["P10", "2"], ["P11", "25"], ["P12", "15"], ["P13", "18"], ["P14", "19"], ["P15", "23"], ["P16", "5"], ["P19", "22"], ["P20", "21"]], + analog: [["P0", "26"], ["P1", "33"], ["P2", "32"], ["P3", "35"], ["P4", "4"], ["P5", "14"], ["P8", "27"], ["P9", "13"], ["P10", "2"], ["P11", "25"], ["P12", "15"]], + tx: [["P0", "26"], ["P10", "2"], ["P4", "4"], ["P16", "5"], ["P9", "13"], ["P5", "14"], ["P12", "15"], ["P6", "16"], ["P7", "17"], ["P13", "18"], ["P14", "19"], ["P20", "21"], ["P19", "22"], ["P15", "23"], ["P11", "25"], ["P8", "27"]], + dac: [["P11", "25"], ["P0", "26"]], + SDA: [["P20", "21"]], + SCL: [["P19", "22"]], + MOSI: [["P15", "23"]], + MISO: [["P14", "19"]], + SCK: [["P13", "18"]], + button: [["A", "14"], ["B", "25"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["P10", "2"], ["3", "3"], ["P4", "4"], ["P16", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["P9", "13"], ["P5", "14"], ["P12", "15"], ["P6", "16"], ["P7", "17"], ["P13", "18"], ["P14", "19"]], + touch: [["P0", "26"], ["P1", "33"], ["P2", "32"]], + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial: 9600 +}; + +pins.m5stick_c = { + description: "M5Stick-C", + digital: [["G0", "G0"], ["G9", "G9"], ["G10", "G10"], ["G26", "G26"], ["G32", "G32"], ["G33", "G33"], ["G36", "G36"], ["G37", "G37"], ["G39", "G39"]], + digitalWrite: [["G0", "G0"], ["G9", "G9"], ["G10", "G10"], ["G26", "G26"], ["G32", "G32"], ["G33", "G33"], ["G36", "G36"], ["G37", "G37"], ["G39", "G39"]], + analog: [["G0", "G0"], ["G26", "G26"], ["G32", "G32"]], + pwm: [["G0", "G0"], ["G26", "G26"], ["G32", "G32"]], + interrupt: [["G0", "G0"], ["G9", "G9"], ["G10", "G10"], ["G26", "G26"], ["G32", "G32"], ["G33", "G33"], ["G36", "G36"], ["G37", "G37"], ["G39", "G39"]], + tx: [["G0", "G0"], ["G26", "G26"]], + dac: [["DAC1", "DAC1"], ["DAC2", "DAC2"]], + SDA: [["SDA", "SDA"]], + SCL: [["SCL", "SCL"]], + MOSI: [["MOSI", "MOSI"]], + MISO: [["MISO", "MISO"]], + SCK: [["SCK", "SCK"]], + TONE_NOTE: [["NOTE_C", "NOTE_C"], ["NOTE_Cs", "NOTE_Cs"], ["NOTE_D", "NOTE_D"], ["NOTE_Eb", "NOTE_Eb"], ["NOTE_E", "NOTE_E"], ["NOTE_F", "NOTE_F"], ["NOTE_Fs", "NOTE_Fs"], ["NOTE_G", "NOTE_G"], ["NOTE_Gs", "NOTE_Gs"], ["NOTE_A", "NOTE_A"], ["NOTE_Bb", "NOTE_Bb"], ["NOTE_B", "NOTE_B"], ["NOTE_MAX", "NOTE_MAX"]], + OCTAVE: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"]], + CHANNEL: [["0", "0"], ["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"], ["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"]], + PWM_RESOLUTION: [["8", "8"], ["9", "9"], ["10", "10"], ["11", "11"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["16", "16"], ["17", "17"], ["18", "18"], ["19", "19"], ["20", "20"]], + touch: [["G0", "G0"], ["G32", "G32"], ["G33", "G33"]], + serial_select: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial: 9600 +}; + +pins.arduino_esp32c3 = { + description: "esp32c3_Arduino", + digital: Profile.generate([ '0-11', '18-21' ]), + digitalWrite: Profile.generate([ '0-11', '18-21' ]), + interrupt: Profile.generate([ '0-11', '18-21' ]), + pwm: Profile.generate([ '0-10', '18-21' ]), + analog: Profile.generate([ '0-5' ]), + tx: Profile.generate([ '21' ]), + dac: [["25", "25"], ["26", "26"]], + SDA: [["8","8"]], + SCL: [["9","9"]], + MOSI: [["6","6"]], + MISO: [["5","5"]], + SCK: [["4","4"]], + TONE_NOTE: [["NOTE_C","NOTE_C"],["NOTE_Cs","NOTE_Cs"],["NOTE_D","NOTE_D"],["NOTE_Eb","NOTE_Eb"],["NOTE_E","NOTE_E"],["NOTE_F","NOTE_F"],["NOTE_Fs","NOTE_Fs"],["NOTE_G","NOTE_G"],["NOTE_Gs","NOTE_Gs"],["NOTE_A","NOTE_A"],["NOTE_Bb","NOTE_Bb"],["NOTE_B","NOTE_B"],["NOTE_MAX","NOTE_MAX"]], + OCTAVE: Profile.generate([ '0-7' ]), + CHANNEL: Profile.generate([ '0-15' ]), + touch: [["0", "0"], ["2", "2"], ["4", "4"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["27", "27"], ["32", "32"], ["33", "33"]], + PWM_RESOLUTION: Profile.generate([ '8-20' ]), + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial : 9600 +}; + +pins.arduino_core_esp32c3 = { + description: "core_esp32c3_Arduino", + digital: Profile.generate([ '0-13', '18-21' ]), + digitalWrite: Profile.generate([ '0-8', '10-13', '18-21' ]), + interrupt: Profile.generate([ '0-13', '18-21' ]), + pwm: Profile.generate([ '2', '6', '8', '10' ]), + analog: Profile.generate([ '0-5' ]), + tx: Profile.generate([ '21' ]), + dac: [["25", "25"], ["26", "26"]], + SDA: [["8","8"]], + SCL: [["9","9"]], + MOSI: [["6","6"]], + MISO: [["5","5"]], + SCK: [["4","4"]], + TONE_NOTE: [["NOTE_C","NOTE_C"],["NOTE_Cs","NOTE_Cs"],["NOTE_D","NOTE_D"],["NOTE_Eb","NOTE_Eb"],["NOTE_E","NOTE_E"],["NOTE_F","NOTE_F"],["NOTE_Fs","NOTE_Fs"],["NOTE_G","NOTE_G"],["NOTE_Gs","NOTE_Gs"],["NOTE_A","NOTE_A"],["NOTE_Bb","NOTE_Bb"],["NOTE_B","NOTE_B"],["NOTE_MAX","NOTE_MAX"]], + OCTAVE: Profile.generate([ '0-7' ]), + CHANNEL: Profile.generate([ '0-15' ]), + touch: [["0", "0"], ["2", "2"], ["4", "4"], ["12", "12"], ["13", "13"], ["14", "14"], ["15", "15"], ["27", "27"], ["32", "32"], ["33", "33"]], + PWM_RESOLUTION: Profile.generate([ '8-20' ]), + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial : 9600 +}; + +pins.arduino_esp32s3 = { + description: "esp32s3_Arduino", + digital: Profile.generate([ '0-21', '26-48' ]), + digitalWrite: Profile.generate([ '0-21', '26-48' ]), + interrupt: Profile.generate([ '0-21', '26-48' ]), + pwm: Profile.generate([ '0-21', '26-46' ]), + analog: Profile.generate([ '1-20' ]), + tx: Profile.generate([ '0-21', '26-48' ]), + dac: [["25", "25"], ["26", "26"]], + SDA:[["8","8"]], + SCL:[["9","9"]], + MOSI:[["11","11"]], + MISO:[["13","13"]], + SCK:[["12","12"]], + TONE_NOTE:[["NOTE_C","NOTE_C"],["NOTE_Cs","NOTE_Cs"],["NOTE_D","NOTE_D"],["NOTE_Eb","NOTE_Eb"],["NOTE_E","NOTE_E"],["NOTE_F","NOTE_F"],["NOTE_Fs","NOTE_Fs"],["NOTE_G","NOTE_G"],["NOTE_Gs","NOTE_Gs"],["NOTE_A","NOTE_A"],["NOTE_Bb","NOTE_Bb"],["NOTE_B","NOTE_B"],["NOTE_MAX","NOTE_MAX"]], + OCTAVE: Profile.generate([ '0-7' ]), + CHANNEL: Profile.generate([ '0-15' ]), + PWM_RESOLUTION: Profile.generate([ '8-20' ]), + touch: Profile.generate([ '1-14' ]), + serial_HardwareSelect: [["Serial", "Serial"], ["Serial1", "Serial1"], ["Serial2", "Serial2"]], + serial_select: [["Serial", "Serial"], ["SoftwareSerial", "mySerial"], ["SoftwareSerial1", "mySerial1"], ["SoftwareSerial2", "mySerial2"], ["SoftwareSerial3", "mySerial3"]], + serial : 9600 +}; + +pins['Arduino ESP32'] = +pins['Arduino ESP32 Generic'] = +pins['"WeMos" WiFi&Bluetooth Battery'] = +pins["ESP32 Dev Module"] = +pins["ESP32 Wrover Module"] = +pins["ESP32 Pico Kit"] = +pins["Turta IoT Node"] = +pins["TTGO LoRa32-OLED V1"] = +pins["XinaBox CW02"] = +pins["SparkFun ESP32 Thing"] = +pins["u-blox NINA-W10 series (ESP32)"] = +pins["Widora AIR"] = +pins["Electronic SweetPeas - ESP320"] = +pins["Nano32"] = +pins["LOLIN D32"] = +pins["LOLIN D32 PRO"] = +pins["WEMOS LOLIN32"] = +pins["Dongsen Tech Pocket 32"] = +pins["ESPea32"] = +pins["Noduino Quantum"] = +pins["Node32s"] = +pins["Hornbill ESP32 Dev"] = +pins["Hornbill ESP32 Minima"] = +pins["FireBeetle-ESP32"] = +pins["IntoRobot Fig"] = +pins["Onehorse ESP32 Dev Module"] = +pins["Adafruit ESP32 Feather"] = +pins["NodeMCU-32S"] = +pins["MH ET LIVE ESP32DevKIT"] = +pins["MH ET LIVE ESP32MiniKit"] = +pins["ESP32vn IoT Uno"] = +pins["ESP32 Dev Module"] = +pins["DOIT ESP32 DEVKIT V1"] = +pins["OLIMEX ESP32-EVB"] = +pins["OLIMEX ESP32-GATEWAY"] = +pins["OLIMEX ESP32-PoE"] = +pins["ThaiEasyElec's ESPino32"] = +pins["ODROID ESP32"] = +pins["Heltec_WIFI_Kit_32"] = +pins["Heltec_WIFI_LoRa_32"] = +pins["ESPectro32"] = +pins["Microduino-CoreESP32"] = +pins["ALKS ESP32"] = +pins["WiPy 3.0"] = +pins["BPI-BIT"] = +pins["Silicognition wESP32"] = +pins["T-Beam"] = +pins["D-duino-32"] = +pins["LoPy"] = +pins["LoPy4"] = +pins["OROCA EduBot"] = +pins["OROCA EduBot"] = +pins["ESP32 FM DevKit"] = +pins['MixGo CE'] = +pins['MixGo Car'] = +pins['AI Thinker ESP32-CAM'] = +pins["arduino_esp32"]; + +pins["M5Stick-C"] = +pins["M5Stack-CORE"] = +pins["M5Stack-FIRE"] = +pins["m5stick_c"]; + +pins['Arduino HandBit'] = +pins['mPython'] = +pins['Labplus mPython'] = +pins["esp32_handbit"]; + +pins['Arduino MixGo'] = +pins["esp32_MixGo"]; + +/* Arduino ESP32S2用管脚定义 */ +pins['Generic ESP32S2 Module'] = +pins['ESP32S2 Dev Module'] = +pins["arduino_esp32s2"]; + +/* Arduino ESP32C3用管脚定义 */ +pins['ESP32C3 Dev Module'] = +pins["arduino_esp32c3"]; + +pins['CORE-ESP32-C3'] = +pins["arduino_core_esp32c3"]; + +/* Arduino ESP32S3用管脚定义 */ +pins['ESP32S3 Dev Module'] = +pins['arduino_esp32s3']; + +export default pins; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/template.xml b/mixly/boards/default_src/arduino_esp32/template.xml new file mode 100644 index 00000000..957bd684 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/template.xml @@ -0,0 +1,3 @@ +<%= htmlWebpackPlugin.tags.headTags.join('\n') %> + + \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/template/board-config-message.html b/mixly/boards/default_src/arduino_esp32/template/board-config-message.html new file mode 100644 index 00000000..a25b1e5b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/template/board-config-message.html @@ -0,0 +1,19 @@ +
+
{{-d.title}}
+
+ {{# if (d.message) { }} +

+ {{-d.message}} +

+ {{# } }} + {{# if (d.href === '#') { }} +

{{d.moreInfo}}: {{-d.name}}

+ {{# } else { }} +

{{d.moreInfo}}: {{-d.name}}

+ {{# } }} +
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/webpack.common.js b/mixly/boards/default_src/arduino_esp32/webpack.common.js new file mode 100644 index 00000000..6a94c4dc --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/webpack.common.js @@ -0,0 +1,21 @@ +const path = require('path'); +const common = require('../../../webpack.common'); +const { merge } = require('webpack-merge'); + +module.exports = merge(common, { + resolve: { + alias: { + '@mixly/arduino': path.resolve(__dirname, '../arduino'), + '@mixly/arduino-avr': path.resolve(__dirname, '../arduino_avr'), + '@mixly/arduino-esp8266': path.resolve(__dirname, '../arduino_esp8266') + } + }, + module: { + rules: [ + { + test: /\.(txt|c|cpp|h|hpp)$/, + type: 'asset/source' + } + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/webpack.dev.js b/mixly/boards/default_src/arduino_esp32/webpack.dev.js new file mode 100644 index 00000000..31d3a078 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/webpack.dev.js @@ -0,0 +1,36 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ESLintPlugin = require('eslint-webpack-plugin'); + +module.exports = merge(common, { + mode: 'development', + devtool: 'source-map', + plugins: [ + new ESLintPlugin({ + context: process.cwd(), + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: false + }) + ], + devServer: { + https: true, + port: 8080, + host: '0.0.0.0', + hot: false, + static: { + directory: path.join(process.cwd(), '../../../'), + watch: false + }, + devMiddleware: { + index: false, + publicPath: `/boards/default/${path.basename(process.cwd())}`, + writeToDisk: true + } + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp32/webpack.prod.js b/mixly/boards/default_src/arduino_esp32/webpack.prod.js new file mode 100644 index 00000000..331b45f4 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp32/webpack.prod.js @@ -0,0 +1,27 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const TerserPlugin = require('terser-webpack-plugin'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = merge(common, { + mode: 'production', + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + extractComments: false, + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: { + removeAttributeQuotes: true, + collapseWhitespace: true, + removeComments: true, + } + }) + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/.npmignore b/mixly/boards/default_src/arduino_esp8266/.npmignore new file mode 100644 index 00000000..21ab2a3e --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/.npmignore @@ -0,0 +1,3 @@ +node_modules +build +origin \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/blocks/ethernet.js b/mixly/boards/default_src/arduino_esp8266/blocks/ethernet.js new file mode 100644 index 00000000..8bae0662 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/blocks/ethernet.js @@ -0,0 +1,41 @@ +import * as Blockly from 'blockly/core'; + +const ETHERNET_HUE = 0; + +//esp_now +export const esp_now_send = { + init: function () { + this.appendDummyInput() + .appendField("ESP NOW" + Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND); + this.appendValueInput("mac") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_ETHERNET_MAC_ADDRESS); + this.appendValueInput("data") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_SD_DATA); + this.appendStatementInput("success") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND + Blockly.Msg.MIXLY_SUCCESS); + this.appendStatementInput("failure") + .setCheck(null) + .appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND + Blockly.Msg.MIXLY_FAILED); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl("https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/"); + } +}; + +//esp_now +export const esp_now_receive = { + init: function () { + this.appendDummyInput() + .appendField("ESP NOW" + Blockly.Msg.MQTT_subscribe2 + Blockly.Msg.MIXLY_SD_DATA); + this.appendStatementInput("receive_data") + .setCheck(null); + this.setColour(ETHERNET_HUE); + this.setTooltip(""); + this.setHelpUrl("https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/"); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/blocks/pinout.js b/mixly/boards/default_src/arduino_esp8266/blocks/pinout.js new file mode 100644 index 00000000..dd562859 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/blocks/pinout.js @@ -0,0 +1,23 @@ +import * as Blockly from 'blockly/core'; + +const PINOUT_HUE = '#555555'; + +export const esp8266_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/NodeMCU.png'), 510, 346, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; + +export const wemos_d1_mini_pin = { + init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldImage(require('../media/boards/WeMosD1Mini.png'), 510, 264, '*')); + this.setColour(PINOUT_HUE); + this.setTooltip(); + this.setHelpUrl(); + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/css/color.css b/mixly/boards/default_src/arduino_esp8266/css/color.css new file mode 100644 index 00000000..531351af --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/css/color.css @@ -0,0 +1,355 @@ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/inout2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/ctrl2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/math2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/logic2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(5)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/text2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(6)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/list2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(7)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/var2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(8)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/func2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(9)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/port2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(10)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/sensor2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/motor.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/motor2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/voice.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/voice2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/light.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(11)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/light2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/4Digitdisplay2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/lcd2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/oled2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第五个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(5)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第五个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(12)>div:nth-child(2)>div:nth-child(5)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/Matrix2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div.blocklyTreeRow>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div.blocklyTreeRow.blocklyTreeSelected>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第1个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第1个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第2个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第2个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第3个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第3个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第4个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第4个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(13)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/comuni2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div.blocklyTreeRow.blocklyTreeSelected>span.blocklyTreeIcon.blocklyTreeIconNone { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第一个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(14)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/store2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/WIFI.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(1)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/WIFI2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第二个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(2)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/blynk2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/iot.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第三个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(3)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/iot2.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(未选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/weather.png') no-repeat; + background-size: 100% auto; +} + +/*子模块的第四个图标(选中时)*/ +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(15)>div:nth-child(2)>div:nth-child(4)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/weather2.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(17)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory3.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(17)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/factory4.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool.png') no-repeat; + background-size: 100% auto; +} + +div.blocklyToolboxDiv>div.blocklyToolboxContents>div:nth-child(18)>div.blocklyTreeRow.blocklyTreeSelected>div.blocklyTreeRowContentContainer>span.blocklyTreeIcon { + background: url('../../../../common/media/mark/tool2.png') no-repeat; + background-size: 100% auto; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/export.js b/mixly/boards/default_src/arduino_esp8266/export.js new file mode 100644 index 00000000..92823021 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/export.js @@ -0,0 +1,22 @@ +import ArduinoESP8266Pins from './pins/pins'; +import * as ArduinoESP8266EthernetBlocks from './blocks/ethernet'; +import * as ArduinoESP8266PinoutBlocks from './blocks/pinout'; +import * as ArduinoESP8266EthernetGenerators from './generators/ethernet'; +import * as ArduinoESP8266PinoutGenerators from './generators/pinout'; +import * as ArduinoESP8266SensorGenerators from './generators/sensor'; + +import ArduinoESP8266ZhHans from './language/zh-hans'; +import ArduinoESP8266ZhHant from './language/zh-hant'; +import ArduinoESP8266En from './language/en'; + +export { + ArduinoESP8266Pins, + ArduinoESP8266EthernetBlocks, + ArduinoESP8266PinoutBlocks, + ArduinoESP8266EthernetGenerators, + ArduinoESP8266PinoutGenerators, + ArduinoESP8266SensorGenerators, + ArduinoESP8266ZhHans, + ArduinoESP8266ZhHant, + ArduinoESP8266En +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/generators/esp8266.js b/mixly/boards/default_src/arduino_esp8266/generators/esp8266.js new file mode 100644 index 00000000..a84f1bcf --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/generators/esp8266.js @@ -0,0 +1,112 @@ +// LM35 Temperature +export const LM35 = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var code = 'analogRead(' + dropdown_pin + ')*0.322'; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_write_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var funcName = 'eepromWriteLong'; + var code2 = 'void ' + funcName + '(int address, unsigned long value) {\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.ULtime=value;\n' + + ' EEPROM.write(address, time.b[0]);\n' + + ' EEPROM.write(address+1, time.b[1]);\n' + + ' if (time.b[2] != EEPROM.read(address+2) ) EEPROM.write(address+2, time.b[2]);\n' + + ' if (time.b[3] != EEPROM.read(address+3) ) EEPROM.write(address+3, time.b[3]);\n' + + ' EEPROM.commit();\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return 'eepromWriteLong(' + address + ', ' + data + ');\n'; +} + +export const store_eeprom_read_long = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var code = 'eepromReadLong(' + address + ')'; + var funcName = 'eepromReadLong'; + var code2 = 'unsigned long ' + funcName + '(int address) {\n' + + ' union u_tag {\n' + + ' byte b[4];\n' + + ' unsigned long ULtime;\n' + + ' }\n' + + ' time;\n' + + ' time.b[0] = EEPROM.read(address);\n' + + ' time.b[1] = EEPROM.read(address+1);\n' + + ' time.b[2] = EEPROM.read(address+2);\n' + + ' time.b[3] = EEPROM.read(address+3);\n' + + ' return time.ULtime;\n' + + '}\n'; + generator.definitions_[funcName] = code2; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_write_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + return 'EEPROM.write(' + address + ', ' + data + ');\nEEPROM.commit();\n'; +} + +export const controls_attachInterrupt = function (_, generator) { + var dropdown_pin = generator.valueToCode(this, 'PIN', generator.ORDER_ATOMIC); + var dropdown_mode = this.getFieldValue('mode'); + generator.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT_PULLUP);'; + //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString(); + var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')'; + var code = 'attachInterrupt' + '(' + interrupt_pin + ',' + 'attachInterrupt_fun_' + dropdown_pin + ',' + dropdown_mode + ');\n' + var funcName = 'attachInterrupt_fun_' + dropdown_pin; + var branch = generator.statementToCode(this, 'DO'); + var code2 = 'ICACHE_RAM_ATTR void' + ' ' + funcName + '() {\n' + branch + '}\n'; + generator.definitions_[funcName] = code2; + return code; +} + +export const store_eeprom_read_byte = function (_, generator) { + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + generator.setups_['setup_EEPROM.begin'] = 'EEPROM.begin(512);'; + var code = 'EEPROM.read(' + address + ')'; + return [code, generator.ORDER_ATOMIC]; +} + +export const store_eeprom_put = function (_, generator) { + generator.setups_['setup_EEPROM_begin'] = 'EEPROM.begin(4000);'; + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.put(' + address + ', ' + data + ');\nEEPROM.commit();'; +} + +export const store_eeprom_get = function (_, generator) { + generator.setups_['setup_EEPROM_begin'] = 'EEPROM.begin(4000);'; + var address = generator.valueToCode(this, 'ADDRESS', generator.ORDER_ATOMIC) || '0'; + var data = generator.valueToCode(this, 'DATA', generator.ORDER_ATOMIC) || '0'; + generator.definitions_['include_EEPROM'] = '#include '; + return 'EEPROM.get(' + address + ', ' + data + ');\n'; +} + +export const controls_soft_reset = function () { + return ' ESP.restart();\n'; +} + +export const servo_move = function (_, generator) { + var dropdown_pin = this.getFieldValue('PIN'); + var value_degree = generator.valueToCode(this, 'DEGREE', generator.ORDER_ATOMIC); + var delay_time = generator.valueToCode(this, 'DELAY_TIME', generator.ORDER_ATOMIC) || '0' + generator.definitions_['include_Servo'] = '#include '; + generator.definitions_['var_declare_servo' + dropdown_pin] = 'Servo servo_' + dropdown_pin + ';'; + generator.setups_['setup_servo_' + dropdown_pin] = 'servo_' + dropdown_pin + '.attach(' + dropdown_pin + ',500,2500);'; + var code = 'servo_' + dropdown_pin + '.write(' + value_degree + ');\n' + 'delay(' + delay_time + ');\n'; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/generators/ethernet.js b/mixly/boards/default_src/arduino_esp8266/generators/ethernet.js new file mode 100644 index 00000000..e8eaab4e --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/generators/ethernet.js @@ -0,0 +1,82 @@ +// esp_now发送数据 +export const esp_now_send = function (_, generator) { + var mac = generator.valueToCode(this, 'mac', generator.ORDER_ATOMIC); + var data = generator.valueToCode(this, 'data', generator.ORDER_ATOMIC); + var branch = generator.statementToCode(this, 'success'); + //branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + var branch1 = generator.statementToCode(this, 'failure'); + //branch1 = branch1.replace(/(^\s*)|(\s*$)/g, ""); + mac = mac.replaceAll('"', ''); + mac = mac.toUpperCase(); + const macList = mac.split(':'); + mac = macList.join(', 0x'); + mac = '0x' + mac; + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_WifiEspNow'] = '#include '; + const macName = macList.join(''); + generator.definitions_['var_declare_PEER_' + macName] = 'uint8_t PEER_' + macName + '[] = {' + mac + '};\n'; + generator.definitions_['function_sendMessage'] = 'bool sendMessage(uint8_t *macAddress, String _data) {\n' + + ' bool ok = WifiEspNow.addPeer(macAddress);\n' + + ' if (!ok) return false;\n' + + ' uint16_t length = _data.length();\n' + + ' char _msg[length];\n' + + ' strcpy(_msg, _data.c_str());\n' + + ' return WifiEspNow.send(macAddress, reinterpret_cast(_msg), length);\n' + + '}\n'; + generator.setups_['setup_esp_now'] = ` + WiFi.persistent(false); + WiFi.mode(WIFI_AP); + WiFi.disconnect(); + WiFi.softAP("ESPNOW", nullptr, 3); + WiFi.softAPdisconnect(false); + + Serial.print("当前设备MAC:"); + Serial.println(WiFi.softAPmacAddress()); + + bool ok = WifiEspNow.begin(); + if (!ok) { + Serial.println("WifiEspNow初始化失败"); + ESP.restart(); + }`; + var code = `if (sendMessage(PEER_${macName}, ${data})) {\n` + + branch + + '} else {\n' + + branch1 + + '}\n'; + return code; +} + +// esp_now接收数据 +export const esp_now_receive = function (_, generator) { + var branch = generator.statementToCode(this, 'receive_data'); + branch = branch.replace(/(^\s*)|(\s*$)/g, ""); + generator.definitions_['include_ESP8266WiFi'] = '#include '; + generator.definitions_['include_WifiEspNow'] = '#include '; + generator.definitions_['function_onMessageRecv'] = 'void OnMessageRecv(const uint8_t _mac[WIFIESPNOW_ALEN], const uint8_t* _buf, size_t _count, void* arg) {\n' + + ' // Serial.printf("从MAC:%02X:%02X:%02X:%02X:%02X:%02X处收到数据\\n", _mac[0], _mac[1], _mac[2], _mac[3], _mac[4], _mac[5]);\n' + + ' String message = "";\n' + + ' for (int i = 0; i < static_cast(_count); i++) {\n' + + ' message += String(static_cast(_buf[i]));\n' + + ' }\n' + + ' ' + branch + '\n' + + '}\n'; + + generator.setups_['setup_esp_now_message_receive_cb'] = 'WifiEspNow.onReceive(OnMessageRecv, nullptr);'; + generator.setups_['setup_esp_now'] = ` + WiFi.persistent(false); + WiFi.mode(WIFI_AP); + WiFi.disconnect(); + WiFi.softAP("ESPNOW", nullptr, 3); + WiFi.softAPdisconnect(false); + + Serial.print("当前设备MAC:"); + Serial.println(WiFi.softAPmacAddress()); + + bool ok = WifiEspNow.begin(); + if (!ok) { + Serial.println("WifiEspNow初始化失败"); + ESP.restart(); + }`; + var code = ''; + return code; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/generators/pinout.js b/mixly/boards/default_src/arduino_esp8266/generators/pinout.js new file mode 100644 index 00000000..84f8ea29 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/generators/pinout.js @@ -0,0 +1,5 @@ +export const esp8266_pin = function () { + return ''; +} + +export const wemos_d1_mini_pin = esp8266_pin; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/generators/sensor.js b/mixly/boards/default_src/arduino_esp8266/generators/sensor.js new file mode 100644 index 00000000..8721d964 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/generators/sensor.js @@ -0,0 +1,11 @@ +export const DS1307_init = function (_, generator) { + const SDA = generator.valueToCode(this, 'SDA', generator.ORDER_ATOMIC); + const SCL = generator.valueToCode(this, 'SCL', generator.ORDER_ATOMIC); + const RTC_TYPE = this.getFieldValue('RTCType'); + generator.definitions_[`include_${RTC_TYPE}`] = `#include <${RTC_TYPE}.h>`; + generator.definitions_['include_Wire'] = '#include '; + generator.definitions_[`var_declare_${RTC_TYPE}`] = RTC_TYPE + ' Rtc(Wire);'; + generator.setups_['setup_wire_begin'] = `Wire.begin(${SDA}, ${SCL});`; + generator.setups_['setup_rtc_begin'] = `Rtc.Begin();\n${generator.INDENT}Rtc.SetIsRunning(true);`; + return ''; +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/index.js b/mixly/boards/default_src/arduino_esp8266/index.js new file mode 100644 index 00000000..c0f7da43 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/index.js @@ -0,0 +1,140 @@ +import * as Blockly from 'blockly/core'; +import { Profile } from 'mixly'; + +import { + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + Procedures, + Variables, + Arduino +} from '@mixly/arduino'; + +import { + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators +} from '@mixly/arduino-avr'; + +import { + ArduinoESP8266Pins, + ArduinoESP8266EthernetBlocks, + ArduinoESP8266PinoutBlocks, + ArduinoESP8266EthernetGenerators, + ArduinoESP8266PinoutGenerators, + ArduinoESP8266SensorGenerators, + ArduinoESP8266ZhHans, + ArduinoESP8266ZhHant, + ArduinoESP8266En +} from './'; + +import addBoardFSItem from './mixly-modules/loader'; + +import './css/color.css'; + +Blockly.Arduino = Arduino; +Blockly.generator = Arduino; + +Object.assign(Blockly.Variables, Variables); +Object.assign(Blockly.Procedures, Procedures); + +Profile.default = {}; +Object.assign(Profile, ArduinoESP8266Pins); +Object.assign(Profile.default, ArduinoESP8266Pins.arduino_esp8266); + +Object.assign(Blockly.Lang.ZhHans, ArduinoESP8266ZhHans); +Object.assign(Blockly.Lang.ZhHant, ArduinoESP8266ZhHant); +Object.assign(Blockly.Lang.En, ArduinoESP8266En); + +addBoardFSItem(); + +Object.assign( + Blockly.Blocks, + ArduinoEthernetBlocks, + ArduinoProceduresBlocks, + ArduinoTextBlocks, + ArduinoVariablesBlocks, + ArduinoAVRActuatorBlocks, + ArduinoAVRBlynkBlocks, + ArduinoAVRCommunicateBlocks, + ArduinoAVRControlBlocks, + ArduinoAVRDisplayBlocks, + ArduinoAVREthernetBlocks, + ArduinoAVRFactoryBlocks, + ArduinoAVRInoutBlocks, + ArduinoAVRListsBlocks, + ArduinoAVRLogicBlocks, + ArduinoAVRMathBlocks, + ArduinoAVRPinsBlocks, + ArduinoAVRSensorBlocks, + ArduinoAVRSerialBlocks, + ArduinoAVRStorageBlocks, + ArduinoAVRTextBlocks, + ArduinoAVRToolsBlocks, + ArduinoESP8266EthernetBlocks, + ArduinoESP8266PinoutBlocks +); + +Object.assign( + Blockly.Arduino.forBlock, + ArduinoEthernetGenerators, + ArduinoProceduresGenerators, + ArduinoTextGenerators, + ArduinoVariablesGenerators, + ArduinoAVRActuatorGenerators, + ArduinoAVRBlynkGenerators, + ArduinoAVRCommunicateGenerators, + ArduinoAVRControlGenerators, + ArduinoAVRDisplayGenerators, + ArduinoAVREthernetGenerators, + ArduinoAVRFactoryGenerators, + ArduinoAVRInoutGenerators, + ArduinoAVRListsGenerators, + ArduinoAVRLogicGenerators, + ArduinoAVRMathGenerators, + ArduinoAVRPinsGenerators, + ArduinoAVRSensorGenerators, + ArduinoAVRSerialGenerators, + ArduinoAVRStorageGenerators, + ArduinoAVRTextGenerators, + ArduinoAVRToolsGenerators, + ArduinoESP8266EthernetGenerators, + ArduinoESP8266PinoutGenerators, + ArduinoESP8266SensorGenerators +); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/jsconfig.json b/mixly/boards/default_src/arduino_esp8266/jsconfig.json new file mode 100644 index 00000000..d6b6671d --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/jsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "baseUrl": "./", + "paths": { + "@mixly/arduino": [ + "../arduino" + ], + "@mixly/arduino-avr": [ + "../arduino_avr" + ] + } + }, + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/language/en.js b/mixly/boards/default_src/arduino_esp8266/language/en.js new file mode 100644 index 00000000..7d96b020 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/language/en.js @@ -0,0 +1,140 @@ +import * as Blockly from 'blockly/core'; +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const { XML } = Mixly; +const { En } = Blockly.Lang; + +En.ESP8266_CONFIG_TEMPLATE = TEMPLATE; + +En.ESP8266_CONFIG_INTRODUCE = 'For more information, please visit'; + +En.ESP8266_CONFIG_MESSAGE_XTAL = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'CPU Frequency', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#cpu-frequency', + name: 'CPU Frequency' +}); + +En.ESP8266_CONFIG_MESSAGE_VT = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'VTable location', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#vtable-location', + name: 'VTable' +}); + +En.ESP8266_CONFIG_MESSAGE_EXCEPTION = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'C++ Exceptions', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#c-exceptions', + name: 'C++ Exceptions' +}); + +En.ESP8266_CONFIG_MESSAGE_STACKSMASH = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Stack Protection', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#stack-protection', + name: 'Stack Protection' +}); + +En.ESP8266_CONFIG_MESSAGE_SSL = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'SSL支持', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#ssl-support', + name: 'SSL Support' +}); + +En.ESP8266_CONFIG_MESSAGE_MMU = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Memory Management Unit', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#mmu-memory-management-unit', + name: 'MMU' +}); + +En.ESP8266_CONFIG_MESSAGE_NON32XFER = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Non-32-Bit Access', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#non-32-bit-access', + name: 'Non-32-Bit Access' +}); + +En.ESP8266_CONFIG_MESSAGE_RESET_METHOD = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Reset Method', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#reset-method', + name: 'Reset Method' +}); + +En.ESP8266_CONFIG_MESSAGE_CRYSTAL_FREQ = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Crystal Frequency', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#crystal-frequency', + name: 'Crystal Frequency' +}); + +En.ESP8266_CONFIG_MESSAGE_FLASH_FREQ = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Flash Frequency', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: 'None' +}); + +En.ESP8266_CONFIG_MESSAGE_FLASH_MODE = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Flash Mode', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-mode', + name: 'Flash Mode' +}); + +En.ESP8266_CONFIG_MESSAGE_EESZ = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Flash Size', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-size', + name: 'Flash Size' +}); + +En.ESP8266_CONFIG_MESSAGE_LED = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Builtin Led', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: 'None' +}); + +En.ESP8266_CONFIG_MESSAGE_SDK = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'NONOS SDK Version', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#nonos-sdk-version', + name: 'NONOS SDK Version' +}); + +En.ESP8266_CONFIG_MESSAGE_IP = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'lwIP Variant', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#lwip-variant', + name: 'lwIP Variant' +}); + +En.ESP8266_CONFIG_MESSAGE_DBG = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Debug port', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#debug-port', + name: 'Debug port' +}); + +En.ESP8266_CONFIG_MESSAGE_WIPE = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Erase Flash', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#erase-flash', + name: 'Erase Flash' +}); + +En.ESP8266_CONFIG_MESSAGE_BAUD = XML.render(En.ESP8266_CONFIG_TEMPLATE, { + title: 'Upload Speed', + moreInfo: En.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: 'None' +}); + +En.BOARD_FS = 'Board FS'; + +export default En; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/language/zh-hans.js b/mixly/boards/default_src/arduino_esp8266/language/zh-hans.js new file mode 100644 index 00000000..e9a29a4b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/language/zh-hans.js @@ -0,0 +1,140 @@ +import * as Blockly from 'blockly/core'; +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const { XML } = Mixly; +const { ZhHans } = Blockly.Lang; + +ZhHans.ESP8266_CONFIG_TEMPLATE = TEMPLATE; + +ZhHans.ESP8266_CONFIG_INTRODUCE = '详细介绍请参考'; + +ZhHans.ESP8266_CONFIG_MESSAGE_XTAL = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'CPU时钟频率', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#cpu-frequency', + name: 'CPU Frequency' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_VT = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'VTable location', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#vtable-location', + name: 'VTable' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_EXCEPTION = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'C++异常', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#c-exceptions', + name: 'C++ Exceptions' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_STACKSMASH = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '堆栈保护', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#stack-protection', + name: 'Stack Protection' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_SSL = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'SSL支持', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#ssl-support', + name: 'SSL Support' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_MMU = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '内存管理单元', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#mmu-memory-management-unit', + name: 'MMU' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_NON32XFER = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '非32位访问', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#non-32-bit-access', + name: 'Non-32-Bit Access' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_RESET_METHOD = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '复位方式', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#reset-method', + name: 'Reset Method' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_CRYSTAL_FREQ = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '晶振频率', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#crystal-frequency', + name: 'Crystal Frequency' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_FLASH_FREQ = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '闪存频率', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '无' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_FLASH_MODE = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '烧录方式', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-mode', + name: 'Flash Mode' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_EESZ = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '闪存大小', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-size', + name: 'Flash Size' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_LED = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '内置LED', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '无' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_SDK = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'NonOS SDK版本', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#nonos-sdk-version', + name: 'NONOS SDK Version' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_IP = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: 'lwIP变体', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#lwip-variant', + name: 'lwIP Variant' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_DBG = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '调试端口', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#debug-port', + name: 'Debug port' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_WIPE = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '擦除Flash', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#erase-flash', + name: 'Erase Flash' +}); + +ZhHans.ESP8266_CONFIG_MESSAGE_BAUD = XML.render(ZhHans.ESP8266_CONFIG_TEMPLATE, { + title: '上传速度', + moreInfo: ZhHans.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '无' +}); + +ZhHans.BOARD_FS = '板卡文件管理'; + +export default ZhHans; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/language/zh-hant.js b/mixly/boards/default_src/arduino_esp8266/language/zh-hant.js new file mode 100644 index 00000000..2937b3e7 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/language/zh-hant.js @@ -0,0 +1,140 @@ +import * as Blockly from 'blockly/core'; +import * as Mixly from 'mixly'; +import TEMPLATE from '../template/board-config-message.html'; + +const { XML } = Mixly; +const { ZhHant } = Blockly.Lang; + +ZhHant.ESP8266_CONFIG_TEMPLATE = TEMPLATE; + +ZhHant.ESP8266_CONFIG_INTRODUCE = '詳細介紹請參攷'; + +ZhHant.ESP8266_CONFIG_MESSAGE_XTAL = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'CPU時鐘頻率', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#cpu-frequency', + name: 'CPU Frequency' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_VT = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'VTable location', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#vtable-location', + name: 'VTable' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_EXCEPTION = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'C++异常', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#c-exceptions', + name: 'C++ Exceptions' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_STACKSMASH = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '堆棧保護', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#stack-protection', + name: 'Stack Protection' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_SSL = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'SSL支持', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#ssl-support', + name: 'SSL Support' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_MMU = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '記憶體管理單元', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#mmu-memory-management-unit', + name: 'MMU' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_NON32XFER = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '非32比特訪問', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#non-32-bit-access', + name: 'Non-32-Bit Access' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_RESET_METHOD = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '復位管道', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#reset-method', + name: 'Reset Method' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_CRYSTAL_FREQ = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '晶振頻率', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#crystal-frequency', + name: 'Crystal Frequency' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_FLASH_FREQ = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '閃存頻率', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '無' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_FLASH_MODE = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '燒錄管道', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-mode', + name: 'Flash Mode' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_EESZ = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '閃存大小', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#flash-size', + name: 'Flash Size' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_LED = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '內寘LED', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '無' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_SDK = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'NonOS SDK版本', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#nonos-sdk-version', + name: 'NONOS SDK Version' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_IP = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: 'lwIP變體', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#lwip-variant', + name: 'lwIP Variant' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_DBG = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '調試埠', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#debug-port', + name: 'Debug port' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_WIPE = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '擦除Flash', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: 'https://arduino-esp8266.readthedocs.io/en/latest/ideoptions.html#erase-flash', + name: 'Erase Flash' +}); + +ZhHant.ESP8266_CONFIG_MESSAGE_BAUD = XML.render(ZhHant.ESP8266_CONFIG_TEMPLATE, { + title: '上傳速度', + moreInfo: ZhHant.ESP8266_CONFIG_INTRODUCE, + href: '#', + name: '無' +}); + +ZhHant.BOARD_FS = '闆卡文件管理'; + +export default ZhHant; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/media/boards/NodeMCU.png b/mixly/boards/default_src/arduino_esp8266/media/boards/NodeMCU.png new file mode 100644 index 00000000..698d5977 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/media/boards/NodeMCU.png differ diff --git a/mixly/boards/default_src/arduino_esp8266/media/boards/WeMosD1Mini.png b/mixly/boards/default_src/arduino_esp8266/media/boards/WeMosD1Mini.png new file mode 100644 index 00000000..4d6fd8be Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/media/boards/WeMosD1Mini.png differ diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/boards-eesz-info.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/boards-eesz-info.js new file mode 100644 index 00000000..1ac32bbd --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/boards-eesz-info.js @@ -0,0 +1,1953 @@ +export default { + 'esp8266:esp8266:generic': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + }, + '2M64': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 2031616, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M128': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1966080, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M256': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1835008, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M512': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1572864, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M1M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1048576, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768 + }, + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + }, + '8M6M': { + 'flash_size': '8M', + 'flash_size_bytes': 8388608, + 'flash_ld': 'eagle.flash.8m6m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 8372224, + 'spiffs_start': 2097152, + 'spiffs_end': 8364032, + 'spiffs_blocksize': 8192 + }, + '8M7M': { + 'flash_size': '8M', + 'flash_size_bytes': 8388608, + 'flash_ld': 'eagle.flash.8m7m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 8372224, + 'spiffs_start': 1048576, + 'spiffs_end': 8364032, + 'spiffs_blocksize': 8192 + }, + '16M14M': { + 'flash_size': '16M', + 'flash_size_bytes': 16777216, + 'flash_ld': 'eagle.flash.16m14m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 16760832, + 'spiffs_start': 2097152, + 'spiffs_end': 16752640, + 'spiffs_blocksize': 8192 + }, + '16M15M': { + 'flash_size': '16M', + 'flash_size_bytes': 16777216, + 'flash_ld': 'eagle.flash.16m15m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 16760832, + 'spiffs_start': 1048576, + 'spiffs_end': 16752640, + 'spiffs_blocksize': 8192 + }, + '512K32': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k32.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 471040, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K64': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 438272, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K128': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 372736, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904 + } + }, + 'esp8266:esp8266:esp8285': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + }, + '2M64': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 2031616, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M128': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1966080, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M256': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1835008, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M512': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1572864, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M1M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1048576, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768 + } + }, + 'esp8266:esp8266:espduino': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:huzzah': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:inventone': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:cw01': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:espresso_lite_v1': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:espresso_lite_v2': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:phoenix_v1': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:phoenix_v2': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:nodemcu': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:nodemcuv2': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:modwifi': { + '2M64': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 2031616, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M128': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1966080, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M256': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1835008, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M512': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1572864, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M1M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1048576, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768 + } + }, + 'esp8266:esp8266:thing': { + '512K32': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k32.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 471040, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K64': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 438272, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K128': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 372736, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904 + } + }, + 'esp8266:esp8266:thingdev': { + '512K32': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k32.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 471040, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K64': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 438272, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K128': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 372736, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904 + } + }, + 'esp8266:esp8266:blynk': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:esp210': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:d1_mini': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:d1_mini_pro': { + '16M14M': { + 'flash_size': '16M', + 'flash_size_bytes': 16777216, + 'flash_ld': 'eagle.flash.16m14m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 16760832, + 'spiffs_start': 2097152, + 'spiffs_end': 16752640, + 'spiffs_blocksize': 8192 + }, + '16M15M': { + 'flash_size': '16M', + 'flash_size_bytes': 16777216, + 'flash_ld': 'eagle.flash.16m15m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 16760832, + 'spiffs_start': 1048576, + 'spiffs_end': 16752640, + 'spiffs_blocksize': 8192 + } + }, + 'esp8266:esp8266:d1_mini_lite': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + } + }, + 'esp8266:esp8266:d1': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:espino': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:espinotee': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:wifinfo': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + } + }, + 'esp8266:esp8266:arduino-esp8266': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:gen4iod': { + '2M64': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 2031616, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M128': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1966080, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M256': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1835008, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M512': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1572864, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M1M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1048576, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768 + }, + '512K32': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k32.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 471040, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K64': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 438272, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K128': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904, + 'spiffs_start': 372736, + 'spiffs_end': 503808, + 'spiffs_blocksize': 4096 + }, + '512K': { + 'flash_size': '512K', + 'flash_size_bytes': 524288, + 'flash_ld': 'eagle.flash.512k.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 507904 + } + }, + 'esp8266:esp8266:oak': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:wifiduino': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:wifi_slot': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + }, + '2M64': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 2031616, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M128': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1966080, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M256': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1835008, + 'spiffs_end': 2076672, + 'spiffs_blocksize': 4096 + }, + '2M512': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1572864, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M1M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768, + 'spiffs_start': 1048576, + 'spiffs_end': 2072576, + 'spiffs_blocksize': 8192 + }, + '2M': { + 'flash_size': '2M', + 'flash_size_bytes': 2097152, + 'flash_ld': 'eagle.flash.2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 2080768 + } + }, + 'esp8266:esp8266:wiolink': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:espectro': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:eduinowifi': { + '4M2M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m2m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 2097152, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M3M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m3m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 1048576, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M1M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920, + 'spiffs_start': 3145728, + 'spiffs_end': 4169728, + 'spiffs_blocksize': 8192 + }, + '4M': { + 'flash_size': '4M', + 'flash_size_bytes': 4194304, + 'flash_ld': 'eagle.flash.4m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 4177920 + } + }, + 'esp8266:esp8266:sonoff': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + } + }, + 'esp8266:esp8266:espmxdevkit': { + '1M64': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m64.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 962560, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M128': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m128.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 897024, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M144': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m144.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 880640, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M160': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m160.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 864256, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M192': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m192.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 831488, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M256': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m256.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 765952, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 4096 + }, + '1M512': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m512.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192, + 'spiffs_start': 503808, + 'spiffs_end': 1028096, + 'spiffs_blocksize': 8192 + }, + '1M': { + 'flash_size': '1M', + 'flash_size_bytes': 1048576, + 'flash_ld': 'eagle.flash.1m.ld', + 'spiffs_pagesize': 256, + 'rfcal_addr': 1032192 + } + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/commands.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/commands.js new file mode 100644 index 00000000..043c4f45 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/commands.js @@ -0,0 +1,14 @@ +export default { + littlefs: { + download: "{{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}} && {{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + }, + spiffs: { + download: "{{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -b {{&blockSize}} -p {{&pageSize}} -s {{&size}} {{&img}} && {{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + }, + fatfs: { + download: "{{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} read_flash {{&offset}} {{&size}} {{&img}} && {{&fsTool}} -u {{&usrFolder}} -t fatfs -s {{&size}} {{&img}}", + upload: "{{&fsTool}} -c {{&usrFolder}} -t fatfs -s {{&size}} {{&img}} && {{&esptool}} --chip esp8266 --port {{&port}} --baud {{&baud}} write_flash --flash_mode {{&flashMode}} --flash_freq {{&flashFreq}} --flash_size {{&flashSize}} {{&offset}} {{&img}}" + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-board-handler.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-board-handler.js new file mode 100644 index 00000000..05ef2f26 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-board-handler.js @@ -0,0 +1,80 @@ +import { Env, Boards, FSBoardHandler } from 'mixly'; +import * as path from 'path'; +import COMMANDS from './commands'; +import BOARDS_EESZ_INFO from './boards-eesz-info'; +import MENU from './menu'; +import FS_INFO from './fs-info'; + +export default class FSArduEsp8266Handler extends FSBoardHandler { + constructor() { + super(); + for (let key in COMMANDS) { + this.setFSCommands(key, COMMANDS[key]); + } + } + + onBeforeUpload() { + const boardKey = Boards.getSelectedBoardKey(); + const flashMode = Boards.getSelectedBoardConfigParam('FlashMode') || 'keep'; + let flashFreq = Boards.getSelectedBoardConfigParam('FlashFreq') || 'keep'; + if (flashFreq !== 'keep') { + flashFreq += 'm'; + } + const baud = Boards.getSelectedBoardConfigParam('baud') || '115200'; + const eesz = Boards.getSelectedBoardConfigParam('eesz'); + const info = BOARDS_EESZ_INFO[boardKey][eesz]; + const partition = { + offset: info.spiffs_start, + size: info.spiffs_end - info.spiffs_start, + blockSize: info.spiffs_blocksize, + pageSize: info.spiffs_pagesize + }; + const flashSize = info.flash_size + 'B'; + const fsTool = this.getFSToolPath(); + const img = path.join(Env.boardDirPath, 'build', 'script.img'); + this.updateConfig({ + fsTool, img, flashMode, flashFreq, flashSize, baud, + ...partition + }); + } + + onBeforeDownload() { + const boardKey = Boards.getSelectedBoardKey(); + const baud = Boards.getSelectedBoardConfigParam('baud') || '115200'; + const eesz = Boards.getSelectedBoardConfigParam('eesz'); + const info = BOARDS_EESZ_INFO[boardKey][eesz]; + const partition = { + offset: info.spiffs_start, + size: info.spiffs_end - info.spiffs_start, + blockSize: info.spiffs_blocksize, + pageSize: info.spiffs_pagesize + }; + const fsTool = this.getFSToolPath(); + const img = path.join(Env.boardDirPath, 'build', 'script.img'); + this.updateConfig({ fsTool, img, baud, ...partition }); + } + + getFSMenu() { + return MENU; + } + + getFSToolPath() { + const fsType = this.getFSType(); + let arch = 'x64'; + switch (process.arch) { + case 'arm64': + case 'arm': + arch = 'arm'; + break; + case 'ia32': + arch = 'x32'; + break; + case 'x64': + default: + arch = 'x64'; + } + const platform = Env.currentPlatform; + const fsToolInfo = FS_INFO[`mk${fsType}`]; + return path.join(Env.boardDirPath, 'build/tools', fsToolInfo[platform][arch]); + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-info.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-info.js new file mode 100644 index 00000000..123dae67 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/fs-info.js @@ -0,0 +1,34 @@ +export default { + "mkspiffs": { + "version": "0.2.3", + "linux": { + "x32": "./mkspiffs/linux/mkspiffs-x32.bin", + "x64": "./mkspiffs/linux/mkspiffs-x64.bin", + "arm": "./mkspiffs/linux/mkspiffs-arm.bin" + }, + "darwin": { + "x64": "./mkspiffs/darwin/mkspiffs.bin", + "arm": "./mkspiffs/darwin/mkspiffs.bin" + }, + "win32": { + "x32": "./mkspiffs/win32/mkspiffs.exe", + "x64": "./mkspiffs/win32/mkspiffs.exe" + } + }, + "mklittlefs": { + "version": "3.2.0", + "linux": { + "x32": "./mklittlefs/linux/mklittlefs-x64.bin", + "x64": "./mklittlefs/linux/mklittlefs-x64.bin", + "arm": "./mklittlefs/linux/mklittlefs-arm.bin" + }, + "darwin": { + "x64": "./mklittlefs/darwin/mklittlefs.bin", + "arm": "./mklittlefs/darwin/mklittlefs.bin" + }, + "win32": { + "x32": "./mklittlefs/win32/mklittlefs-x32.exe", + "x64": "./mklittlefs/win32/mklittlefs-x64.exe" + } + } +}; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/loader.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/loader.js new file mode 100644 index 00000000..3b2d72c7 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/loader.js @@ -0,0 +1,42 @@ +import * as goog from 'goog'; +import { Msg } from 'blockly/core'; +import { Workspace, Menu } from 'mixly'; +import FSArduEsp8266Handler from './fs-board-handler'; + + +export default function addBoardFSItem () { + const mainWorkspace = Workspace.getMain(); + const statusBarsManager = mainWorkspace.getStatusBarsManager(); + const dropdownMenu = statusBarsManager.getDropdownMenu(); + const menu = dropdownMenu.getItem('menu'); + menu.add({ + weight: 2, + type: 'sep1', + preconditionFn: () => { + return goog.isElectron; + }, + data: '---------' + }); + menu.add({ + weight: 3, + type: 'filesystem-tool', + preconditionFn: () => { + return goog.isElectron; + }, + data: { + isHtmlName: true, + name: Menu.getItem(Msg.BOARD_FS), + callback: () => { + statusBarsManager.add({ + type: 'board-fs', + id: 'board-fs', + name: Msg.BOARD_FS, + title: Msg.BOARD_FS + }); + statusBarsManager.changeTo('board-fs'); + const fsStatusBar = statusBarsManager.getStatusBarById('board-fs'); + fsStatusBar.setHandler(new FSArduEsp8266Handler()); + } + } + }); +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/mixly-modules/menu.js b/mixly/boards/default_src/arduino_esp8266/mixly-modules/menu.js new file mode 100644 index 00000000..7621459a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/mixly-modules/menu.js @@ -0,0 +1,9 @@ +export default [ + { + id: 'littlefs', + text: 'littlefs' + }, { + id: 'spiffs', + text: 'spiffs' + } +]; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/drawin/mklittlefs.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/drawin/mklittlefs.bin new file mode 100644 index 00000000..07c0974a Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/drawin/mklittlefs.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin new file mode 100644 index 00000000..8ca6a37a Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-arm.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin new file mode 100644 index 00000000..7903c146 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-armv8.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin new file mode 100644 index 00000000..59b803b4 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/linux/mklittlefs-x64.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe new file mode 100644 index 00000000..20b0067f Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x32.exe differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe new file mode 100644 index 00000000..5b0a2b55 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mklittlefs/win32/mklittlefs-x64.exe differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/darwin/mkspiffs.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/darwin/mkspiffs.bin new file mode 100644 index 00000000..ab2c7f79 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/darwin/mkspiffs.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin new file mode 100644 index 00000000..bd1e7da0 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-arm.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin new file mode 100644 index 00000000..0fee49a9 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x32.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin new file mode 100644 index 00000000..2a7fd6ff Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/linux/mkspiffs-x64.bin differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/win32/mkspiffs.exe b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/win32/mkspiffs.exe new file mode 100644 index 00000000..d8987211 Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/build/tools/mkspiffs/win32/mkspiffs.exe differ diff --git a/mixly/boards/default_src/arduino_esp8266/origin/config.json b/mixly/boards/default_src/arduino_esp8266/origin/config.json new file mode 100644 index 00000000..ca8cf139 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/config.json @@ -0,0 +1,1085 @@ +{ + "board": { + "Generic ESP8266 Module": { + "key": "esp8266:esp8266:generic", + "config": [ + { + "key": "xtal", + "label": "CPU Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_XTAL", + "options": [ + { + "key": "80", + "label": "80 MHz" + }, { + "key": "160", + "label": "160 MHz" + } + ] + }, { + "key": "vt", + "label": "VTables", + "messageId": "ESP8266_CONFIG_MESSAGE_VT", + "options": [ + { + "key": "flash", + "label": "Flash" + }, { + "key": "heap", + "label": "Heap" + }, { + "key": "iram", + "label": "IRAM" + } + ] + }, { + "key": "exception", + "label": "C++ Exceptions", + "messageId": "ESP8266_CONFIG_MESSAGE_EXCEPTION", + "options": [ + { + "key": "disabled", + "label": "Disabled (new aborts on oom)" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "stacksmash", + "label": "Stack Protection", + "messageId": "ESP8266_CONFIG_MESSAGE_STACKSMASH", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "ssl", + "label": "SSL Support", + "messageId": "ESP8266_CONFIG_MESSAGE_SSL", + "options": [ + { + "key": "all", + "label": "All SSL ciphers (most compatible)" + }, { + "key": "basic", + "label": "Basic SSL ciphers (lower ROM use)" + } + ] + }, { + "key": "mmu", + "label": "MMU", + "messageId": "ESP8266_CONFIG_MESSAGE_MMU", + "options": [ + { + "key": "3232", + "label": "32KB cache + 32KB IRAM (balanced)" + }, { + "key": "4816", + "label": "16KB cache + 48KB IRAM (IRAM)" + }, { + "key": "4816H", + "label": "16KB cache + 48KB IRAM and 2nd Heap (shared)" + }, { + "key": "3216", + "label": "16KB cache + 32KB IRAM + 16KB 2nd Heap (not shared)" + }, { + "key": "ext128k", + "label": "128K External 23LC1024" + }, { + "key": "ext1024k", + "label": "1M External 64 MBit PSRAM" + } + ] + }, { + "key": "non32xfer", + "label": "Non-32-Bit Access", + "messageId": "ESP8266_CONFIG_MESSAGE_NON32XFER", + "options": [ + { + "key": "fast", + "label": "Use pgm_read macros for IRAM/PROGMEM" + }, { + "key": "safe", + "label": "Byte/Word access to IRAM/PROGMEM (very slow)" + } + ] + }, { + "key": "ResetMethod", + "label": "Reset Method", + "messageId": "ESP8266_CONFIG_MESSAGE_RESET_METHOD", + "options": [ + { + "key": "nodemcu", + "label": "dtr (aka nodemcu)" + }, { + "key": "ck", + "label": "no dtr (aka ck)" + }, { + "key": "nodtr_nosync", + "label": "no dtr, no_sync" + } + ] + }, { + "key": "CrystalFreq", + "label": "Crystal Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_CRYSTAL_FREQ", + "options": [ + { + "key": "26", + "label": "26 MHz" + }, { + "key": "40", + "label": "40 MHz" + } + ] + }, { + "key": "FlashFreq", + "label": "Flash Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_FLASH_FREQ", + "options": [ + { + "key": "40", + "label": "40MHz" + }, { + "key": "80", + "label": "80MHz" + }, { + "key": "20", + "label": "20MHz" + }, { + "key": "26", + "label": "26MHz" + } + ] + }, { + "key": "FlashMode", + "label": "Flash Mode", + "messageId": "ESP8266_CONFIG_MESSAGE_FLASH_MODE", + "options": [ + { + "key": "dout", + "label": "DOUT (compatible)" + }, { + "key": "dio", + "label": "DIO" + }, { + "key": "qout", + "label": "QOUT" + }, { + "key": "qio", + "label": "QIO (fast)" + } + ] + }, { + "key": "eesz", + "label": "Flash Size", + "messageId": "ESP8266_CONFIG_MESSAGE_EESZ", + "options": [ + { + "key": "1M64", + "label": "1MB (FS:64KB OTA:~470KB)" + }, { + "key": "1M128", + "label": "1MB (FS:128KB OTA:~438KB)" + }, { + "key": "1M144", + "label": "1MB (FS:144KB OTA:~430KB)" + }, { + "key": "1M160", + "label": "1MB (FS:160KB OTA:~422KB)" + }, { + "key": "1M192", + "label": "1MB (FS:192KB OTA:~406KB)" + }, { + "key": "1M256", + "label": "1MB (FS:256KB OTA:~374KB)" + }, { + "key": "1M512", + "label": "1MB (FS:512KB OTA:~246KB)" + }, { + "key": "1M", + "label": "1MB (FS:none OTA:~502KB)" + }, { + "key": "2M64", + "label": "2MB (FS:64KB OTA:~992KB)" + }, { + "key": "2M128", + "label": "2MB (FS:128KB OTA:~960KB)" + }, { + "key": "2M256", + "label": "2MB (FS:256KB OTA:~896KB)" + }, { + "key": "2M512", + "label": "2MB (FS:512KB OTA:~768KB)" + }, { + "key": "2M1M", + "label": "2MB (FS:1MB OTA:~512KB)" + }, { + "key": "2M", + "label": "2MB (FS:none OTA:~1019KB)" + }, { + "key": "4M2M", + "label": "4MB (FS:2MB OTA:~1019KB)" + }, { + "key": "4M3M", + "label": "4MB (FS:3MB OTA:~512KB)" + }, { + "key": "4M1M", + "label": "4MB (FS:1MB OTA:~1019KB)" + }, { + "key": "4M", + "label": "4MB (FS:none OTA:~1019KB)" + }, { + "key": "8M6M", + "label": "8MB (FS:6MB OTA:~1019KB)" + }, { + "key": "8M7M", + "label": "8MB (FS:7MB OTA:~512KB)" + }, { + "key": "16M14M", + "label": "16MB (FS:14MB OTA:~1019KB)" + }, { + "key": "16M15M", + "label": "16MB (FS:15MB OTA:~512KB)" + }, { + "key": "512K32", + "label": "512KB (FS:32KB OTA:~230KB)" + }, { + "key": "512K64", + "label": "512KB (FS:64KB OTA:~214KB)" + }, { + "key": "512K128", + "label": "512KB (FS:128KB OTA:~182KB)" + }, { + "key": "512K", + "label": "512KB (FS:none OTA:~246KB)" + } + ] + }, { + "key": "led", + "label": "Builtin Led", + "messageId": "ESP8266_CONFIG_MESSAGE_LED", + "options": [ + { + "key": "2", + "label": "2" + }, { + "key": "0", + "label": "0" + }, { + "key": "1", + "label": "1" + }, { + "key": "3", + "label": "3" + }, { + "key": "4", + "label": "4" + }, { + "key": "5", + "label": "5" + }, { + "key": "6", + "label": "6" + }, { + "key": "7", + "label": "7" + }, { + "key": "8", + "label": "8" + }, { + "key": "9", + "label": "9" + }, { + "key": "10", + "label": "10" + }, { + "key": "11", + "label": "11" + }, { + "key": "12", + "label": "12" + }, { + "key": "13", + "label": "13" + }, { + "key": "14", + "label": "14" + }, { + "key": "15", + "label": "15" + }, { + "key": "16", + "label": "16" + } + ] + }, { + "key": "sdk", + "label": "NONOS SDK Version", + "messageId": "ESP8266_CONFIG_MESSAGE_SDK", + "options": [ + { + "key": "nonosdk_190703", + "label": "nonos-sdk 2.2.1+100 (190703)" + }, { + "key": "nonosdk_191122", + "label": "nonos-sdk 2.2.1+119 (191122)" + }, { + "key": "nonosdk_191105", + "label": "nonos-sdk 2.2.1+113 (191105)" + }, { + "key": "nonosdk_191024", + "label": "nonos-sdk 2.2.1+111 (191024)" + }, { + "key": "nonosdk221", + "label": "nonos-sdk 2.2.1 (legacy)" + } + ] + }, { + "key": "ip", + "label": "lwIP Variant", + "messageId": "ESP8266_CONFIG_MESSAGE_IP", + "options": [ + { + "key": "lm2f", + "label": "v2 Lower Memory" + }, { + "key": "hb2f", + "label": "v2 Higher Bandwidth" + }, { + "key": "lm2n", + "label": "v2 Lower Memory (no features)" + }, { + "key": "hb2n", + "label": "v2 Higher Bandwidth (no features)" + }, { + "key": "lm6f", + "label": "v2 IPv6 Lower Memory" + }, { + "key": "hb6f", + "label": "v2 IPv6 Higher Bandwidth" + } + ] + }, { + "key": "dbg", + "label": "Debug port", + "messageId": "ESP8266_CONFIG_MESSAGE_DBG", + "options": [ + { + "key": "Disabled", + "label": "Disabled" + }, { + "key": "Serial", + "label": "Serial" + }, { + "key": "Serial1", + "label": "Serial1" + } + ] + }, { + "key": "wipe", + "label": "Erase Flash", + "messageId": "ESP8266_CONFIG_MESSAGE_WIPE", + "options": [ + { + "key": "none", + "label": "Only Sketch" + }, { + "key": "sdk", + "label": "Sketch + WiFi Settings" + }, { + "key": "all", + "label": "All Flash Contents" + } + ] + }, { + "key": "baud", + "label": "Upload Speed", + "messageId": "ESP8266_CONFIG_MESSAGE_BAUD", + "options": [ + { + "key": "115200", + "label": "115200" + }, { + "key": "57600", + "label": "57600" + }, { + "key": "921600", + "label": "921600" + }, { + "key": "3000000", + "label": "3000000" + } + ] + } + ] + }, + "NodeMCU 0.9 (ESP-12 Module)": { + "key": "esp8266:esp8266:nodemcu", + "config": [ + { + "key": "xtal", + "label": "CPU Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_XTAL", + "options": [ + { + "key": "80", + "label": "80 MHz" + }, { + "key": "160", + "label": "160 MHz" + } + ] + }, { + "key": "vt", + "label": "VTables", + "messageId": "ESP8266_CONFIG_MESSAGE_VT", + "options": [ + { + "key": "flash", + "label": "Flash" + }, { + "key": "heap", + "label": "Heap" + }, { + "key": "iram", + "label": "IRAM" + } + ] + }, { + "key": "exception", + "label": "C++ Exceptions", + "messageId": "ESP8266_CONFIG_MESSAGE_EXCEPTION", + "options": [ + { + "key": "disabled", + "label": "Disabled (new aborts on oom)" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "stacksmash", + "label": "Stack Protection", + "messageId": "ESP8266_CONFIG_MESSAGE_STACKSMASH", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "ssl", + "label": "SSL Support", + "messageId": "ESP8266_CONFIG_MESSAGE_SSL", + "options": [ + { + "key": "all", + "label": "All SSL ciphers (most compatible)" + }, { + "key": "basic", + "label": "Basic SSL ciphers (lower ROM use)" + } + ] + }, { + "key": "mmu", + "label": "MMU", + "messageId": "ESP8266_CONFIG_MESSAGE_MMU", + "options": [ + { + "key": "3232", + "label": "32KB cache + 32KB IRAM (balanced)" + }, { + "key": "4816", + "label": "16KB cache + 48KB IRAM (IRAM)" + }, { + "key": "4816H", + "label": "16KB cache + 48KB IRAM and 2nd Heap (shared)" + }, { + "key": "3216", + "label": "16KB cache + 32KB IRAM + 16KB 2nd Heap (not shared)" + }, { + "key": "ext128k", + "label": "128K External 23LC1024" + }, { + "key": "ext1024k", + "label": "1M External 64 MBit PSRAM" + } + ] + }, { + "key": "non32xfer", + "label": "Non-32-Bit Access", + "messageId": "ESP8266_CONFIG_MESSAGE_NON32XFER", + "options": [ + { + "key": "fast", + "label": "Use pgm_read macros for IRAM/PROGMEM" + }, { + "key": "safe", + "label": "Byte/Word access to IRAM/PROGMEM (very slow)" + } + ] + }, { + "key": "eesz", + "label": "Flash Size", + "messageId": "ESP8266_CONFIG_MESSAGE_EESZ", + "options": [ + { + "key": "4M2M", + "label": "4MB (FS:2MB OTA:~1019KB)" + }, { + "key": "4M3M", + "label": "4MB (FS:3MB OTA:~512KB)" + }, { + "key": "4M1M", + "label": "4MB (FS:1MB OTA:~1019KB)" + }, { + "key": "4M", + "label": "4MB (FS:none OTA:~1019KB)" + } + ] + }, { + "key": "ip", + "label": "lwIP Variant", + "messageId": "ESP8266_CONFIG_MESSAGE_IP", + "options": [ + { + "key": "lm2f", + "label": "v2 Lower Memory" + }, { + "key": "hb2f", + "label": "v2 Higher Bandwidth" + }, { + "key": "lm2n", + "label": "v2 Lower Memory (no features)" + }, { + "key": "hb2n", + "label": "v2 Higher Bandwidth (no features)" + }, { + "key": "lm6f", + "label": "v2 IPv6 Lower Memory" + }, { + "key": "hb6f", + "label": "v2 IPv6 Higher Bandwidth" + } + ] + }, { + "key": "dbg", + "label": "Debug port", + "messageId": "ESP8266_CONFIG_MESSAGE_DBG", + "options": [ + { + "key": "Disabled", + "label": "Disabled" + }, { + "key": "Serial", + "label": "Serial" + }, { + "key": "Serial1", + "label": "Serial1" + } + ] + }, { + "key": "wipe", + "label": "Erase Flash", + "messageId": "ESP8266_CONFIG_MESSAGE_WIPE", + "options": [ + { + "key": "none", + "label": "Only Sketch" + }, { + "key": "sdk", + "label": "Sketch + WiFi Settings" + }, { + "key": "all", + "label": "All Flash Contents" + } + ] + }, { + "key": "baud", + "label": "Upload Speed", + "messageId": "ESP8266_CONFIG_MESSAGE_BAUD", + "options": [ + { + "key": "115200", + "label": "115200" + }, { + "key": "57600", + "label": "57600" + }, { + "key": "921600", + "label": "921600" + }, { + "key": "3000000", + "label": "3000000" + } + ] + } + ] + }, + "NodeMCU 1.0 (ESP-12E Module)": { + "key": "esp8266:esp8266:nodemcuv2", + "config": [ + { + "key": "xtal", + "label": "CPU Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_XTAL", + "options": [ + { + "key": "80", + "label": "80 MHz" + }, { + "key": "160", + "label": "160 MHz" + } + ] + }, { + "key": "vt", + "label": "VTables", + "messageId": "ESP8266_CONFIG_MESSAGE_VT", + "options": [ + { + "key": "flash", + "label": "Flash" + }, { + "key": "heap", + "label": "Heap" + }, { + "key": "iram", + "label": "IRAM" + } + ] + }, { + "key": "exception", + "label": "C++ Exceptions", + "messageId": "ESP8266_CONFIG_MESSAGE_EXCEPTION", + "options": [ + { + "key": "disabled", + "label": "Disabled (new aborts on oom)" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "stacksmash", + "label": "Stack Protection", + "messageId": "ESP8266_CONFIG_MESSAGE_STACKSMASH", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "ssl", + "label": "SSL Support", + "messageId": "ESP8266_CONFIG_MESSAGE_SSL", + "options": [ + { + "key": "all", + "label": "All SSL ciphers (most compatible)" + }, { + "key": "basic", + "label": "Basic SSL ciphers (lower ROM use)" + } + ] + }, { + "key": "mmu", + "label": "MMU", + "messageId": "ESP8266_CONFIG_MESSAGE_MMU", + "options": [ + { + "key": "3232", + "label": "32KB cache + 32KB IRAM (balanced)" + }, { + "key": "4816", + "label": "16KB cache + 48KB IRAM (IRAM)" + }, { + "key": "4816H", + "label": "16KB cache + 48KB IRAM and 2nd Heap (shared)" + }, { + "key": "3216", + "label": "16KB cache + 32KB IRAM + 16KB 2nd Heap (not shared)" + }, { + "key": "ext128k", + "label": "128K External 23LC1024" + }, { + "key": "ext1024k", + "label": "1M External 64 MBit PSRAM" + } + ] + }, { + "key": "non32xfer", + "label": "Non-32-Bit Access", + "messageId": "ESP8266_CONFIG_MESSAGE_NON32XFER", + "options": [ + { + "key": "fast", + "label": "Use pgm_read macros for IRAM/PROGMEM" + }, { + "key": "safe", + "label": "Byte/Word access to IRAM/PROGMEM (very slow)" + } + ] + }, { + "key": "eesz", + "label": "Flash Size", + "messageId": "ESP8266_CONFIG_MESSAGE_EESZ", + "options": [ + { + "key": "4M2M", + "label": "4MB (FS:2MB OTA:~1019KB)" + }, { + "key": "4M3M", + "label": "4MB (FS:3MB OTA:~512KB)" + }, { + "key": "4M1M", + "label": "4MB (FS:1MB OTA:~1019KB)" + }, { + "key": "4M", + "label": "4MB (FS:none OTA:~1019KB)" + } + ] + }, { + "key": "led", + "label": "Builtin Led", + "messageId": "ESP8266_CONFIG_MESSAGE_LED", + "options": [ + { + "key": "2", + "label": "2" + }, { + "key": "16", + "label": "16" + } + ] + }, { + "key": "ip", + "label": "lwIP Variant", + "messageId": "ESP8266_CONFIG_MESSAGE_IP", + "options": [ + { + "key": "lm2f", + "label": "v2 Lower Memory" + }, { + "key": "hb2f", + "label": "v2 Higher Bandwidth" + }, { + "key": "lm2n", + "label": "v2 Lower Memory (no features)" + }, { + "key": "hb2n", + "label": "v2 Higher Bandwidth (no features)" + }, { + "key": "lm6f", + "label": "v2 IPv6 Lower Memory" + }, { + "key": "hb6f", + "label": "v2 IPv6 Higher Bandwidth" + } + ] + }, { + "key": "dbg", + "label": "Debug port", + "messageId": "ESP8266_CONFIG_MESSAGE_DBG", + "options": [ + { + "key": "Disabled", + "label": "Disabled" + }, { + "key": "Serial", + "label": "Serial" + }, { + "key": "Serial1", + "label": "Serial1" + } + ] + }, { + "key": "wipe", + "label": "Erase Flash", + "messageId": "ESP8266_CONFIG_MESSAGE_WIPE", + "options": [ + { + "key": "none", + "label": "Only Sketch" + }, { + "key": "sdk", + "label": "Sketch + WiFi Settings" + }, { + "key": "all", + "label": "All Flash Contents" + } + ] + }, { + "key": "baud", + "label": "Upload Speed", + "messageId": "ESP8266_CONFIG_MESSAGE_BAUD", + "options": [ + { + "key": "115200", + "label": "115200" + }, { + "key": "57600", + "label": "57600" + }, { + "key": "921600", + "label": "921600" + }, { + "key": "3000000", + "label": "3000000" + } + ] + } + ] + }, + "WeMos D1 R1": { + "key": "esp8266:esp8266:d1", + "config": [ + { + "key": "xtal", + "label": "CPU Frequency", + "messageId": "ESP8266_CONFIG_MESSAGE_XTAL", + "options": [ + { + "key": "80", + "label": "80 MHz" + }, { + "key": "160", + "label": "160 MHz" + } + ] + }, { + "key": "vt", + "label": "VTables", + "messageId": "ESP8266_CONFIG_MESSAGE_VT", + "options": [ + { + "key": "flash", + "label": "Flash" + }, { + "key": "heap", + "label": "Heap" + }, { + "key": "iram", + "label": "IRAM" + } + ] + }, { + "key": "exception", + "label": "C++ Exceptions", + "messageId": "ESP8266_CONFIG_MESSAGE_EXCEPTION", + "options": [ + { + "key": "disabled", + "label": "Disabled (new aborts on oom)" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "stacksmash", + "label": "Stack Protection", + "messageId": "ESP8266_CONFIG_MESSAGE_STACKSMASH", + "options": [ + { + "key": "disabled", + "label": "Disabled" + }, { + "key": "enabled", + "label": "Enabled" + } + ] + }, { + "key": "ssl", + "label": "SSL Support", + "messageId": "ESP8266_CONFIG_MESSAGE_SSL", + "options": [ + { + "key": "all", + "label": "All SSL ciphers (most compatible)" + }, { + "key": "basic", + "label": "Basic SSL ciphers (lower ROM use)" + } + ] + }, { + "key": "mmu", + "label": "MMU", + "messageId": "ESP8266_CONFIG_MESSAGE_MMU", + "options": [ + { + "key": "3232", + "label": "32KB cache + 32KB IRAM (balanced)" + }, { + "key": "4816", + "label": "16KB cache + 48KB IRAM (IRAM)" + }, { + "key": "4816H", + "label": "16KB cache + 48KB IRAM and 2nd Heap (shared)" + }, { + "key": "3216", + "label": "16KB cache + 32KB IRAM + 16KB 2nd Heap (not shared)" + }, { + "key": "ext128k", + "label": "128K External 23LC1024" + }, { + "key": "ext1024k", + "label": "1M External 64 MBit PSRAM" + } + ] + }, { + "key": "eesz", + "label": "Flash Size", + "messageId": "ESP8266_CONFIG_MESSAGE_EESZ", + "options": [ + { + "key": "4M2M", + "label": "4MB (FS:2MB OTA:~1019KB)" + }, { + "key": "4M3M", + "label": "4MB (FS:3MB OTA:~512KB)" + }, { + "key": "4M1M", + "label": "4MB (FS:1MB OTA:~1019KB)" + }, { + "key": "4M", + "label": "4MB (FS:none OTA:~1019KB)" + } + ] + }, { + "key": "ip", + "label": "lwIP Variant", + "messageId": "ESP8266_CONFIG_MESSAGE_IP", + "options": [ + { + "key": "lm2f", + "label": "v2 Lower Memory" + }, { + "key": "hb2f", + "label": "v2 Higher Bandwidth" + }, { + "key": "lm2n", + "label": "v2 Lower Memory (no features)" + }, { + "key": "hb2n", + "label": "v2 Higher Bandwidth (no features)" + }, { + "key": "lm6f", + "label": "v2 IPv6 Lower Memory" + }, { + "key": "hb6f", + "label": "v2 IPv6 Higher Bandwidth" + } + ] + }, { + "key": "dbg", + "label": "Debug port", + "messageId": "ESP8266_CONFIG_MESSAGE_DBG", + "options": [ + { + "key": "Disabled", + "label": "Disabled" + }, { + "key": "Serial", + "label": "Serial" + }, { + "key": "Serial1", + "label": "Serial1" + } + ] + }, { + "key": "wipe", + "label": "Erase Flash", + "messageId": "ESP8266_CONFIG_MESSAGE_WIPE", + "options": [ + { + "key": "none", + "label": "Only Sketch" + }, { + "key": "sdk", + "label": "Sketch + WiFi Settings" + }, { + "key": "all", + "label": "All Flash Contents" + } + ] + }, { + "key": "baud", + "label": "Upload Speed", + "messageId": "ESP8266_CONFIG_MESSAGE_BAUD", + "options": [ + { + "key": "115200", + "label": "115200" + }, { + "key": "57600", + "label": "57600" + }, { + "key": "921600", + "label": "921600" + }, { + "key": "3000000", + "label": "3000000" + } + ] + } + ] + } + }, + "language": "C/C++", + "burn": "None", + "upload": { + "portSelect": "all" + }, + "nav": { + "compile": true, + "upload": true, + "save": { + "ino": true, + "bin": true + }, + "setting": { + "thirdPartyLibrary": true + } + }, + "serial": { + "ctrlCBtn": false, + "ctrlDBtn": false, + "baudRates": 9600, + "yMax": 100, + "yMin": 0, + "pointNum": 100, + "rts": false, + "dtr": true + }, + "lib": { + "mixly": { + "url": [ + "http://download.mixlylibs.cloud/mixly3-packages/cloud-libs/arduino_esp8266/libs.json" + ] + } + }, + "web": { + "devices": { + "serial": true, + "hid": false, + "usb": false + } + } +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/15-MQTT Send Message.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/15-MQTT Send Message.mix new file mode 100644 index 00000000..c440a4a8 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/15-MQTT Send Message.mix @@ -0,0 +1 @@ +Serial115200ssidpassword39.98.114.1221883siotsiotID11000Topic120Topic_0SerialprintlnTopic_0 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk-远程七彩灯.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk-远程七彩灯.mix new file mode 100644 index 00000000..24644cb4 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk-远程七彩灯.mix @@ -0,0 +1 @@ +wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b867565412NEO_GRB41220V0121\n RGB12 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk控制舵机.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk控制舵机.mix new file mode 100644 index 00000000..07731c48 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk控制舵机.mix @@ -0,0 +1 @@ +wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b8675654V0Serialprintlnvpin_value120vpin_value200 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk无线桥接通信.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk无线桥接通信.mix new file mode 100644 index 00000000..ec817a71 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk无线桥接通信.mix @@ -0,0 +1 @@ +wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b8675654V0e8d3214523d148a1beacc8022af22553d1100012V02HIGHV02LOW \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk气象站.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk气象站.mix new file mode 100644 index 00000000..1e34961b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk气象站.mix @@ -0,0 +1 @@ +116.62.49.166wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b8675654SSD1306_128X64_NONAMEu8g2U8G2_R0540x3Cglobal_variatetempint1112temperatureglobal_variatehumint1112humidity11000u8g2page1u8g2_t_gb2312awqy12u8g2100校园气象站u8g210201234温度:Mixlytempu8g210401234湿度:Mixlyhum \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk留言机.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk留言机.mix new file mode 100644 index 00000000..1d7dd705 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk留言机.mix @@ -0,0 +1 @@ +wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b8675654SSD1306_128X64_NONAMEu8g2U8G2_R0540x3Cpage1u8g2_t_gb2312awqy12u8g2001234messageV0Serialprintlnmessageu8g2 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk连接服务器.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk连接服务器.mix new file mode 100644 index 00000000..41e829bb --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/Blynk连接服务器.mix @@ -0,0 +1 @@ +wifi-ssidwifi-passd9efdd0413ec4b74ab0057a0b8675654 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/MAX7219点阵时钟.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/MAX7219点阵时钟.mix new file mode 100644 index 00000000..072924c0 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/MAX7219点阵时钟.mix @@ -0,0 +1 @@ +Serial9600APntp1.aliyun.com860013121441i04111i11000MAX7219fillScreen(0)MAX7219MixlyLTNTP.getTimeHour24()100MixlyNTP.getTimeHour24()StringNTP.getTimeHour24()QUYU1NTP.getTimeSecond()2: LTNTP.getTimeMinute()100MixlyNTP.getTimeMinute()StringNTP.getTimeMinute(){"mmu":"3232","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64"}CiNpbmNsdWRlIDxXaUZpTWFuYWdlci5oPgojaW5jbHVkZSA8VGltZUxpYi5oPgojaW5jbHVkZSA8TnRwQ2xpZW50TGliLmg+CiNpbmNsdWRlIDxTUEkuaD4KI2luY2x1ZGUgPEFkYWZydWl0X0dGWC5oPgojaW5jbHVkZSA8TWF4NzJ4eFBhbmVsLmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKV2lGaVNlcnZlciBzZXJ2ZXIoODApOwppbnQ4X3QgdGltZVpvbmUgPSA4Owpjb25zdCBQUk9HTUVNIGNoYXIgKm50cFNlcnZlciA9ICJudHAxLmFsaXl1bi5jb20iOwpNYXg3Mnh4UGFuZWwgbXlNYXRyaXggPSBNYXg3Mnh4UGFuZWwoMTIsNCwxKTsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIG15TWF0cml4LmZpbGxTY3JlZW4oMCk7CiAgbXlNYXRyaXgud3JpdGUoKTsKICBteU1hdHJpeC5zZXRDdXJzb3IoMCwgMCk7CiAgbXlNYXRyaXgucHJpbnQoU3RyaW5nKCgoTlRQLmdldFRpbWVIb3VyMjQoKSA8IDEwKT9TdHJpbmcoIjAiKSArIFN0cmluZyhOVFAuZ2V0VGltZUhvdXIyNCgpKTooKFN0cmluZykoTlRQLmdldFRpbWVIb3VyMjQoKSkpKSkgKyBTdHJpbmcoKCgobG9uZykgKE5UUC5nZXRUaW1lU2Vjb25kKCkpICUgKGxvbmcpICgyKSk/IjoiOiIgIikpICsgU3RyaW5nKCgoTlRQLmdldFRpbWVNaW51dGUoKSA8IDEwKT9TdHJpbmcoIjAiKSArIFN0cmluZyhOVFAuZ2V0VGltZU1pbnV0ZSgpKTooKFN0cmluZykoTlRQLmdldFRpbWVNaW51dGUoKSkpKSkpOwogIG15TWF0cml4LndyaXRlKCk7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5tb2RlKFdJRklfU1RBKTsKICBXaUZpTWFuYWdlciB3bTsKICBib29sIHJlczsKICByZXM9d20uYXV0b0Nvbm5lY3QoKTsKICBOVFAuc2V0SW50ZXJ2YWwgKDYwMCk7CiAgTlRQLnNldE5UUFRpbWVvdXQgKDE1MDApOwogIE5UUC5iZWdpbiAobnRwU2VydmVyLCB0aW1lWm9uZSwgZmFsc2UpOwogIGZvciAoaW50IGkgPSAwOyBpIDw9IDQ7IGkgPSBpICsgKDEpKSB7CiAgICBteU1hdHJpeC5zZXRSb3RhdGlvbihpLDEpOwogIH0KICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/MQTT连接DF EASY_IOT.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/MQTT连接DF EASY_IOT.mix new file mode 100644 index 00000000..232a4c90 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/MQTT连接DF EASY_IOT.mix @@ -0,0 +1 @@ +Serial115200连接df的easy iot服务器时,项目ID必须留空iot.dfrobot.com.cn188355hNFlj7gcchNK_j7g0SerialprintlnhelloIv_SEca7g120CiNpbmNsdWRlIDxFU1A4MjY2V2lGaS5oPgojaW5jbHVkZSAiQWRhZnJ1aXRfTVFUVC5oIgojaW5jbHVkZSAiQWRhZnJ1aXRfTVFUVF9DbGllbnQuaCIKV2lGaUNsaWVudCBjbGllbnQ7CgpBZGFmcnVpdF9NUVRUX0NsaWVudCBtcXR0KCZjbGllbnQsICJpb3QuZGZyb2JvdC5jb20uY24iLCAxODgzLCAiNTVoTkZsajdnIiwgImNjaE5LX2o3ZyIpOwp2b2lkIE1RVFRfY29ubmVjdCgpOwp2b2lkIE1RVFRfY29ubmVjdCgpIHsKICBpbnQ4X3QgcmV0OwogIGlmIChtcXR0LmNvbm5lY3RlZCgpKSB7CiAgICByZXR1cm47CiAgfQogIFNlcmlhbC5wcmludCgiQ29ubmVjdGluZyB0byBNUVRULi4uICIpOwogIHVpbnQ4X3QgcmV0cmllcyA9IDM7CiAgd2hpbGUgKChyZXQgPSBtcXR0LmNvbm5lY3QoKSkgIT0gMCkgewogICAgU2VyaWFsLnByaW50bG4obXF0dC5jb25uZWN0RXJyb3JTdHJpbmcocmV0KSk7CiAgICBTZXJpYWwucHJpbnRsbigiUmV0cnlpbmcgTVFUVCBjb25uZWN0aW9uIGluIDUgc2Vjb25kcy4uLiIpOwogICAgbXF0dC5kaXNjb25uZWN0KCk7CiAgICBkZWxheSg1MDAwKTsKICAgIHJldHJpZXMtLTsKICAgIGlmIChyZXRyaWVzID09IDApIHsKICAgICAgd2hpbGUgKDEpOwogICAgfQogIH0KICBTZXJpYWwucHJpbnRsbigiTVFUVCBDb25uZWN0ZWQhIik7Cn0KCkFkYWZydWl0X01RVFRfUHVibGlzaCBNUVRUX1RvcGljX0l2X1NFY2E3ZyA9IEFkYWZydWl0X01RVFRfUHVibGlzaCgmbXF0dCwgIkl2X1NFY2E3ZyIpOwoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbigxMTUyMDApOwogIFdpRmkuYmVnaW4oIiIsICIiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIC8vIOi/nuaOpWRm55qEZWFzeSBpb3TmnI3liqHlmajml7bvvIzpobnnm65JROW/hemhu+eVmeepugogIE1RVFRfY29ubmVjdCgpOwogIHBpbk1vZGUoMCwgSU5QVVQpOwp9Cgp2b2lkIGxvb3AoKXsKICBpZiAoZGlnaXRhbFJlYWQoMCkpIHsKICAgIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwogICAgTVFUVF9Ub3BpY19Jdl9TRWNhN2cucHVibGlzaCgxMjApOwoKICB9Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/NTP时间服务器.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/NTP时间服务器.mix new file mode 100644 index 00000000..4b2f2b9b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/NTP时间服务器.mix @@ -0,0 +1 @@ +Serial9600ssidpasswordntp1.aliyun.com860011000SerialprintNTP.getDateYear()Serialprint-SerialprintNTP.getDateMonth()Serialprint-SerialprintlnNTP.getDateDay()SerialprintNTP.getTimeHour24()Serialprint:SerialprintNTP.getTimeMinute()Serialprint:SerialprintlnNTP.getTimeSecond() \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/OLED网络时钟.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/OLED网络时钟.mix new file mode 100644 index 00000000..6c060e37 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/OLED网络时钟.mix @@ -0,0 +1 @@ +Maker Space12345678ntp1.aliyun.com8600SSD1306_128X64_NONAMEu8g2U8G2_R0540x3C11000u8g2page1u8g2tim18Ru8g2021234NTP.getDateYear()-LTNTP.getDateMonth()100MixlyNTP.getDateMonth()StringNTP.getDateMonth()-LTNTP.getDateDay()100MixlyNTP.getDateDay()StringNTP.getDateDay()u8g2tim24Ru8g20301234LTNTP.getTimeHour24()100MixlyNTP.getTimeHour24()StringNTP.getTimeHour24():LTNTP.getTimeMinute()100MixlyNTP.getTimeMinute()StringNTP.getTimeMinute():LTNTP.getTimeSecond()100MixlyNTP.getTimeSecond()StringNTP.getTimeSecond(){"mmu":"3232","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64"}CiNpbmNsdWRlIDxFU1A4MjY2V2lGaS5oPgojaW5jbHVkZSA8VGltZUxpYi5oPgojaW5jbHVkZSA8TnRwQ2xpZW50TGliLmg+CiNpbmNsdWRlIDxVOGcybGliLmg+CiNpbmNsdWRlIDxXaXJlLmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKaW50OF90IHRpbWVab25lID0gODsKY29uc3QgUFJPR01FTSBjaGFyICpudHBTZXJ2ZXIgPSAibnRwMS5hbGl5dW4uY29tIjsKVThHMl9TU0QxMzA2XzEyOFg2NF9OT05BTUVfRl9IV19JMkMgdThnMihVOEcyX1IwLCBVOFg4X1BJTl9OT05FKTsKU2ltcGxlVGltZXIgdGltZXI7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIHU4ZzIuZmlyc3RQYWdlKCk7CiAgZG8KICB7CiAgICBwYWdlMSgpOwogIH13aGlsZSh1OGcyLm5leHRQYWdlKCkpOwp9Cgp2b2lkIHBhZ2UxKCkgewogIHU4ZzIuc2V0Rm9udCh1OGcyX2ZvbnRfdGltUjE4X3RmKTsKICB1OGcyLnNldEZvbnRQb3NUb3AoKTsKICB1OGcyLnNldEN1cnNvcigwLDIpOwogIHU4ZzIucHJpbnQoU3RyaW5nKE5UUC5nZXREYXRlWWVhcigpKSArIFN0cmluZygiLSIpICsgU3RyaW5nKCgoTlRQLmdldERhdGVNb250aCgpIDwgMTApP1N0cmluZygiMCIpICsgU3RyaW5nKE5UUC5nZXREYXRlTW9udGgoKSk6KChTdHJpbmcpKE5UUC5nZXREYXRlTW9udGgoKSkpKSkgKyBTdHJpbmcoIi0iKSArIFN0cmluZygoKE5UUC5nZXREYXRlRGF5KCkgPCAxMCk/U3RyaW5nKCIwIikgKyBTdHJpbmcoTlRQLmdldERhdGVEYXkoKSk6KChTdHJpbmcpKE5UUC5nZXREYXRlRGF5KCkpKSkpKTsKICB1OGcyLnNldEZvbnQodThnMl9mb250X3RpbVIyNF90Zik7CiAgdThnMi5zZXRGb250UG9zVG9wKCk7CiAgdThnMi5zZXRDdXJzb3IoMCwzMCk7CiAgdThnMi5wcmludChTdHJpbmcoKChOVFAuZ2V0VGltZUhvdXIyNCgpIDwgMTApP1N0cmluZygiMCIpICsgU3RyaW5nKE5UUC5nZXRUaW1lSG91cjI0KCkpOigoU3RyaW5nKShOVFAuZ2V0VGltZUhvdXIyNCgpKSkpKSArIFN0cmluZygiOiIpICsgU3RyaW5nKCgoTlRQLmdldFRpbWVNaW51dGUoKSA8IDEwKT9TdHJpbmcoIjAiKSArIFN0cmluZyhOVFAuZ2V0VGltZU1pbnV0ZSgpKTooKFN0cmluZykoTlRQLmdldFRpbWVNaW51dGUoKSkpKSkgKyBTdHJpbmcoIjoiKSArIFN0cmluZygoKE5UUC5nZXRUaW1lU2Vjb25kKCkgPCAxMCk/U3RyaW5nKCIwIikgKyBTdHJpbmcoTlRQLmdldFRpbWVTZWNvbmQoKSk6KChTdHJpbmcpKE5UUC5nZXRUaW1lU2Vjb25kKCkpKSkpKTsKfQoKdm9pZCBzZXR1cCgpewogIFdpRmkuYmVnaW4oIk1ha2VyIFNwYWNlIiwgIjEyMzQ1Njc4Iik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBOVFAuc2V0SW50ZXJ2YWwgKDYwMCk7CiAgTlRQLnNldE5UUFRpbWVvdXQgKDE1MDApOwogIE5UUC5iZWdpbiAobnRwU2VydmVyLCB0aW1lWm9uZSwgZmFsc2UpOwogIHU4ZzIuc2V0STJDQWRkcmVzcygweDNDKjIpOwogIHU4ZzIuYmVnaW4oKTsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKICB1OGcyLmVuYWJsZVVURjhQcmludCgpOwoKfQoKdm9pZCBsb29wKCl7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/TM1637网络时钟.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/TM1637网络时钟.mix new file mode 100644 index 00000000..b089ac39 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/TM1637网络时钟.mix @@ -0,0 +1 @@ +ssidpasswordntp1.aliyun.com8600display2411000displaytrue12NTP.getTimeHour24()30NTP.getTimeMinute() \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/URL和Base64编解码.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/URL和Base64编解码.mix new file mode 100644 index 00000000..49335a99 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/URL和Base64编解码.mix @@ -0,0 +1 @@ +Serial9600Serialprintln=========Base64编解码=========SerialprintlnBASE64ENCODE你好MixlySerialprintlnBASE64DECODE5L2g5aW9TWl4bHk=Serialprintln==========Url编解码===========SerialprintlnURLENCODE你好MixlySerialprintlnURLDECODE%E4%BD%A0%E5%A5%BDMixlySerialprintln=============================={"xtal":{"key":"80","label":"80 MHz"},"vt":{"key":"flash","label":"Flash"},"exception":{"key":"disabled","label":"Disabled (new aborts on oom)"},"stacksmash":{"key":"disabled","label":"Disabled"},"ssl":{"key":"all","label":"All SSL ciphers (most compatible)"},"mmu":{"key":"3232","label":"32KB cache + 32KB IRAM (balanced)"},"non32xfer":{"key":"fast","label":"Use pgm_read macros for IRAM/PROGMEM"},"ResetMethod":{"key":"nodemcu","label":"dtr (aka nodemcu)"},"CrystalFreq":{"key":"26","label":"26 MHz"},"FlashFreq":{"key":"40","label":"40MHz"},"FlashMode":{"key":"dout","label":"DOUT (compatible)"},"eesz":{"key":"1M64","label":"1MB (FS:64KB OTA:~470KB)"},"led":{"key":"2","label":"2"},"sdk":{"key":"nonosdk_190703","label":"nonos-sdk 2.2.1+100 (190703)"},"ip":{"key":"lm2f","label":"v2 Lower Memory"},"dbg":{"key":"Disabled","label":"Disabled"},"wipe":{"key":"none","label":"Only Sketch"},"baud":{"key":"115200","label":"115200"}}CiNpbmNsdWRlIDxyQmFzZTY0Lmg+CiNpbmNsdWRlIDxVUkxDb2RlLmg+CgpVUkxDb2RlIHVybENvZGU7CgpTdHJpbmcgdXJsRW5jb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnN0cmNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxlbmNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS51cmxjb2RlOwp9CgpTdHJpbmcgdXJsRGVjb2RlKFN0cmluZyB1cmxTdHIpIHsKICB1cmxDb2RlLnVybGNvZGUgPSB1cmxTdHI7CiAgdXJsQ29kZS51cmxkZWNvZGUoKTsKICByZXR1cm4gdXJsQ29kZS5zdHJjb2RlOwp9Cgp2b2lkIHNldHVwKCl7CiAgU2VyaWFsLmJlZ2luKDk2MDApOwogIFNlcmlhbC5wcmludGxuKCI9PT09PT09PT1CYXNlNjTnvJbop6PnoIE9PT09PT09PT0iKTsKICBTZXJpYWwucHJpbnRsbihyYmFzZTY0LmVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4ocmJhc2U2NC5kZWNvZGUoIjVMMmc1YVc5VFdsNGJIaz0iKSk7CiAgU2VyaWFsLnByaW50bG4oIj09PT09PT09PT1VcmznvJbop6PnoIE9PT09PT09PT09PSIpOwogIFNlcmlhbC5wcmludGxuKHVybEVuY29kZSgi5L2g5aW9TWl4bHkiKSk7CiAgU2VyaWFsLnByaW50bG4odXJsRGVjb2RlKCIlRTQlQkQlQTAlRTUlQTUlQkRNaXhseSIpKTsKICBTZXJpYWwucHJpbnRsbigiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Cn0KCnZvaWQgbG9vcCgpewoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/map.json b/mixly/boards/default_src/arduino_esp8266/origin/examples/map.json new file mode 100644 index 00000000..7b292708 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/map.json @@ -0,0 +1,82 @@ +{ + "15-MQTT Send Message.mix": { + "__file__": true, + "__name__": "15-MQTT Send Message.mix" + }, + "Blynk-远程七彩灯.mix": { + "__file__": true, + "__name__": "Blynk-远程七彩灯.mix" + }, + "Blynk控制舵机.mix": { + "__file__": true, + "__name__": "Blynk控制舵机.mix" + }, + "Blynk无线桥接通信.mix": { + "__file__": true, + "__name__": "Blynk无线桥接通信.mix" + }, + "Blynk气象站.mix": { + "__file__": true, + "__name__": "Blynk气象站.mix" + }, + "Blynk留言机.mix": { + "__file__": true, + "__name__": "Blynk留言机.mix" + }, + "Blynk连接服务器.mix": { + "__file__": true, + "__name__": "Blynk连接服务器.mix" + }, + "MAX7219点阵时钟.mix": { + "__file__": true, + "__name__": "MAX7219点阵时钟.mix" + }, + "MQTT连接DF EASY_IOT.mix": { + "__file__": true, + "__name__": "MQTT连接DF EASY_IOT.mix" + }, + "NTP时间服务器.mix": { + "__file__": true, + "__name__": "NTP时间服务器.mix" + }, + "OLED网络时钟.mix": { + "__file__": true, + "__name__": "OLED网络时钟.mix" + }, + "TM1637网络时钟.mix": { + "__file__": true, + "__name__": "TM1637网络时钟.mix" + }, + "URL和Base64编解码.mix": { + "__file__": true, + "__name__": "URL和Base64编解码.mix" + }, + "使用http发送POST请求.mix": { + "__file__": true, + "__name__": "使用http发送POST请求.mix" + }, + "心知天气.mix": { + "__file__": true, + "__name__": "心知天气.mix" + }, + "旋转编码器读取数据.mix": { + "__file__": true, + "__name__": "旋转编码器读取数据.mix" + }, + "简明教程": { + "AP模式一键配置网络与清除网络信息.mix": { + "__file__": true, + "__name__": "AP模式一键配置网络与清除网络信息.mix" + }, + "MQTT断线反馈与重连.mix": { + "__file__": true, + "__name__": "MQTT断线反馈与重连.mix" + }, + "网络连接超时优化.mix": { + "__file__": true, + "__name__": "网络连接超时优化.mix" + }, + "__file__": false, + "__name__": "简明教程" + } +} diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/使用http发送POST请求.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/使用http发送POST请求.mix new file mode 100644 index 00000000..026349b3 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/使用http发送POST请求.mix @@ -0,0 +1 @@ +WIFI名称WIFI密码POSThttp://IPAddress:3000/login/{\"name\":\"Mixly\"}SerialprintlnRequest_resultSerialprintlnInvalid response!delay1000{"xtal":{"key":"80","label":"80 MHz"},"vt":{"key":"flash","label":"Flash"},"exception":{"key":"disabled","label":"Disabled (new aborts on oom)"},"stacksmash":{"key":"disabled","label":"Disabled"},"ssl":{"key":"all","label":"All SSL ciphers (most compatible)"},"mmu":{"key":"3232","label":"32KB cache + 32KB IRAM (balanced)"},"non32xfer":{"key":"fast","label":"Use pgm_read macros for IRAM/PROGMEM"},"ResetMethod":{"key":"nodemcu","label":"dtr (aka nodemcu)"},"CrystalFreq":{"key":"26","label":"26 MHz"},"FlashFreq":{"key":"40","label":"40MHz"},"FlashMode":{"key":"dout","label":"DOUT (compatible)"},"eesz":{"key":"1M64","label":"1MB (FS:64KB OTA:~470KB)"},"led":{"key":"2","label":"2"},"sdk":{"key":"nonosdk_190703","label":"nonos-sdk 2.2.1+100 (190703)"},"ip":{"key":"lm2f","label":"v2 Lower Memory"},"dbg":{"key":"Disabled","label":"Disabled"},"wipe":{"key":"none","label":"Only Sketch"},"baud":{"key":"115200","label":"115200"}}CiNpbmNsdWRlIDxFU1A4MjY2V2lGaS5oPgojaW5jbHVkZSA8RVNQODI2NkhUVFBDbGllbnQuaD4KCnZvaWQgc2V0dXAoKXsKICBXaUZpLmJlZ2luKCJXSUZJ5ZCN56ewIiwgIldJRknlr4bnoIEiKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwMCk7CiAgICBTZXJpYWwucHJpbnQoIi4iKTsKICB9CiAgU2VyaWFsLnByaW50bG4oIkxvY2FsIElQOiIpOwogIFNlcmlhbC5wcmludChXaUZpLmxvY2FsSVAoKSk7CgogIFNlcmlhbC5iZWdpbig5NjAwKTsKfQoKdm9pZCBsb29wKCl7CiAgaWYgKFdpRmkuc3RhdHVzKCkgPT0gV0xfQ09OTkVDVEVEKSB7CiAgICBIVFRQQ2xpZW50IGh0dHA7CiAgICBXaUZpQ2xpZW50IGNsaWVudDsKICAgIGh0dHAuYmVnaW4oY2xpZW50LCAiaHR0cDovL0lQQWRkcmVzczozMDAwL2xvZ2luLyIpOwogICAgaHR0cC5hZGRIZWFkZXIoIkNvbnRlbnQtVHlwZSIsICJhcHBsaWNhdGlvbi9qc29uIik7CiAgICBpbnQgaHR0cENvZGUgPSBodHRwLlBPU1QoIntcIm5hbWVcIjpcIk1peGx5XCJ9Iik7CiAgICBpZiAoaHR0cENvZGUgPiAwKSB7CiAgICAgIFN0cmluZyBSZXF1ZXN0X3Jlc3VsdCA9IGh0dHAuZ2V0U3RyaW5nKCk7CiAgICAgIFNlcmlhbC5wcmludGxuKFJlcXVlc3RfcmVzdWx0KTsKICAgIH0gZWxzZSB7CiAgICAgIFNlcmlhbC5wcmludGxuKCJJbnZhbGlkIHJlc3BvbnNlISIpOwogICAgfQogICAgaHR0cC5lbmQoKTsKICB9CiAgZGVsYXkoMTAwMCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/心知天气.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/心知天气.mix new file mode 100644 index 00000000..11bb00ce --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/心知天气.mix @@ -0,0 +1 @@ +Serial9600Xiaomi_043218768195210weather/nowzh-Hansc浙江杭州S9l2sb_ZK-UsWaynG15000weather/nowupdateSerialprintlngetWeatherText \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/旋转编码器读取数据.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/旋转编码器读取数据.mix new file mode 100644 index 00000000..4d14df56 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/旋转编码器读取数据.mix @@ -0,0 +1 @@ +Serial96001541resetPosition51setUpperBound101setLowerBound01setLeftRotationHandlerSerialprintln左转:Mixly1getPosition1setRightRotationHandlerSerialprintln右转:Mixly1getPosition1setChangedHandlerSerialprintln状态改变:MixlyEQ1getDirection1右转左转1setUpperOverflowHandlerSerialprintln高于上限:Mixly1getPosition1setLowerOverflowHandlerSerialprintln低于下限:Mixly1getPosition{"mmu":"3232","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64"}CiNpbmNsdWRlIDxFU1BSb3RhcnkuaD4KCkVTUFJvdGFyeSBlbmNvZGVyMTsKCnZvaWQgZW5jb2RlcjFPbkxlZnRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuW3pui9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbihFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIuWPs+i9rO+8miIpICsgU3RyaW5nKGVuY29kZXIxLmdldFBvc2l0aW9uKCkpKTsKfQoKdm9pZCBlbmNvZGVyMU9uQ2hhbmdlZChFU1BSb3RhcnkmIGVuY29kZXIxKSB7CiAgICBTZXJpYWwucHJpbnRsbihTdHJpbmcoIueKtuaAgeaUueWPmO+8miIpICsgU3RyaW5nKCgoZW5jb2RlcjEuZ2V0RGlyZWN0aW9uKCkgPT0gMSk/IuWPs+i9rCI6IuW3pui9rCIpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPblVwcGVyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLpq5jkuo7kuIrpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgZW5jb2RlcjFPbkxvd2VyT3ZlcmZsb3coRVNQUm90YXJ5JiBlbmNvZGVyMSkgewogICAgU2VyaWFsLnByaW50bG4oU3RyaW5nKCLkvY7kuo7kuIvpmZDvvJoiKSArIFN0cmluZyhlbmNvZGVyMS5nZXRQb3NpdGlvbigpKSk7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgZW5jb2RlcjEuYmVnaW4oNCwgNSk7CiAgZW5jb2RlcjEuc2V0U3RlcHNQZXJDbGljaygyKTsKICBlbmNvZGVyMS5yZXNldFBvc2l0aW9uKDUpOwogIGVuY29kZXIxLnNldFVwcGVyQm91bmQoMTApOwogIGVuY29kZXIxLnNldExvd2VyQm91bmQoMCk7CiAgZW5jb2RlcjEuc2V0TGVmdFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uTGVmdFJvdGF0aW9uKTsKICBlbmNvZGVyMS5zZXRSaWdodFJvdGF0aW9uSGFuZGxlcihlbmNvZGVyMU9uUmlnaHRSb3RhdGlvbik7CiAgZW5jb2RlcjEuc2V0Q2hhbmdlZEhhbmRsZXIoZW5jb2RlcjFPbkNoYW5nZWQpOwogIGVuY29kZXIxLnNldFVwcGVyT3ZlcmZsb3dIYW5kbGVyKGVuY29kZXIxT25VcHBlck92ZXJmbG93KTsKICBlbmNvZGVyMS5zZXRMb3dlck92ZXJmbG93SGFuZGxlcihlbmNvZGVyMU9uTG93ZXJPdmVyZmxvdyk7Cn0KCnZvaWQgbG9vcCgpewogIGVuY29kZXIxLmxvb3AoKTsKCn0= \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/AP模式一键配置网络与清除网络信息.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/AP模式一键配置网络与清除网络信息.mix new file mode 100644 index 00000000..ecb8bcf2 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/AP模式一键配置网络与清除网络信息.mix @@ -0,0 +1 @@ +当我们使用ESP系列开发板编写好程序后,可能会&#10;遇到更改设备位置等情况,这个时候我们不需要&#10;重新编写程序连接wifi只需要用下方的AP一键配网&#10;便可随时更改网络一键配网在程序初始化时执行一次会尝试连接上次&#10;已连接成功的wifi,若连接失败或者不在原来的网&#10;络环境则会启用一个ESP开头的热点名称(无密码),&#10;使用手机或者电脑连接此网络输入ip地址192.168.4.1&#10;就可以通过网页配置wifi信息第一次使用建议打开串口监视器先体验一键配网,&#10;按照串口监视器提示操作单机按钮0可以清除上次已连接的网络信息,从而重新配网Serial9600AP11000SerialprintlnhelloattachClick0LOWWiFiManager wifiManager;&#10;wifiManager.resetSettings();这两句代码可以清除已连接的网络信息{"xtal":"80","vt":"flash","exception":"disabled","stacksmash":"disabled","ssl":"all","mmu":"3232","non32xfer":"fast","ResetMethod":"nodemcu","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64","led":"2","sdk":"nonosdk_190703","ip":"lm2f","dbg":"Disabled","wipe":"none","baud":"115200"}CiNpbmNsdWRlIDxXaUZpTWFuYWdlci5oPgojaW5jbHVkZSA8U2ltcGxlVGltZXIuaD4KCiNpbmNsdWRlIDxPbmVCdXR0b24uaD4KCldpRmlTZXJ2ZXIgc2VydmVyKDgwKTsKU2ltcGxlVGltZXIgdGltZXI7Ck9uZUJ1dHRvbiBidXR0b24wKDAsdHJ1ZSk7Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIFNlcmlhbC5wcmludGxuKCJoZWxsbyIpOwp9Cgp2b2lkIGF0dGFjaENsaWNrMCgpIHsKICAvLyDov5nkuKTlj6Xku6PnoIHlj6/ku6XmuIXpmaTlt7Lov57mjqXnmoTnvZHnu5zkv6Hmga8KICBXaUZpTWFuYWdlciB3aWZpTWFuYWdlcjsKICB3aWZpTWFuYWdlci5yZXNldFNldHRpbmdzKCk7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgV2lGaS5tb2RlKFdJRklfU1RBKTsKICBXaUZpTWFuYWdlciB3bTsKICBib29sIHJlczsKICByZXM9d20uYXV0b0Nvbm5lY3QoKTsKICB0aW1lci5zZXRJbnRlcnZhbCgxMDAwTCwgU2ltcGxlX3RpbWVyXzEpOwoKICBidXR0b24wLmF0dGFjaENsaWNrKGF0dGFjaENsaWNrMCk7Cn0KCnZvaWQgbG9vcCgpewogIC8v5b2T5oiR5Lus5L2/55SoRVNQ57O75YiX5byA5Y+R5p2/57yW5YaZ5aW956iL5bqP5ZCO77yM5Y+v6IO95LyaCiAgLy/pgYfliLDmm7TmlLnorr7lpIfkvY3nva7nrYnmg4XlhrXvvIzov5nkuKrml7blgJnmiJHku6zkuI3pnIDopoEKICAvL+mHjeaWsOe8luWGmeeoi+W6j+i/nuaOpXdpZmnlj6rpnIDopoHnlKjkuIvmlrnnmoRBUOS4gOmUrumFjee9kQogIC8v5L6/5Y+v6ZqP5pe25pu05pS5572R57ucCiAgLy/kuIDplK7phY3nvZHlnKjnqIvluo/liJ3lp4vljJbml7bmiafooYzkuIDmrKHkvJrlsJ3or5Xov57mjqXkuIrmrKEKICAvL+W3sui/nuaOpeaIkOWKn+eahHdpZmnvvIzoi6Xov57mjqXlpLHotKXmiJbogIXkuI3lnKjljp/mnaXnmoTnvZEKICAvL+e7nOeOr+Wig+WImeS8muWQr+eUqOS4gOS4qkVTUOW8gOWktOeahOeDreeCueWQjeensO+8iOaXoOWvhuegge+8ie+8jAogIC8v5L2/55So5omL5py65oiW6ICF55S16ISR6L+e5o6l5q2k572R57uc6L6T5YWlaXDlnLDlnYAxOTIuMTY4LjQuMQogIC8v5bCx5Y+v5Lul6YCa6L+H572R6aG16YWN572ud2lmaeS/oeaBrwogIC8v56ys5LiA5qyh5L2/55So5bu66K6u5omT5byA5Liy5Y+j55uR6KeG5Zmo5YWI5L2T6aqM5LiA6ZSu6YWN572R77yMCiAgLy/mjInnhafkuLLlj6Pnm5Hop4blmajmj5DnpLrmk43kvZwKICAvL+WNleacuuaMiemSrjDlj6/ku6XmuIXpmaTkuIrmrKHlt7Lov57mjqXnmoTnvZHnu5zkv6Hmga/vvIzku47ogIzph43mlrDphY3nvZEKCiAgdGltZXIucnVuKCk7CgogIGJ1dHRvbjAudGljaygpOwp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/MQTT断线反馈与重连.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/MQTT断线反馈与重连.mix new file mode 100644 index 00000000..244babe1 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/MQTT断线反馈与重连.mix @@ -0,0 +1 @@ +当由于网络波动等情况造成MQTT断开时,如果能获取断线状态&#10; 那么我们就可以及时启用断线程序或者继续尝试连接MQTT服务器&#10;恢复服务,以下例子检测了设备与MQTT服务器连接并闪烁LED提示&#10;同时尝试恢复MQTT服务与重新订阅text主题,多功能按钮0单击将发送&#10;Hello打印到串口监视器,使用请修改为自己的WiFi与MQTT服务器信息&#10;MixIO也可使用此方法处理离线问题Serial9600Netcore-65080F1234567890bemfa.com9501d597ed83edb4c3fc25c89377dbe83f01textSerialprintlnmqtt_dataattachClick0LOWHellotext11000!client.connected()MQTT服务器断开连接板载LED闪烁提示MQTT掉线2HIGH2尝试重连MQTT服务器,格式参考setup中相关代码String client_id = "d597ed83edb4c3fc25c89377dbe83f0e";&#10;if (client.connect(client_id.c_str(), mqtt_username, mqtt_password)) {&#10; Serial.println("Public emqx mqtt broker connected");&#10;} else {&#10; Serial.print("failed with state ");&#10; Serial.print(client.state());&#10;}订阅恢复text主题client.subscribe(String("text").c_str());2HIGH{"xtal":"80","vt":"flash","exception":"disabled","stacksmash":"disabled","ssl":"all","mmu":"3232","non32xfer":"fast","ResetMethod":"nodemcu","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64","led":"2","sdk":"nonosdk_190703","ip":"lm2f","dbg":"Disabled","wipe":"none","baud":"115200"}CiNpbmNsdWRlIDxFU1A4MjY2V2lGaS5oPgojaW5jbHVkZSA8UHViU3ViQ2xpZW50Lmg+CgojaW5jbHVkZSA8T25lQnV0dG9uLmg+CiNpbmNsdWRlIDxTaW1wbGVUaW1lci5oPgoKY29uc3QgY2hhciAqbXF0dF9icm9rZXIgPSAiYmVtZmEuY29tIjsKY29uc3QgY2hhciAqbXF0dF91c2VybmFtZSA9ICIiOwpjb25zdCBjaGFyICptcXR0X3Bhc3N3b3JkID0gIiI7CmNvbnN0IGludCBtcXR0X3BvcnQgPSA5NTAxOwpTdHJpbmcgbXF0dF90b3BpYyA9ICIiOwpTdHJpbmcgbXF0dF9kYXRhID0gIiI7CmJvb2xlYW4gbXF0dF9zdGF0dXMgPSBmYWxzZTsKV2lGaUNsaWVudCBlc3BDbGllbnQ7ClB1YlN1YkNsaWVudCBjbGllbnQoZXNwQ2xpZW50KTsKdm9pZCBjYWxsYmFjayhjaGFyICp0b3BpYywgYnl0ZSAqcGF5bG9hZCwgdW5zaWduZWQgaW50IGxlbmd0aCkgewogIFN0cmluZyBkYXRhID0gIiI7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewogICAgZGF0YSA9IFN0cmluZyhkYXRhKSArIFN0cmluZygoY2hhcikgcGF5bG9hZFtpXSk7CiAgfQogIG1xdHRfdG9waWMgPSBTdHJpbmcodG9waWMpOwogIG1xdHRfZGF0YSA9IGRhdGE7CiAgbXF0dF9zdGF0dXMgPSB0cnVlOwp9CgpPbmVCdXR0b24gYnV0dG9uMCgwLHRydWUpOwpTaW1wbGVUaW1lciB0aW1lcjsKCnZvaWQgYXR0YWNoQ2xpY2swKCkgewogIGNsaWVudC5wdWJsaXNoKFN0cmluZygidGV4dCIpLmNfc3RyKCksU3RyaW5nKCJIZWxsbyIpLmNfc3RyKCkpOwp9Cgp2b2lkIFNpbXBsZV90aW1lcl8xKCkgewogIC8vIE1RVFTmnI3liqHlmajmlq3lvIDov57mjqUKICBpZiAoIWNsaWVudC5jb25uZWN0ZWQoKSkgewogICAgZGlnaXRhbFdyaXRlKDIsKCFkaWdpdGFsUmVhZCgyKSkpOwogICAgU3RyaW5nIGNsaWVudF9pZCA9ICJkNTk3ZWQ4M2VkYjRjM2ZjMjVjODkzNzdkYmU4M2YwZSI7CiAgICAgIGlmIChjbGllbnQuY29ubmVjdChjbGllbnRfaWQuY19zdHIoKSwgbXF0dF91c2VybmFtZSwgbXF0dF9wYXNzd29yZCkpIHsKICAgICAgICBTZXJpYWwucHJpbnRsbigiUHVibGljIGVtcXggbXF0dCBicm9rZXIgY29ubmVjdGVkIik7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgU2VyaWFsLnByaW50KCJmYWlsZWQgd2l0aCBzdGF0ZSAiKTsKICAgICAgICBTZXJpYWwucHJpbnQoY2xpZW50LnN0YXRlKCkpOwogICAgICB9CiAgICBjbGllbnQuc3Vic2NyaWJlKFN0cmluZygidGV4dCIpLmNfc3RyKCkpOwoKICB9IGVsc2UgewogICAgZGlnaXRhbFdyaXRlKDIsSElHSCk7CgogIH0KfQoKdm9pZCBzZXR1cCgpewogIFNlcmlhbC5iZWdpbig5NjAwKTsKICBXaUZpLmJlZ2luKCJOZXRjb3JlLTY1MDgwRiIsICIxMjM0NTY3ODkwIik7CiAgd2hpbGUgKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSB7CiAgICBkZWxheSg1MDApOwogICAgU2VyaWFsLnByaW50KCIuIik7CiAgfQogIFNlcmlhbC5wcmludGxuKCJMb2NhbCBJUDoiKTsKICBTZXJpYWwucHJpbnQoV2lGaS5sb2NhbElQKCkpOwoKICBjbGllbnQuc2V0U2VydmVyKG1xdHRfYnJva2VyLCBtcXR0X3BvcnQpOwpjbGllbnQuc2V0Q2FsbGJhY2soY2FsbGJhY2spOwp3aGlsZSAoIWNsaWVudC5jb25uZWN0ZWQoKSkgewogIFN0cmluZyBjbGllbnRfaWQgPSAiZDU5N2VkODNlZGI0YzNmYzI1Yzg5Mzc3ZGJlODNmMDEiOwogIGlmIChjbGllbnQuY29ubmVjdChjbGllbnRfaWQuY19zdHIoKSwgbXF0dF91c2VybmFtZSwgbXF0dF9wYXNzd29yZCkpIHsKICAgIFNlcmlhbC5wcmludGxuKCJQdWJsaWMgZW1xeCBtcXR0IGJyb2tlciBjb25uZWN0ZWQiKTsKICB9IGVsc2UgewogICAgU2VyaWFsLnByaW50KCJmYWlsZWQgd2l0aCBzdGF0ZSAiKTsKICAgIFNlcmlhbC5wcmludChjbGllbnQuc3RhdGUoKSk7CiAgICBkZWxheSgyMDAwKTsKICB9Cn0KCiAgY2xpZW50LnN1YnNjcmliZShTdHJpbmcoInRleHQiKS5jX3N0cigpKTsKICBidXR0b24wLmF0dGFjaENsaWNrKGF0dGFjaENsaWNrMCk7CiAgcGluTW9kZSgyLCBPVVRQVVQpOwogIHRpbWVyLnNldEludGVydmFsKDEwMDBMLCBTaW1wbGVfdGltZXJfMSk7Cgp9Cgp2b2lkIGxvb3AoKXsKICAvL+W9k+eUseS6jue9kee7nOazouWKqOetieaDheWGtemAoOaIkE1RVFTmlq3lvIDml7bvvIzlpoLmnpzog73ojrflj5bmlq3nur/nirbmgIEKICAvLyDpgqPkuYjmiJHku6zlsLHlj6/ku6Xlj4rml7blkK/nlKjmlq3nur/nqIvluo/miJbogIXnu6fnu63lsJ3or5Xov57mjqVNUVRU5pyN5Yqh5ZmoCiAgLy/mgaLlpI3mnI3liqHvvIzku6XkuIvkvovlrZDmo4DmtYvkuoborr7lpIfkuI5NUVRU5pyN5Yqh5Zmo6L+e5o6l5bm26Zeq54OBTEVE5o+Q56S6CiAgLy/lkIzml7blsJ3or5XmgaLlpI1NUVRU5pyN5Yqh5LiO6YeN5paw6K6i6ZiFdGV4dOS4u+mimO+8jOWkmuWKn+iDveaMiemSrjDljZXlh7vlsIblj5HpgIEKICAvL0hlbGxv5omT5Y2w5Yiw5Liy5Y+j55uR6KeG5Zmo77yM5L2/55So6K+35L+u5pS55Li66Ieq5bex55qEV2lGaeS4jk1RVFTmnI3liqHlmajkv6Hmga8KICAvL01peElP5Lmf5Y+v5L2/55So5q2k5pa55rOV5aSE55CG56a757q/6Zeu6aKYCiAgY2xpZW50Lmxvb3AoKTsKCiAgaWYgKG1xdHRfc3RhdHVzKSB7CiAgICBpZiAoU3RyaW5nKG1xdHRfdG9waWMpLmVxdWFscyhTdHJpbmcoInRleHQiKSkpIHsKICAgIFNlcmlhbC5wcmludGxuKG1xdHRfZGF0YSk7CiAgICBtcXR0X3N0YXR1cyA9IGZhbHNlOwogICAgfQogIH0KCiAgYnV0dG9uMC50aWNrKCk7CiAgdGltZXIucnVuKCk7Cgp9 \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/网络连接超时优化.mix b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/网络连接超时优化.mix new file mode 100644 index 00000000..3300a2e6 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/origin/examples/简明教程/网络连接超时优化.mix @@ -0,0 +1 @@ +WiFi名称WiFi密码超时时间(ms)在使用物联网的过程中,我们发现当开发板无法连接网络时&#10;会发现程序会陷入循环当中导致其他程序无法正常执行,&#10;因此我们需要知道网络是否连接成功,如果网络连接异常那么&#10;我们应当设置一个超时时间,这样我们就可以在网络连接失败时&#10;启用“离线模式”WiFi连接booleanESP8266WiFilocal_variateWiFi连接状态booleanFALSElocal_variate系统运行时间uint16_tmillisWiFibeginWiFi名称WiFi密码WHILETRUEWiFi.status() != WL_CONNECTEDdelay50Serialprint.GTEMINUS1millis1系统运行时间超时时间(ms)BREAKSerialprintln(WiFi.status() != WL_CONNECTED)WiFi连接状态TRUESerialprintLocal IP:SerialprintlnWiFi.localIP()WiFi连接状态mixly66610000SerialprintlnWiFi连接成功SerialprintlnWiFi连接失败{"mmu":"3232","CrystalFreq":"26","FlashFreq":"40","FlashMode":"dout","eesz":"1M64"}CiNpbmNsdWRlIDxFU1A4MjY2V2lGaS5oPgoKYm9vbGVhbiBXaUZpX0U4X0JGXzlFX0U2XzhFX0E1KFN0cmluZyBXaUZpX0U1XzkwXzhEX0U3X0E3X0IwLCBTdHJpbmcgV2lGaV9FNV9BRl84Nl9FN19BMF84MSwgaW50IF9FOF9CNl84NV9FNl85N19CNl9FNl85N19CNl9FOV85N19CNF9FRl9CQ184OG1zX0VGX0JDXzg5KSB7CiAgYm9vbGVhbiBXaUZpX0U4X0JGXzlFX0U2XzhFX0E1X0U3XzhBX0I2X0U2XzgwXzgxID0gZmFsc2U7CiAgdWludDE2X3QgX0U3X0IzX0JCX0U3X0JCXzlGX0U4X0JGXzkwX0U4X0ExXzhDX0U2Xzk3X0I2X0U5Xzk3X0I0ID0gbWlsbGlzKCk7CiAgV2lGaS5iZWdpbihXaUZpX0U1XzkwXzhEX0U3X0E3X0IwLCBXaUZpX0U1X0FGXzg2X0U3X0EwXzgxKTsKICB3aGlsZSAoV2lGaS5zdGF0dXMoKSAhPSBXTF9DT05ORUNURUQpIHsKICAgIGRlbGF5KDUwKTsKICAgIFNlcmlhbC5wcmludCgiLiIpOwogICAgaWYgKG1pbGxpcygpIC0gX0U3X0IzX0JCX0U3X0JCXzlGX0U4X0JGXzkwX0U4X0ExXzhDX0U2Xzk3X0I2X0U5Xzk3X0I0ID49IF9FOF9CNl84NV9FNl85N19CNl9FNl85N19CNl9FOV85N19CNF9FRl9CQ184OG1zX0VGX0JDXzg5KSB7CiAgICAgIGJyZWFrOwoKICAgIH0KICB9CiAgU2VyaWFsLnByaW50bG4oIiIpOwogIGlmICghKFdpRmkuc3RhdHVzKCkgIT0gV0xfQ09OTkVDVEVEKSkgewogICAgV2lGaV9FOF9CRl85RV9FNl84RV9BNV9FN184QV9CNl9FNl84MF84MSA9IHRydWU7CiAgICBTZXJpYWwucHJpbnQoIkxvY2FsIElQOiIpOwogICAgU2VyaWFsLnByaW50bG4oV2lGaS5sb2NhbElQKCkpOwoKICB9CiAgcmV0dXJuIFdpRmlfRThfQkZfOUVfRTZfOEVfQTVfRTdfOEFfQjZfRTZfODBfODE7Cn0KCnZvaWQgc2V0dXAoKXsKICBTZXJpYWwuYmVnaW4oOTYwMCk7CiAgaWYgKFdpRmlfRThfQkZfOUVfRTZfOEVfQTUoIm1peGx5IiwgIjY2NiIsIDEwMDAwKSkgewogICAgU2VyaWFsLnByaW50bG4oIldpRmnov57mjqXmiJDlip8iKTsKCiAgfSBlbHNlIHsKICAgIFNlcmlhbC5wcmludGxuKCJXaUZp6L+e5o6l5aSx6LSlIik7CgogIH0KfQoKdm9pZCBsb29wKCl7CiAgLy/lnKjkvb/nlKjnianogZTnvZHnmoTov4fnqIvkuK3vvIzmiJHku6zlj5HnjrDlvZPlvIDlj5Hmnb/ml6Dms5Xov57mjqXnvZHnu5zml7YKICAvL+S8muWPkeeOsOeoi+W6j+S8mumZt+WFpeW+queOr+W9k+S4reWvvOiHtOWFtuS7lueoi+W6j+aXoOazleato+W4uOaJp+ihjO+8jAogIC8v5Zug5q2k5oiR5Lus6ZyA6KaB55+l6YGT572R57uc5piv5ZCm6L+e5o6l5oiQ5Yqf77yM5aaC5p6c572R57uc6L+e5o6l5byC5bi46YKj5LmICiAgLy/miJHku6zlupTlvZPorr7nva7kuIDkuKrotoXml7bml7bpl7TvvIzov5nmoLfmiJHku6zlsLHlj6/ku6XlnKjnvZHnu5zov57mjqXlpLHotKXml7YKICAvL+WQr+eUqOKAnOemu+e6v+aooeW8j+KAnQoKfQ== \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/origin/media/esp8266_compressed.png b/mixly/boards/default_src/arduino_esp8266/origin/media/esp8266_compressed.png new file mode 100644 index 00000000..9d1e1afc Binary files /dev/null and b/mixly/boards/default_src/arduino_esp8266/origin/media/esp8266_compressed.png differ diff --git a/mixly/boards/default_src/arduino_esp8266/package.json b/mixly/boards/default_src/arduino_esp8266/package.json new file mode 100644 index 00000000..9e275dbe --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/package.json @@ -0,0 +1,33 @@ +{ + "name": "@mixly/arduino-esp8266", + "version": "1.5.0", + "description": "适用于mixly的arduino esp8266模块", + "scripts": { + "serve": "webpack-dev-server --config=webpack.dev.js", + "build:dev": "webpack --config=webpack.dev.js", + "build:prod": "npm run build:examples & webpack --config=webpack.prod.js", + "build:examples": "node ../../../scripts/build-examples.js -t special", + "build:examples:ob": "node ../../../scripts/build-examples.js -t special --obfuscate", + "publish:board": "npm publish --registry https://registry.npmjs.org/" + }, + "main": "./export.js", + "author": "Mixly Team", + "keywords": [ + "mixly", + "mixly-plugin", + "arduino-esp8266" + ], + "homepage": "https://gitee.com/bnu_mixly/mixly3/tree/master/boards/default_src/arduino_esp8266", + "bugs": { + "url": "https://gitee.com/bnu_mixly/mixly3/issues" + }, + "repository": { + "type": "git", + "url": "https://gitee.com/bnu_mixly/mixly3.git", + "directory": "default_src/arduino_esp8266" + }, + "publishConfig": { + "access": "public" + }, + "license": "Apache 2.0" +} \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/pins/pins.js b/mixly/boards/default_src/arduino_esp8266/pins/pins.js new file mode 100644 index 00000000..20bdfa6a --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/pins/pins.js @@ -0,0 +1,56 @@ +const pins = {}; + +pins.arduino_esp8266 = { + description: 'esp8266_Arduino', + digital: [['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['12', '12'], ['13', '13'], ['14', '14'], ['15', '15'], ['16', '16'], ['A0', 'A0']], + analog: [['A0', 'A0']], + pwm: [['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['12', '12'], ['13', '13'], ['14', '14'], ['15', '15'], ['A0', 'A0']], + interrupt: [['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['12', '12'], ['13', '13'], ['14', '14'], ['15', '15'], ['A0', 'A0']], + SDA: [['4', '4']], + SCL: [['5', '5']], + MOSI: [['13', '13']], + MISO: [['12', '12']], + SCK: [['14', '14']], + serial_select: [['Serial', 'Serial'], ['SoftwareSerial', 'mySerial'], ['SoftwareSerial1', 'mySerial1'], ['SoftwareSerial2', 'mySerial2'], ['SoftwareSerial3', 'mySerial3']], + serial: 9600 +}; + +pins['ESPectro Core'] = +pins['Arduino ESP8266 Generic'] = +pins['Generic_ESP8266'] = +pins['ESP8266_Modules'] = +pins['Generic ESP8266 Module'] = +pins['Generic ESP8285 Module'] = +pins['Adafruit HUZZAH ESP8266'] = +pins['NodeMCU 0.9 (ESP-12 Module)'] = +pins['NodeMCU 1.0 (ESP-12E Module)'] = +pins['Olimex MOD-WIFI-ESP8266(-DEV)'] = +pins['SparkFun ESP8266 Thing'] = +pins['SweetPea ESP-210'] = +pins['ESPDuino'] = +pins['Adafruit Feather HUZZAH ESP8266'] = +pins['Invent One'] = +pins['XinaBox CW01'] = +pins['ESPresso Lite 1.0'] = +pins['ESPresso Lite 2.0'] = +pins['Phoenix 1.0'] = +pins['Phoenix 2.0'] = +pins['NodeMCU 0.9'] = +pins['NodeMCU 1.0'] = +pins['Olimex MOD-WIFI-ESP8266'] = +pins['SparkFun ESP8266 Thing Dev'] = +pins['LOLIN'] = +pins['WeMos D1 R1'] = +pins['ESPino'] = +pins['ThaiEasyElec\'s ESPino'] = +pins['Arduino ESP8266'] = +pins['WifInfo'] = +pins['esp8266_Arduino'] = +pins['4D Systems gen4 IoD Range'] = +pins['Digistump Oak'] = +pins['WiFiduino'] = +pins['Amperka WiFi Slot'] = +pins['Seeed Wio Link'] = +pins.arduino_esp8266; + +export default pins; \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/template.xml b/mixly/boards/default_src/arduino_esp8266/template.xml new file mode 100644 index 00000000..5d20350b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/template.xml @@ -0,0 +1,3330 @@ +<%= htmlWebpackPlugin.tags.headTags.join('\n') %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000000 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + 1 + + + + + 10 + + + + + 1 + + + + + + + + + 1 + + + 1000 + + + + + + + + 1000 + + + + + 1 + + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + item + + + + + ++ + + + item + + + + + + + + + + + + + + + 1 + + + + + 2 + + + + + + + 997 + + + millis + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + + + 1 + + + + + 100 + + + + + 1 + + + + + 1000 + + + + + + + + + + + + + + + + + + + + + hello + + + a + + + + + Hello + + + + + Mixly + + + + + + + A + + + + + B + + + + + C + + + + + + + 123 + + + + + + + Mixly + + + + + y + + + + + + + substring + + + + + 0 + + + + + 3 + + + + + + + 6.666 + + + + + 2 + + + + + + + String + + + + + + + String + + + + + s + + + + + Q + + + + + + + String + + + + + + + substring + + + + + substring + + + + + + + substring + + + + + + + 0xff0000 + + + + + + + 223 + + + + + a + + + + + 0 + + + + + + + hello + + + + + + + hello + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + mylist + + + + + int + mylist + + + + + + 0 + + + + + 1 + + + + + 2 + + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + + + + + + + mylist + + + + + 2 + + + + + 2 + + + + + {0,0},{0,0} + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + mylist + + + + + 0 + + + + + 0 + + + + + + + + + + + + + + + 9600 + + + + + + + + + + + + + 0 + + + + + + + + + + + a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0x77 + + + + + + + 10000 + + + + + 3950 + + + + + 10000 + + + + + + + 0x5A + + + + + + + + + + + 2 + + + + + 4 + + + + + 5 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + + + + + + + + + + + + + + + + + 120 + + + + + + + 1992 + + + + + + + 2 + + + + + 4 + + + + + + + + + 0 + + + + + + + + + + 2 + + + + + 3 + + + + + 4 + + + + + + + SDA + + + + + SCL + + + + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + Jan/01/2020 + + + + + 2020 + + + + + 1 + + + + + 1 + + + + + + + 12:34:56 + + + + + 8 + + + + + 0 + + + + + 0 + + + + + + + + + + + + + 0 + + + + + 2 + + + + + 4 + + + + + 5 + + + + + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + + + + + + + + + + + + + + + 4800 + + + + + WHILE + + + + + + + + + + + + + location + + + + + Serial + + + location.lat + + + + + Serial + + + location.lng + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + + + 5 + + + + + 12 + + + + + 100 + + + + + + + 5 + + + + + 4 + + + + + 100 + + + + + + + 100 + + + + + + + + + 100 + + + + + + + 0 + + + + + 0 + + + + + + + 1500 + + + + + + + + 2 + + + + + 4 + + + + + 100 + + + + + 10 + + + + + + + 2 + + + + + 4 + + + + + 5 + + + + + 12 + + + + + 100 + + + + + 10 + + + + + + + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 2 + + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + + + 4 + + + + 5 + + + + 20 + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + + + + + 0 + + + + + + + + + + 1000 + + + + + mySerial + + + + + + + + + + + + + mySerial + + + 9600 + + + + + myPlayer + + + mySerial + + + + + + + + + + + 500 + + + + + + + 15 + + + + + + + myPlayer + + + 0 + + + DFPLAYER_EQ_NORMAL + + + + + myPlayer + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + + + 1 + + + + + + + myPlayer + readFileCounts + + + 2 + + + DFPLAYER_DEVICE_SD + + + + + + + 1 + + + + + + + + + #ff0000 + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + 4 + + + + + + + 20 + + + + + + + 1 + + + + + + + + + + + 0 + + + + + 0 + + + + + 0 + + + + + + + + + 1 + + + + + 0 + + + + + 255 + + + + + 255 + + + + + + + + + 20 + + + + + + + 20 + + + + + + + + + clear + + + + + abcd + + + + + + + + + + 20 + + + + + + + + 2345 + + + + + + + 12 + + + + + 30 + + + + + + + + + 0x27 + + + + + 0 + 2 + 4 + 5 + 12 + 13 + + + + + + + + + + + + + + + + + 1 + + + + + 1 + + + + + + + + + + mylcd + 0 + + + 1 + + + + + 1 + + + + + + + + + clear + + + + + + + 0x3C + + + + + + + + + + + + + + SSD1306_128X64_NONAME + U8G2_R0 + + + + + + + + + + + + U8G2_R0 + + + + + + + + + + + + + + + + + + + + + + + + page1 + + + + + + + 0 + + + + + 20 + + + + + 1234 + + + + + + + + + + bitmap + 96 + TRUE + + + 1 + 2 + 2 + STHeiti + 16 + 48 + 16 + 米思齐 + + + + + + + 0 + + + + + 0 + + + + + 128 + + + + + 64 + + + + + bitmap1 + + + + + + + + 100 + + + + + + + 20 + + + + + 0 + + + + + + + 0 + + + + + 20 + + + + + + + 64 + + + + + 32 + + + + + + + 1 + + + + + 1 + + + + + 15 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 30 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + + + 1 + + + + + 1 + + + + + 10 + + + + + 20 + + + + + 3 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + + + 30 + + + + + 30 + + + + + 6 + + + + + 15 + + + + + + + 14 + + + + + 55 + + + + + 45 + + + + + 33 + + + + + 8 + + + + + 43 + + + + + + + + + + + + + 12 + + + + + + + + + 1 + + + + + 1 + + + + + + + SCL + + + + + + + 1 + + + + + 1 + + + + + + + + + + 1 + + + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + + + Mixly + + + + + 300 + + + + + + + Mixly + + + + + + + 0 + + + + + + + + + + + + + + 5 + + + + + + + + + + + ir_item + + + 0 + + + + + Serial + println + HEX + + + ir_item + + + + + + + + + + + + + + + + + 32 + + + + + + + + + 0 + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + 1 + + + + + mylist + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + + + fileName.txt + + + + + hello world + + + + + TRUE + + + + + + + + + 0 + + + + + 0 + + + + + + + 0 + + + + + item + + + + + + + + + + + ssid + + + + + password + + + + + + + + + + + + ntp1.aliyun.com + + + + + 8 + + + + + 600 + + + + + + + + 30:AE:A4:58:9D:7C + + + + + + + random + + + + + Mixly + + + + + 1 + + + + + 100 + + + + + + + + + Serial + + + Sent with success + + + + + + + Serial + + + Error sending the data + + + + + + + + + Serial + + + message + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + http://jsonplaceholder.typicode.com/posts/1 + + + + + {\"name\":\"Mixly\"} + + + + + Serial + + + Request_result + + + + + + + Serial + + + Invalid response! + + + + + + + + + + + 0 + + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + wifi-ssid + + + + + wifi-pass + + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + + + + + + + + d9efdd0413ec4b74ab0057a0b8675654 + + + + + + + + + + + + + + + V0 + + + Serial + + + vpin_value + + + + + + + + + + + + 1000 + + + + + V0 + + + 0 + + + + + + + + + + + + + #ff0000 + + + + + + + + + + 0 + + + + + + + + + #ff0000 + + + + + + + example@blynk.cc + + + + + Subject + + + + + Content + + + + + + + Notify + + + + + V0 + + + Serial + + + terminal_text + + + + + + + + + + + Hello,World! + + + + + V0 + + + Serial + + + hour + + + + + Serial + + + minute + + + + + Serial + + + second + + + + + + + + + + + + + V0 + + + 0 + + + + + 0 + + + + + 923 + + + + + + + + + http://yourvideostream.url + + + + + + + Test row + + + + + hello + + + + + V0 + + + Serial + + + index + + + + + Serial + + + selected + + + + + + + + + V0 + + + Serial + + + indexFrom + + + + + Serial + + + indexTo + + + + + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + Name + + + + + John + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + BLYNK_CONNECTED + + + V0 + + + n2KlfPGDyjDBluNi1G9DG5OEjqDT996L + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + BLYNK_CONNECTED + + + + + 10 + + + + + + + + + V0 + + + action + String + + + + + + + + + + + EQ + + + action + + + + + play + + + + + + + play(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + stop + + + + + + + pause(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + next + + + + + + + next(); + + + 4 + + + + + 5 + + + + + + + EQ + + + action + + + + + prev + + + + + + + prev(); + + + 4 + + + + + 5 + + + + + + + + + + + V0 + + + Serial + + + lx + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + V0 + + + Serial + + + x + + + + + Serial + + + y + + + + + Serial + + + z + + + + + + + + + + + + + + + + + V0 + + + + + + + 39.98.114.122 + + + + + 1883 + + + + + ID + + + + + siot + + + + + siot + + + + + + + 120 + + + + + + + Serial + + + + + + + + + + + mixio.mixly.cn + + + + + 1883 + + + + + 12345678@qq.com + + + + + d86d2e60b813590963e2641b44945154 + + + + + test + + + + + + + + text + + + + + Serial + println + + + mqtt_data + + + + + + + + + Hello + + + + + text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/template/board-config-message.html b/mixly/boards/default_src/arduino_esp8266/template/board-config-message.html new file mode 100644 index 00000000..a25b1e5b --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/template/board-config-message.html @@ -0,0 +1,19 @@ +
+
{{-d.title}}
+
+ {{# if (d.message) { }} +

+ {{-d.message}} +

+ {{# } }} + {{# if (d.href === '#') { }} +

{{d.moreInfo}}: {{-d.name}}

+ {{# } else { }} +

{{d.moreInfo}}: {{-d.name}}

+ {{# } }} +
+
\ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/webpack.common.js b/mixly/boards/default_src/arduino_esp8266/webpack.common.js new file mode 100644 index 00000000..4d398c84 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/webpack.common.js @@ -0,0 +1,20 @@ +const path = require('path'); +const common = require('../../../webpack.common'); +const { merge } = require('webpack-merge'); + +module.exports = merge(common, { + resolve: { + alias: { + '@mixly/arduino': path.resolve(__dirname, '../arduino'), + '@mixly/arduino-avr': path.resolve(__dirname, '../arduino_avr') + } + }, + module: { + rules: [ + { + test: /\.(txt|c|cpp|h|hpp)$/, + type: 'asset/source' + } + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/webpack.dev.js b/mixly/boards/default_src/arduino_esp8266/webpack.dev.js new file mode 100644 index 00000000..31d3a078 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/webpack.dev.js @@ -0,0 +1,36 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ESLintPlugin = require('eslint-webpack-plugin'); + +module.exports = merge(common, { + mode: 'development', + devtool: 'source-map', + plugins: [ + new ESLintPlugin({ + context: process.cwd(), + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: false + }) + ], + devServer: { + https: true, + port: 8080, + host: '0.0.0.0', + hot: false, + static: { + directory: path.join(process.cwd(), '../../../'), + watch: false + }, + devMiddleware: { + index: false, + publicPath: `/boards/default/${path.basename(process.cwd())}`, + writeToDisk: true + } + } +}); \ No newline at end of file diff --git a/mixly/boards/default_src/arduino_esp8266/webpack.prod.js b/mixly/boards/default_src/arduino_esp8266/webpack.prod.js new file mode 100644 index 00000000..331b45f4 --- /dev/null +++ b/mixly/boards/default_src/arduino_esp8266/webpack.prod.js @@ -0,0 +1,27 @@ +const path = require('path'); +const common = require('./webpack.common'); +const { merge } = require('webpack-merge'); +const TerserPlugin = require('terser-webpack-plugin'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = merge(common, { + mode: 'production', + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + extractComments: false, + }), + new HtmlWebpackPlugin({ + inject: false, + template: path.resolve(process.cwd(), 'template.xml'), + filename: 'index.xml', + minify: { + removeAttributeQuotes: true, + collapseWhitespace: true, + removeComments: true, + } + }) + ] + } +}); \ No newline at end of file diff --git a/mixly/boards/index.html b/mixly/boards/index.html new file mode 100644 index 00000000..c7f5e0fa --- /dev/null +++ b/mixly/boards/index.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/mixly/package.json.nw b/mixly/package.json.nw new file mode 100644 index 00000000..2a2e8b35 --- /dev/null +++ b/mixly/package.json.nw @@ -0,0 +1,71 @@ +{ + "name": "Mixly", + "version": "3.0.0", + "description": "Mixly,A Visual Program IDE for K12", + "repository": "", + "node-main": "./static-server/server.js", + "main": "http://localhost:7000", + "node-remote": "http://localhost:7000", + "user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari) NWjs/%nwver", + "chromium-args": "--user-data-dir=./nw_cache/ --disk-cache-size=0 --media-cache-size=0", + "webkit": { + "page-cache": false + }, + "scripts": { + "start": "nw .", + "build:nw:win:x64": "build --tasks win-x64 --mirror https://npmmirror.com/mirrors/nwjs/ .", + "build:nw:win:x86": "build --tasks win-x86 --mirror https://npmmirror.com/mirrors/nwjs/ .", + "build:nw:linux:x64": "build --tasks linux-x64 --mirror https://npmmirror.com/mirrors/nwjs/ . && chmod -R 777 ./dist", + "build:nw:mac:x64": "build --tasks mac-x64 --mirror https://npmmirror.com/mirrors/nwjs/ .", + "build:nw:mac:arm64": "build --tasks mac-arm64 --mirror https://npmmirror.com/mirrors/nwjs/ .", + "build:boards:all": "node scripts/build-boards.js --type all", + "build:boards:arduino": "node scripts/build-boards.js --type arduino", + "build:boards:micropython": "node scripts/build-boards.js --type micropython", + "build:boards:python": "node scripts/build-boards.js --type python" + }, + "window": { + "icon": "common/media/mixly.png", + "position": "center" + }, + "keywords": [ + "NW.js", + "server" + ], + "author": "Mixly TEAM", + "license": "other", + "build": { + "nwVersion": "0.96.0" + }, + "devDependencies": { + "nw": "0.96.0-sdk", + "nwjs-builder-phoenix": "^1.15.0" + }, + "dependencies": { + "adm-zip": "^0.5.16", + "axios": "^0.27.2", + "commander": "^11.1.0", + "copy-webpack-plugin": "^13.0.1", + "css-loader": "^6.8.1", + "eslint": "^8.51.0", + "eslint-webpack-plugin": "^4.0.1", + "express": "^4.18.1", + "fs": "^0.0.1-security", + "fs-extra": "^11.3.2", + "fs-plus": "^3.1.1", + "html-loader": "^4.2.0", + "html-webpack-plugin": "^5.6.4", + "http": "^0.0.1-security", + "mini-css-extract-plugin": "^2.9.4", + "minimist": "^1.2.5", + "postcss-loader": "^7.3.3", + "shortid": "^2.2.16", + "path": "^0.12.7", + "shelljs": "^0.10.0", + "url": "^0.11.0", + "webpack": "^5.89.0", + "webpack-bundle-analyzer": "^4.9.1", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^4.15.1", + "webpack-merge": "^6.0.1" + } +}