diff --git a/ardublockly/CanvasDataStructures.js b/ardublockly/CanvasDataStructures.js new file mode 100644 index 0000000000..9b6fb40f7f --- /dev/null +++ b/ardublockly/CanvasDataStructures.js @@ -0,0 +1,98 @@ +//************************************************************************* +//* +//* GLOBAL VARIBALES FOR COMPONENTS +//* +//************************************************************************* + +var g_arrayGrid = []; +var g_Canvas = document.getElementById("canvas"), g_BlankCanvasClone = document.createElement('canvas'); +var g_CanvasContext = null, g_BlankCanvasCloneContext = null; +var g_DrawSpace = document.getElementById("draw_space"); +var g_pointCanvasScrollPos = new CPoint(0, 0); +var g_nGridSize = 10; + +if (g_Canvas != null) +{ + g_CanvasContext = g_Canvas.getContext("2d"); + if (g_CanvasContext == null) + alert("Could not get canvas context object for 'canvas'!"); +} +else + alert("Could not get canvas object for 'canvas'!"); + +if (g_BlankCanvasClone != null) +{ + g_BlankCanvasClone.width = g_Canvas.width; + g_BlankCanvasClone.height = g_Canvas.height; + g_BlankCanvasCloneContext = g_BlankCanvasClone.getContext("2d"); + if (g_BlankCanvasCloneContext == null) + alert("Could not get canvas context object for 'clone canvas'!"); +} +else + alert("Could not get canvas object for 'canvas'!"); + +if (g_DrawSpace == null) + alert("Could not get div object for 'draw_space'!"); + + + + +//************************************************************************* +//* +//* SCROLL TO MIDDLE OF CANVAS ON START UP +//* +//************************************************************************* + +function doScrollToMiddle() +{ + if (g_DrawSpace) + { + g_DrawSpace.scrollTop = g_Canvas.height / 2; + g_pointCanvasScrollPos = new CPoint(0, g_Canvas.height / 2); + } +} + + + + + +//************************************************************************* +//* +//* ERASE THE CANVAS AND CREATE THE GRID +//* +//************************************************************************* + +function doCreateGrid() +{ + var nX = 0, nY = 0; + + if (g_Canvas != null) + { + for (nY = 0; nY < g_Canvas.offsetHeight; nY += g_nGridSize) + { + for (nX = 0; nX < g_Canvas.offsetWidth; nX += g_nGridSize) + g_arrayGrid.push(new CPoint(nX, nY)); + } + } +} + +function doDrawCanvasGrid(Context, nWidth, nHeight) +{ + if (g_arrayGrid.length == 0) + doCreateGrid() + if (Context != null) + { + Context.clearRect(0, 0, nWidth, nHeight); + Context.fillStyle = "#000000"; + Context.beginPath(); + for (let nI = 0; nI < g_arrayGrid.length; nI++) + Context.fillRect(g_arrayGrid[nI].m_nX, g_arrayGrid[nI].m_nY, 1, 1); + } +} + +function doEraseCanvas() +{ + g_CanvasContext.clearRect(0, 0, g_Canvas.offsetWidth, g_Canvas.offsetHeight); + g_CanvasContext.drawImage(g_BlankCanvasClone, 0, 0); +} + diff --git a/ardublockly/CodeDataStructures.js b/ardublockly/CodeDataStructures.js new file mode 100644 index 0000000000..b61ded6db9 --- /dev/null +++ b/ardublockly/CodeDataStructures.js @@ -0,0 +1,1234 @@ +//************************************************************************* +//* +//* CODE CLASSES +//* +//************************************************************************* + +var g_strIndent = "    "; + +class CLiteral +{ + constructor() + { + this.m_strType = ""; + this.m_strValue = ""; + this.m_strKINDOF = "LITERAL"; + }; + + init(strType, strValue) + { + this.m_strType = strType; + this.m_strValue = strValue; + }; + + evaluate() + { + var Value = null; + + if (isArduinoConstant(this.m_strValue)) + Value = this.m_strValue; + else if (this.m_strType == "char") + Value = this.m_strValue[0]; + else if ((this.m_strType == "boolean") || (this.m_strType == "bool")) + { + if ((this.m_strValue == "true") || (this.m_strValue == "1")) + Value = true; + else if ((this.m_strValue == "false") || (this.m_strValue == "0")) + Value = false; + } + else if (this.m_strType == "float") + Value = parseFoat(this.m_strValue); + else if (this.m_strType == "String") + Value = this.m_strValue; + else + Value = parseInt(this.m_strValue, 10); + + return Value; + } + + setValue(strValue) + { + this.m_strValue = strValue; + } + + getType() + { + return this.m_strType; + } + + getValue() + { + return this.m_strValue; + } + + isEmpty() + { + return (this.m_strType == "") && (this.m_strValue == ""); + } + + toString() + { + return this.m_strValue; + } + +}; + +class CVariable +{ + constructor() + { + this.m_strName = ""; + this.m_strType = ""; + this.m_strValue = null; + this.m_strKINDOF = "VARIABLE"; + } + + init(strName, strType, strValue) + { + this.m_strName = strName; + this.m_strType = strType; + this.m_strValue = strValue; + } + + evaluate() + { + var Value = null; + + if (this.m_strType == "char") + Value = this.m_strValue[0]; + else if (this.m_strType == "boolean") + { + if ((this.m_strValue == "true") || (this.m_strValue == "1")) + Value = true; + else if ((this.m_strValue == "false") || (this.m_strValue == "0")) + Value = false; + } + else if (this.m_strType == "float") + Value = parseFoat(this.m_strValue); + else if (this.m_strType == "String") + Value = this.m_strValue; + else + Value = parseInt(this.m_strType[0], 10); + + return Value; + } + + setValue(strValue) + { + this.m_strValue = strValue; + } + + getType() + { + return this.m_strType; + } + + getName() + { + return this.m_strName; + } + + getValue() + { + return this.m_strValue; + } + + isEmpty() + { + return (this.m_strName == "") && (this.m_strType == "") && (this.m_strValue == ""); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + if (strNewLine == "") + strText = this.m_strName; + else + strText = strIndent + this.m_strType + " " + this.m_strName + " = " + this.m_strValue + ";" + strNewLine; + + return strText; + } + + evaluate() + { + var nI = g_arrayGlobalVariables.indexOf(this.m_strName); + var strValue = ""; + + if (nI > -1) + strValue = g_arrayGlobalVariables.getValue(nI); + else + strValue = this.m_strValue; + + return strValue; + } + +}; + +class CVariableArray +{ + constructor() + { + this.m_arrayVariables = []; + this.m_strKINDOF = "VARIABLE ARRAY"; + } + + add(Variable) + { + this.m_arrayVariables[this.m_arrayVariables.length] = Variable; + } + + getLength() + { + return this.m_arrayVariables.length; + } + + setValue(nI, Value) + { + if ((nI < 0) ||(nI >= this.m_arrayVariables.length)) + alert("ERROR: CVariableArray:setValue, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + else + this.m_arrayVariables[nI].setValue(Value); + } + + getValue(nI) + { + var nResult = 0; + + if ((nI < 0) ||(nI >= this.m_arrayVariables.length)) + alert("ERROR: CVariableArray:getValue, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + else + nResult = this.m_arrayVariables[nI].getValue(); + + return nResult; + } + + evaluate(nI) + { + var nResult = 0; + + if ((nI < 0) ||(nI >= this.m_arrayVariables.length)) + alert("ERROR: CVariableArray:evaluate, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + else + nResult = this.m_arrayVariables[nI].evaluate(); + + return nResult; + } + + getType(nI) + { + var nResult = 0; + + if ((nI < 0) ||(nI >= this.m_arrayVariables.length)) + alert("ERROR: CVariableArray:getType, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + else + nResult = this.m_arrayVariables[nI].getType(); + + return nResult; + } + + find(strName) + { + var Variable = null; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strName == this.m_arrayVariables[nI].getName()) + { + Variable = this.m_arrayVariables[nI]; + break; + } + } + return Variable; + } + + indexOf(strName) + { + var nIndex = -1; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strName == this.m_arrayVariables[nI].getName()) + { + nIndex = nI; + break; + } + } + return nIndex; + } + + isEmpty() + { + return this.m_arrayVariables.length == 0; + } + + toString(strNewLine, strIndent) + { + var strValues = ""; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strNewLine.length > 0) + strValues += this.m_arrayVariables[nI].toString(strNewLine, strIndent); + else + { + strValues += this.m_arrayVariables[nI].toString("", ""); + if (nI < (this.m_arrayVariables.length - 1)) + strValues += ", "; + } + + } + return strValues; + } + +}; + +class CExpression +{ + constructor() + { + this.m_Arg1 = null; + this.m_Arg2 = null; + this.m_strOperator = ""; + this.m_strKINDOF = "EXPRESSION"; + } + + init(Arg1, Arg2, strOperator) + { + this.m_Arg1 = Arg1; + this.m_Arg2 = Arg2; + this.m_strOperator = strOperator; + } + + setArg1(Arg1) + { + this.m_Arg1 = Arg1; + } + + setArg2(Arg2) + { + this.m_Arg2 = Arg2; + } + + getArg1() + { + return this.m_Arg1; + } + + getArg2() + { + return this.m_Arg2; + } + + setOperator(strOperator) + { + this.m_strOperator = strOperator; + } + + isSimple() + { + return this.m_strOperator == ""; + } + + evaluate() + { + var Result + + if (this.m_strOperator == "!") + Result = !this.m_Arg2.evaluate(); + else if (this.m_strOperator == "+") + Result = this.m_Arg1.evaluate(); + else if (this.m_strOperator == "-") + Result = -1 * this.m_Arg1.evaluate(); + else if (this.m_strOperator == "") + Result = this.m_Arg1.evaluate(); + else if (this.m_strOperator == "==") + Result = this.m_Arg1.evaluate() == this.m_Arg2.evaluate(); + else if (this.m_strOperator == "!=") + Result = this.m_Arg1.evaluate() != this.m_Arg2.evaluate(); + else if (this.m_strOperator == ">") + Result = this.m_Arg1.evaluate() > this.m_Arg2.evaluate(); + else if (this.m_strOperator == ">=") + Result = this.m_Arg1.evaluate() >= this.m_Arg2.evaluate(); + else if (this.m_strOperator == "<") + Result = this.m_Arg1.evaluate() < this.m_Arg2.evaluate(); + else if (this.m_strOperator == "<=") + Result = this.m_Arg1.evaluate() <= this.m_Arg2.evaluate(); + else if (this.m_strOperator == "+") + Result = this.m_Arg1.evaluate() + this.m_Arg2.evaluate(); + else if (this.m_strOperator == "-") + Result = this.m_Arg1.evaluate() - this.m_Arg2.evaluate(); + else if (this.m_strOperator == "*") + Result = this.m_Arg1.evaluate() * this.m_Arg2.evaluate(); + else if (this.m_strOperator == "/") + Result = this.m_Arg1.evaluate() / this.m_Arg2.evaluate(); + + return Result; + } + + isEmpty() + { + return (this.m_Arg1 == null) && (this.m_strOperator == "") && (this.m_Arg2 == null); + } + + hasArg1() + { + return this.m_Arg1 != null; + } + + isComplete() + { + return (this.m_Arg1 != null) && (this.m_strOperator != "") && (this.m_Arg2 != null); + } + + toString() + { + var strExpression = ""; + + if ((this.m_Arg1 == null) && (this.m_Arg2 != null)) + { + if ((this.m_strOperator == "!") || (this.m_strOperator == "-") || (this.m_strOperator == "+")) + strExpression = this.m_strOperator + this.m_Arg2.toString("", ""); + else + doErrorMessage("CExpression::toString, unexptected operator for argument 2 '" + this.m_strOperator + "'!"); + } + else if ((this.m_Arg1 != null) && (this.m_Arg2 == null) && (this.m_strOperator == "")) + { + strExpression = this.m_Arg1.toString("", ""); + } + else if ((this.m_Arg1 != null) && (this.m_Arg2 != null) && (this.m_strOperator != "")) + { + strExpression = "(" + this.m_Arg1.toString("", "") + " " + this.m_strOperator + " " + this.m_Arg2.toString("", "") + ")"; + } + else + doErrorMessage("CExpression::toString!"); + + return strExpression; + } + +}; + +class CVariableStatement +{ + constructor() + { + this.m_strVariableName = null; + this.m_strOperator = ""; + this.m_Expression = null; + this.m_strKINDOF = "VARIABLE STATEMENT"; + } + + init(strVariableName, strOperator, Expression) + { + this.m_strVariableName = strVariableName; + this.m_strOperator = strOperator; + this.m_Expression = Expression; + } + + getName() + { + return this.m_strVariableName; + } + + getOperator() + { + return this.m_strOperator; + } + + getName() + { + return this.m_strVariableName; + } + + evaluate() + { + var NewValue = this.m_Expression.evaluate(), + OldValue = g_arrayGlobalVariables.find(this.strVariableName); + + if (this.m_strOperator == "=") + g_arrayGlobalVariables.setValue(this.strVariableName, NewValue); + else if (this.m_strOperator == "+=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue + NewValue); + else if (this.m_strOperator == "-=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue - NewValue); + else if (this.m_strOperator == "*=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue * NewValue); + else if (this.m_strOperator == "/=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue / NewValue); + else if (this.m_strOperator == "&=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue & NewValue); + else if (this.m_strOperator == "|=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue | NewValue); + else + alert("ERROR: CVariableStatement::evaluate, invalid operator '" + this.m_strOperator + "'!"); + } + + isEmpty() + { + return (this.m_strVariableName == "") && (this.m_strOperator == "") && this.m_Expression.isEmpty(); + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + this.m_strVariableName + " " + this.m_strOperator + " "; + + if (this.m_Expression == null) + strText += "null" + ";" + strNewLine; + else + strText += this.m_Expression.toString("", "") + ";" + strNewLine; + + return strText; + } + + evaluate() + { + var nIndex = g_arrayGlobalVariables.indexOf(this.m_strVariableName); + var nCurrentValue = 0; + var nNewValue = this.m_Expression.evaluate(); + + if (nIndex > -1) + { + nCurrentValue = g_arrayGlobalVariables.getValue(nIndex); + + if (this.m_strOperator == "=") + g_arrayGlobalVariables.setValue(nIndex, nNewValue); + else if (this.m_strOperator == "+=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue + nNewValue); + else if (this.m_strOperator == "-=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue - nNewValue); + else if (this.m_strOperator == "*=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue * nNewValue); + else if (this.m_strOperator == "/=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue / nNewValue); + else if (this.m_strOperator == "|=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue | nNewValue); + else if (this.m_strOperator == "&=") + g_arrayGlobalVariables.setValue(nIndex, nCurrentValue & nNewValue); + } + } + +}; + +class CStatementArray +{ + constructor() + { + this.m_arrayStatements = []; + this.m_strKINDOF = "STATEMENT ARRAY"; + }; + + getLength() + { + return this.m_arrayStatements.length; + } + + get(nIndex) + { + var Statement = null; + + if ((nIndex >= 0) && (nIndex < this.m_arrayStatements.length)) + Statement = this.m_arrayStatements[nIndex]; + + return Statement; + } + + add(Statement) + { + this.m_arrayStatements.push(Statement); + }; + + isEmpty() + { + return this.m_arrayStatements.length == 0; + } + evaluate() + { + for (let nI = 0; nI < this.m_arrayStatements.length; nI++) + m_arrayStatements.evaluate(); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayStatements.length; nI++) + { + strText += this.m_arrayStatements[nI].toString(strNewLine, strIndent); + } + return strText; + } + +}; + +class CForStatement +{ + constructor() + { + this.m_strCounterVarName = ""; + this.m_ExpressionStart = null; + this.m_ExpressionEnd = null; + this.m_ExpressionContinue = null; + this.m_strOperator = ""; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "FOR"; + } + + init(strCounterVarName, ExpressionStart, ExpressionEnd, ExpressionContinue, strOperator, arrayStatements) + { + this.m_strCounterVarName = strCounterVarName; + this.m_ExpressionStart = ExpressionStart; + this.m_ExpressionEnd = ExpressionEnd; + this.m_ExpressionContinue = ExpressionContinue; + this.m_strOperator = strOperator; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + for (let nI = this.m_ExpressionStart.evaluate(); nI < this.m_ExpressionContinue.m_ExpressionEnd(); n += this.m_ExpressionContinue.evaluate()) + { + strReturnVal = this.m_arrayStatements.evaluate(); + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "for (" + this.m_strCounterVarName + " = " + this.m_ExpressionStart.toString("", "") + "; " + + this.m_strCounterVarName + " " + this.m_strOperator + " " + this.m_ExpressionEnd.toString("", "") + "; " + + this.m_strCounterVarName + this.m_ExpressionContinue + ")" + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + + return strText; + } + +} + +class CWhileStatement +{ + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "WHILE"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + while (this.m_Expression.evaluate()) + { + strReturnVal = this.m_arrayStatements.evaluate(); + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "while " + this.m_Expression.toString("", "") + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + + return strText; + } +} + +class CRepeatStatement +{ + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "REPEAT"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + do + { + strReturnVal = this.m_arrayStatements.evaluate(); + + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + while (this.m_Expression.evaluate()); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "do" + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + strText += strIndent + "while " + this.m_Expression.toString("", "") + ";" + strNewLine; + + return strText; + } +} + +class CBreak +{ + constructor() + { + this.m_strKINDOF = "BREAK"; + } + + evaluate() + { + return "break"; + } + + toString(strNewLine, strIndent) + { + return strIndent + "break" + strNewLine; + } + +} + +class CCaseArray +{ + constructor() + { + this.m_Expression = null; + this.m_arrayCases = []; + this.m_strKINDOF = "CASE ARRAY"; + } + + getLength() + { + this.m_arrayCases.length; + } + + add(Case) + { + this.m_arrayCases.push(Case); + }; + + isEmpty() + { + return this.m_arrayCases.length == 0; + } + evaluate() + { + for (let nI = 0; nI < this.m_arrayCases.length; nI++) + m_arrayCases.evaluate(); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayCases.length; nI++) + { + strText += this.m_arrayCases[nI].toString(strNewLine, strIndent); + } + return strText; + } +} + +class CSwitchCase +{ + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "CASE"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + setExpression(Expression) + { + this.m_Expression = Expression; + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + "case "; + + strText += this.m_Expression.toString("", ""); + strText += ":" + strNewLine + strIndent + "{" + strNewLine + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent) + strText += strIndent + "}" + strNewLine + strNewLine; + + return strText; + } +} + +class CSwitchStatement +{ + constructor() + { + this.m_Expression = null; + this.m_arrayCases = new CCaseArray(); + this.m_arrayDefaultStatements = null; + this.m_strKINDOF = "SWITCH"; + } + + init(Expression, arrayCases) + { + this.m_Expression = Expression; + this.m_m_arrayCases = arrayCases; + this.m_arrayDefaultStatements = null; + } + + setDefault(arrayDefaultStatements) + { + this.m_arrayDefaultStatements = arrayDefaultStatements; + } + + setExpression(Expression) + { + this.m_Expression = Expression; + } + + setCases(arrayCases) + { + this.m_arrayCases = arrayCases; + } + + addCase(Case) + { + this.m_arrayCases.add(Case); + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + "switch ("; + + strText += this.m_Expression.toString("", ""); + strText += ")" + strNewLine + strIndent + "{" + strNewLine; + strText += this.m_arrayCases.toString(strNewLine, strIndent + g_strIndent); + if (this.m_arrayDefaultStatements != null) + { + strText += strIndent + g_strIndent + "default:" + strNewLine; + strText += strIndent + g_strIndent + "{" + strNewLine; + strText += this.m_arrayDefaultStatements.toString(strNewLine, strIndent + g_strIndent + g_strIndent); + strText += strIndent + g_strIndent + "}" + strNewLine; + } + strText += strIndent + "}" + strNewLine; + + return strText; + } +} + +class CIfStatement +{ + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_Next = null; + this.m_strKINDOF = "IF"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + this.m_Next = null; + } + + setKindOf(strKindOf) + { + this.m_strKINDOF = strKindOf; + } + + getNext() + { + return this.m_Next; + } + + setNext(Next) + { + this.m_Next = Next; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + if (this.m_Expression != null) + { + if (this.m_strKINDOF == "IF") + { + strText = strIndent + "if " + this.m_Expression.toString("", "") + strNewLine; + } + else if (this.m_strKINDOF == "ELSE IF") + { + strText = strIndent + "else if " + this.m_Expression.toString("", "") + strNewLine; + } + } + else + strText = strIndent + "else" + strNewLine; + + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + if (this.m_Next != null) + strText += this.m_Next.toString(strNewLine, strIndent); + + return strText; + } +} + +class CFunction +{ + constructor() + { + this.m_strFunctionName = ""; + this.m_strReturnType = ""; + this.m_arrayParams = new CVariableArray(); + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "FUNCTION"; + } + + init(strFuncName, strReturnType, arrayParams, arrayStatements) + { + this.m_strFunctionName = strFuncName; + this.m_strReturnType = strReturnType; + this.m_arrayParams = arrayParams; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + setStatementList(arrayStatement) + { + this.m_arrayStatements = arrayStatement; + } + + addParam(Param) + { + this.m_arrayParams.add(Param); + } + + setStatementList(arrayParams) + { + this.m_arrayStatements = arrayParams; + } + + getName() + { + return this.m_strFunctionName; + } + + getParam(nI) + { + var Param = null; + + if (nI >= this.m_arrayParams.getLength()) + alert("ERROR: CFunction::getParam, '" + nI + "' is an invalid parameter number (" + this.m_arrayParams.getLength() + ")!"); + else + { + Param = this.m_arrayParams[nI]; + } + return Param; + } + + evaluate() //(...) + { + for (let nI = 0; nI < arguments.length; nI++) + { + if (nI < this.m_arrayParams.getLength()) + this.m_arrayParams.setValue(nI, arguments[nI]); + } + for (let nI = 0; nI < this.m_arrayStatements.getLength(); nI++) + { + this.m_arrayStatements.get(nI).evaluate(); + } + } + + isEmpty() + { + return (this.m_strFunctionName == "") && (this.m_strReturnType == "") && this.m_arrayParams.isEmpty() && this.m_arrayStatements.isEmpty(); + } + + toString(strNewLine, strIndent) + { + var strText = this.m_strReturnType + " " + this.m_strFunctionName + "(" + this.m_arrayParams.toString("", "") + ")"; + strText += strNewLine + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += "}" + strNewLine; + + return strText; + } + +}; + +class CFunctionArray +{ + constructor() + { + this.m_arrayFunctions = []; + this.m_strKINDOF = "FUNCTION ARRAY"; + } + + add(strName, arrayParams, arrayStatements) + { + var Function = new CFunction() + Function.init(strName, arrayParams, arrayStatements); + this.add(Function); + } + + getLength() + { + return this.m_arrayFunctions.length; + } + + add(Function) + { + this.m_arrayFunctions.push(Function); + } + + find(strName) + { + var Function = null; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + { + if (this.m_arrayFunctions[nI].getName() == strName) + { + Function = this.m_arrayFunctions[nI]; + break; + } + } + return Function; + } + + indexOf(strName) + { + var nIndex = -1; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + { + if (this.m_arrayFunctions[nI].getName() == strName) + { + nIndex = nI; + break; + } + } + return nIndex; + } + + getNameAt(nI) + { + var strName = ""; + + if ((nI >= 0) && (nI < this.m_arrayFunctions.length)) + strName = this.m_arrayFunctions[nI].getName(); + + return strName; + } + + isEmpty() + { + return this.m_arrayFunctions.length == 0; + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + strText += this.m_arrayFunctions[nI].toString(strNewLine, strIndent); + + return strText; + } + +}; + +g_arrayArduinoFunctions = ["Serial.print", "Serial.println", "Serial.begin", "digitalRead", "digitalWrite", + "analogRead", "analogWrite", "pinMode", "setup", "loop", "delay"]; + +function isArduinoFunctionCall(strFuncName) +{ + var bResult = false; + + for (let nI = 0; nI < g_arrayArduinoFunctions.length; nI++) + { + bResult = strFuncName == g_arrayArduinoFunctions[nI]; + if (bResult) + break; + } + return bResult; +} + +class CFunctionCall +{ + constructor() + { + this.m_strFuncName = ""; + this.m_arrayParams = new CVariableArray(); + this.m_strKINDOF = "FUNCTION CALL"; + } + + init(strFuncName) + { + //var Function = g_arrayFunctions.find(strFuncName); + + if ((Function == null) && !isArduinoFunctionCall(strFuncName)) + alert("ERROR: CFunctionCall:init, function '" + strFuncName + "' not found!"); + else + this.m_strFuncName = strFuncName; + } + + addParameter(Parameter) + { + this.m_arrayParams.add(Parameter); + } + + setParameters(arrayParameters) + { + this.m_arrayParams = arrayParameters; + } + + isEmpty() + { + return (this.m_strFunctionName == "") && (this.m_arrayParams.length == 0); + } + + toString(strNewLine, strIndent) + { + var strFuncCall = ""; + + if (strNewLine == "") + { + strFuncCall = this.m_strFuncName + "(" + this.m_arrayParams.toString("") + ")"; + } + else + { + strFuncCall = strIndent + this.m_strFuncName + "(" + this.m_arrayParams.toString("") + ");" + strNewLine; + } + return strFuncCall; + } + + evaluate() + { + var ReturnValue = null; + + if ((this.m_strFuncName == "Serial.print") || (this.m_strFuncName == "Serial.println")) + { + if (this.m_arrayParams.getLength() == 1) + { + if (this.m_arrayParams.getType(0) == "char") + g_SerialMonitor.printText("" + this.m_arrayParams.evaluate(0)); + else if ((this.m_arrayParams.getType(0) == "String") || (this.m_arrayParams.getType(0) == "string")) + g_SerialMonitor.printText(this.m_arrayParams.evaluate(0)); + else if (this.m_arrayParams.getType(0) == "int") + g_SerialMonitor.printInt(this.m_arrayParams.evaluate(0), "DEC"); + } + else if (this.m_arrayParams.getLength() == 2) + { + if (this.m_arrayParams.getType(0) == "int") + g_SerialMonitor.printInt(this.m_arrayParams.evaluate(0), this.m_arrayParams.evaluate(1)); + } + if (this.m_strFuncName == "Serial.println") + g_SerialMonitor.printlnText(""); + } + else if (this.m_strFuncName == "Serial.begin") + { + g_SerialMonitor.begin(this.m_arrayParams.evaluate(0)); + } + else if (this.m_strFuncName == "digitalRead") + { + if (g_mapPlacedComponents.get(g_strMCUName)) + ReturnValue = g_mapPlacedComponents.get(g_strMCUName).digitalRead(this.m_arrayParams.evaluate(0)); + } + else if (this.m_strFuncName == "digitalWrite") + { + if (g_mapPlacedComponents.get(g_strMCUName)) + g_mapPlacedComponents.get(g_strMCUName).digitalWrite(this.m_arrayParams.evaluate(0), this.m_arrayParams.evaluate(1)); + } + else if (this.m_strFuncName == "analogRead") + { + if (g_mapPlacedComponents.get(g_strMCUName)) + ReturnValue = g_mapPlacedComponents.get(g_strMCUName).analogRead(this.m_arrayParams.evaluate(0)); + } + else if (this.m_strFuncName == "analogWrite") + { + if (g_mapPlacedComponents.get(g_strMCUName)) + g_mapPlacedComponents.get(g_strMCUName).analogWrite(this.m_arrayParams.evaluate(0), this.m_arrayParams.evaluate(1)); + } + else if (this.m_strFuncName == "pinMode") + { + if (g_mapPlacedComponents.get(g_strMCUName)) + g_mapPlacedComponents.get(g_strMCUName).pinMode(this.m_arrayParams.evaluate(0), this.m_arrayParams.evaluate(1)); + } + else if (this.m_strFuncName == "delay") + { + if (g_Delay.isExpired()) + g_Delay.set(parseInt(this.m_arrayParams.evaluate(0))); + } + return ReturnValue; + } + +}; + + diff --git a/ardublockly/CodeFormatting.js b/ardublockly/CodeFormatting.js new file mode 100644 index 0000000000..1d028fcb0c --- /dev/null +++ b/ardublockly/CodeFormatting.js @@ -0,0 +1,177 @@ +//************************************************************************* +//* +//* CODE FORMATTING FUNCTIONS +//* +//************************************************************************* + +function doProcessGetData(strNewLine, strSpace) +{ + var strGetData = window.location.search; + var arrayASCII = [["%21", "!"], ["%22", "\""], ["%23", "#"], ["%24", "$"], ["%25", "%"], ["%26", "&"], ["%27", "'"], ["%28", "("], + ["%29", ")"], ["%2A", "*"], ["%2B", "+"], ["%2C", ","], ["%2D", "-"], ["%2E", "."], ["%2F", "/"], ["%3A", ":"], + ["%3B", ";"], ["%3C", "<"], ["%3D", "="], ["%3E", ">"], ["%3F", "?"], ["%40", "@"], ["%5B", "["], ["%5C", "\\"], + ["%5D", "]"], ["%5E", "^"], ["%5F", "_"], ["%60", "`"], ["%7B", "{"], ["%7C", "|"], [ "%7D", "}"], ["%7E", "~"]]; + + strGetData = strGetData.substring(1); + + // void+setup%28%29%0D%0A%7B%0D%0A%7D%0D%0A%0D%0A%0D%0Avoid+loop%28%29%0D%0A%7B%0D%0A++if+%28false%29%0D%0A++%7B%0D%0A++%7D%0D%0A%7D + while (strGetData.includes("%0D%0A")) + strGetData = strGetData.replace("%0D%0A", strNewLine); + + while (strGetData.includes("+")) + strGetData = strGetData.replace("+", strSpace); + + for (let nI = 0; nI < arrayASCII.length; nI++) + { + while (strGetData.includes(arrayASCII[nI][0])) + strGetData = strGetData.replace(arrayASCII[nI][0], arrayASCII[nI][1]); + } + return strGetData; +} + +function doGetCode(strGetData) +{ + var nIndexCode = strGetData.indexOf("Code"), + nIndexBoard = strGetData.indexOf("SelectedBoard"); + var strCode = ""; + + if (nIndexBoard > nIndexCode) + strCode = strGetData.substring(nIndexCode + 5, nIndexBoard - 1); + else + strCode = strGetData.substring(nIndexCode + 5); + + return strCode; +} + +function doGetMCU(strGetData) +{ + var nIndexCode = strGetData.indexOf("Code"), + nIndexBoard = strGetData.indexOf("SelectedBoard"); + var strBoard = ""; + + if (nIndexCode > nIndexBoard) + strBoard = strGetData.substring(nIndexBoard + 14, nIndexCode); + else + strBoard = strGetData.substring(nIndexBoard + 14); + + return strBoard; +} + +function doRemoveComments(strCode) +{ + var nI = 0, nJ = 0; + + while (true) + { + if (strCode.includes("//")) + { + nI = strCode.indexOf("//"); + nJ = strCode.indexOf("\n", nI) + 1; + nI--; + + } + else if (strCode.includes("/*")) + { + nI = strCode.indexOf("/*"); + nJ = strCode.indexOf("*/", nI) + 2; + nI--; + } + else + { + break; + } + if (nI == -1) + { + strCode = strCode.substring(nJ); + } + else + { + strCode = strCode.substring(0, nI) + strCode.substring(nJ); + } + } + return strCode; +} + +function doRemoveNewLines(strCode) +{ + var strTempCode = ""; + + while (strCode.length > 0) + { + if ((strCode.charCodeAt(0) == 10) || (strCode.charCodeAt(0) == 13)) + { + if (isAlphaNumeric(strTempCode.charCodeAt(strTempCode.length - 1)) && isAlphaNumeric(strCode.charCodeAt(1))) + { + strTempCode += " "; + strCode = strCode.substring(1); + } + else + { + strCode = strCode.substring(1); + } + } + else + { + strTempCode += strCode[0]; + strCode = strCode.substring(1); + } + } + return strTempCode; +} + +function doRemoveSpaces(strCode) +{ + var strCodeTemp = ""; + var nI = 0; + + while (nI < strCode.length) + { + if (strCode[nI] != ' ') + { + strCodeTemp += strCode[nI]; + nI++; + } + else if (isAlphaNumeric(strCodeTemp.charCodeAt(strCodeTemp.length - 1)) && isAlphaNumeric(strCode.charCodeAt(nI + 1))) + { + strCodeTemp += strCode[nI]; + nI++; + } + else + nI++; + } + return strCodeTemp; +} + +var g_strGetData = doProcessGetData("\n", " "); +var g_strRawCode = doGetCode(g_strGetData); +var g_strNoComments = doRemoveComments(g_strRawCode); +var g_strNoNewLines = doRemoveNewLines(g_strNoComments); +var g_strNoSpaces = doRemoveSpaces(g_strNoNewLines); +g_strCode = g_strNoSpaces; +var g_strSelectedMCUType = doGetMCU(g_strGetData); + +/* +alert("\n\n============================================\n\nCODE\n\n" + g_strCode + + "\n\n============================================\n\nMCU\n\n" + g_strSelectedMCUType + "\n\n"); +*/ +g_strCode = "bool bState=true;" + + "int nVal=0;" + + "void setup(){" + + "Serial.begin(9600);" + + "Serial.println(\"In setup()...\");" + + "pinMode(10,OUTPUT);" + + "pinMode(11,INPUT);" + + "}" + + "void loop(){" + + "Serial.println(\"In loop()...\");" + + "digitalWrite(10,bState);" + + "bState=!bState;" + + "nVal=digitalRead(11);" + + //"delay(1000);" + + "}"; +g_strSelectedMCUType = "Mega"; + +g_strSelectedMCUType = g_strSelectedMCUType.toUpperCase(); +doParse(g_strCode); + + diff --git a/ardublockly/CodeParsing.js b/ardublockly/CodeParsing.js new file mode 100644 index 0000000000..e468a6261e --- /dev/null +++ b/ardublockly/CodeParsing.js @@ -0,0 +1,1184 @@ +//************************************************************************* +//* +//* CODE PARSING FUNCTIONS +//* +//************************************************************************* + +function doInfiniteLoopErrorMessage(strFunctionName, strCode, strLastCode) +{ + alert("INIFINITE LOOP: function '" + strFunctionName + "'\n\n" + strCode + "\n\n" + strLastCode); + console.log("INIFINITE LOOP: function '" + strFunctionName + "'\n\n" + strCode + "\n\n" + strLastCode); + return strCode; +} + +function doErrorMessage(strMsg) +{ + alert("ERROR: " + strMsg + "\n\n" + g_strCode); + console.log("ERROR: " + strMsg + "\n\n" + g_strCode); + //throw new Error("ERROR: " + strMsg); +} + +function doExpectingErrorMessage(strFuncName, stExpected, strFound) +{ + var strErrorMsg = strFuncName + ", expecting '" + stExpected + "' but found '" + strFound + "'!"; + + doErrorMessage(strErrorMsg); +} + +function doExpectingForErrorMessage(strFuncName, stExpected, strFound, strForFuncName) +{ + var strErrorMsg = strFuncName + ", expecting '" + stExpected + "' but found '" + strFound + "' for function '" + strForFuncName + "!"; + + doErrorMessage(strErrorMsg); +} + +function doUnexpectedErrorMessage(strFuncName, strSymbol) +{ + var strErrorMsg = strFuncName + ", unexpected symbol '" + strSymbol + "' for function '" + strForFuncName + "!"; + + doErrorMessage(strErrorMsg); +} + +function isAlpha(nCharCode) +{ + return ((nCharCode >= 97/* a */) && (nCharCode <= 122/* z */)) || ((nCharCode >= 65/* A */) && (nCharCode <= 90/* Z */)) || (nCharCode == 95/* _ */); +} + +function isAlphaNumeric(nCharCode) +{ + return isAlpha(nCharCode) || ((nCharCode >= 48/* 0 */) && (nCharCode <= 57/* 9 */)); +} + +function isQuote(nCharCode) +{ + return (nCharCode == 34/* " */) || (nCharCode == 39/* ' */); +} + +function isNumeric(nCharCode) +{ + return ((nCharCode >= 97/* a */) && (nCharCode <= 'f')) || ((nCharCode >= 65/* A */) && (nCharCode <= 'F')) || ((nCharCode >= 48/* 0 */) && (nCharCode <= 57/* 9 */)); +} + +function isOperator(nCharCode) +{ + return (nCharCode == 43/* + */) || (nCharCode == 45/* - */) || (nCharCode == 42/* * */) || (nCharCode == 47/* / */) || (nCharCode == 38/* & */) || + (nCharCode == 124/* | */) || (nCharCode == 61/* = */) || (nCharCode == 62/* > */) || (nCharCode == 60/* < */) || (nCharCode == 37/* % */) || + (nCharCode == 33/* ! */); +} + +function doGetNextToken(strExpecting) +{ + var strIdentifier = "", strTemp = "", strOrigCode = g_strCode; + + if ((g_strCode[0] == "\"") || (g_strCode[0] == "'")) + { + strIdentifier = g_strCode[0]; + g_strCode = g_strCode.substring(1); + + while ((g_strCode.charCodeAt(0) != 34/* " */) && (g_strCode.charCodeAt(0) != 39/* ' */)) + { + strIdentifier += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + strIdentifier += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + else + { + while (isAlphaNumeric(g_strCode.charCodeAt(0)) || (g_strCode.charCodeAt(0) == 46/* . */)) + { + strIdentifier += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + g_strCode = g_strCode.trim(); + if (strIdentifier == "else") + { + strTemp = g_strCode.substring(0, 2); + if (strTemp == "if") + { + strIdentifier += " " + strTemp; + g_strCode = g_strCode.substring(2); + } + } + g_strCode = g_strCode.trim(); + + if ((strExpecting != null) && !strIdentifier.includes(strExpecting)) + { + g_strCode = strOrigCode; + strIdentifier = ""; + } + } + return strIdentifier; +} + +function doGetNextStringOrChar() +{ + var strValue = ""; + + while (isAlphaNumeric(g_strCode.charCodeAt(0)) || isQuote(g_strCode.charCodeAt(0))) + { + strValue += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + g_strCode = g_strCode.trim(); + return strValue; +} + +function doGetNextValue(bFloat) +{ + var strIdentifier = ""; + + while (isAlphaNumeric(g_strCode.charCodeAt(0)) || (bFloat && (g_strCode.charCodeAt(0) == 46/* . */))) + { + strIdentifier += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + g_strCode = g_strCode.trim(); + + return strIdentifier; +} + +function doGetNextSymbol(strExpecting) +{ + var strSymbol = ""; + var strOrigCode = g_strCode; + + g_strCode = g_strCode.trim(); + if (!isAlphaNumeric(g_strCode.charCodeAt(0))) + { + strSymbol = g_strCode[0] + g_strCode = g_strCode.substring(1); + g_strCode = g_strCode.trim(); + + if ((strSymbol == "!") || (strSymbol == ";") || (strSymbol == "(") || (strSymbol == ")") || (strSymbol == "{") || (strSymbol == "}") || + (strSymbol == "[") || (strSymbol == "]") || (strSymbol == "?") || (strSymbol == ".") || (strSymbol == ",") || (strSymbol == ":")) + { + // Do nothing + } + else if (strSymbol == "+") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 43/* + */)) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "-") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 45/* - */)) + strSymbol += g_strCode[0]; + + } + else if (strSymbol == "*") + { + if (g_strCode.charCodeAt(0) == 61/* = */) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "/") + { + if (g_strCode.charCodeAt(0) == 61/* = */) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "|") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 124/* | */)) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "&") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 38/* & */)) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "=") + { + if (g_strCode.charCodeAt(0) == 61/* = */) + strSymbol += g_strCode[0]; + } + else if (strSymbol == ">") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 62/* > */)) + strSymbol += g_strCode[0]; + } + else if (strSymbol == "<") + { + if ((g_strCode.charCodeAt(0) == 61/* = */) || (g_strCode.charCodeAt(0) == 60/* < */)) + strSymbol += g_strCode[0]; + } + else + { + alert("ERROR: doGetNextSymbol, unexpected symbol '" + g_strCode[0] + "'!\n\n\n" + g_strCode); + } + if (strSymbol.length == 2) + { + g_strCode = g_strCode.substring(1); + g_strCode = g_strCode.trim(); + } + } + if ((strExpecting != null) && (strSymbol != strExpecting)) + { + g_strCode = strOrigCode; + strSymbol = ""; + } + return strSymbol; +} + +function doParseCases() +{ + var strToken = doGetNextToken("case"), strSymbol = "", strLastCode = g_strCode; + var arrayCases = new CCaseArray(); + var Expression = null; + var Case = null; + var arrayStatements = []; + + while (strToken == "case") + { + //g_strCode = "(" + g_strCode; + //g_strCode = g_strCode.replace(":", "):"); + Expression = doParseExpression(); + strSymbol = doGetNextSymbol(":"); + if (strSymbol == ":") + { + Case = new CSwitchCase(); + arrayStatements = doParseStatements(); + Case.init(Expression, arrayStatements); + arrayCases.add(Case); + } + else + { + doExpectionErrorMessage("doParseCases", ":", strSymbol); + } + strToken = doGetNextToken("case"); + + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseFunctionCallParams", g_strCode, strLastCode); + } + return arrayCases; +} + +function doParseSwitch() +{ + var SwitchStatement = new CSwitchStatement(); + var Expression = doParseExpression(); + var strSymbol = doGetNextSymbol("{"), strToken = ""; + var arrayCases = []; + var arrayDefaultStatements = []; + + SwitchStatement.setExpression(Expression); + + if (strSymbol == "{") + { + arrayCases = doParseCases(); + SwitchStatement.setCases(arrayCases); + strToken = doGetNextToken(); + if (strToken == "default") + { + strOperator = doGetNextSymbol(":"); + arrayDefaultStatements = doParseStatements(); + SwitchStatement.setDefault(arrayDefaultStatements); + } + strSymbol = doGetNextSymbol(); + if (strSymbol != "}") + doExpectingErrorMessage("doParseSwitch", "}", strSymbol); + } + else + { + doExpectingErrorMessage("doParseSwitch", "{", g_strCode[0]); + } + return SwitchStatement; +} + +function doParseIf() +{ + var Expression = doParseExpression(); + var arrayStatements = doParseStatements(); + var IfStatement = new CIfStatement(), IfStatementPrev = null; + var strToken = ""; + var arrayIfStack = []; + + IfStatement.init(Expression, arrayStatements); + arrayIfStack.push(IfStatement); + + do + { + strToken = doGetNextToken("else"); + + if (strToken == "else if") + { + IfStatement = new CIfStatement(); + Expression = doParseExpression(); + arrayStatements = doParseStatements(); + IfStatement.init(Expression, arrayStatements); + IfStatement.setKindOf("ELSE IF"); + arrayIfStack.push(IfStatement); + } + else if (strToken == "else") + { + IfStatement = new CIfStatement(); + arrayStatements = doParseStatements(); + IfStatement.init(null, arrayStatements); + IfStatement.setKindOf("ELSE"); + arrayIfStack.push(IfStatement); + } + else + break; + } + while ((strToken == "else if") || (strToken == "else")); + + while (arrayIfStack.length > 0) + { + IfStatement = arrayIfStack.pop(); + IfStatementPrev = arrayIfStack.pop(); + if (IfStatementPrev != null) + { + IfStatementPrev.setNext(IfStatement); + arrayIfStack.push(IfStatementPrev); + } + } + return IfStatement; +} + +function doParseWhile() +{ + var Expression = doParseExpression(); + var arrayStatements = [] + var WhileStatement = new CWhileStatement(); + + if (g_strCode.charCodeAt(0) == 123) // { + { + arrayStatements = doParseStatements(); + } + else + { + arrayStatements.push(doParseStatement()); + doGetNextSymbol(); // Consume the terminating ; + } + WhileStatement.init(Expression, arrayStatements); + + return WhileStatement; +} + +function doParseRepeat() +{ + var RepeatStatement = new CRepeatStatement(); + var arrayStatements = doParseStatements(); + var strUntil = doGetNextToken(); + var Expression = null; + + if (strUntil == "until") + { + Expression = doParseExpression(); + RepeatStatement.init(Expression, arrayStatements); + doGetNextSymbol(); // Consume the terminating ; or } + } + else + { + alert("ERROR: doParseRepeat, 'until' expected but found '" + strUntil + "'!"); + } + return RepeatStatement; +} + +function doParseFor() +{ + // break +} + +function getInitValue(strType) +{ + var strValue = ""; + + if (strType == "String") + strValue = ""; + else if (strType == 'float') + strValue = "0.0"; + else if ((strType == "boolean") || (strType == "bool")) + strValue = "false"; + else + strValue = "0"; + + return strValue; +} + +function doParseFunctionParams(strFuncName) +{ + var arrayParams = new CVariableArray(); + var Variable = new CVariable(); + var strType = "", strName = "", strLastCode = g_strCode, strSymbol = doGetNextSymbol("("); + + if (strSymbol == "(") + { + do + { + strType = doGetNextToken(); + strName = doGetNextToken(); + + if ((strType != "") && (strName != "")) + { + Variable.init(strName, strType, getInitValue(strType)); + arrayParams.add(Variable); + + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseFunctionParams", g_strCode, strLastCode); + } + } + while ((strType != "") && (strName != "")); + + strSymbol = doGetNextSymbol(); // Consume the closing ) + } + else + doExpectingForErrorMessage("doParseFunctionParams", "(", strSymbol, strFuncName); + + return arrayParams; +} + +function doGetArduinoFunctionParamType(strFuncName, nParamNum) +{ + var strType = ""; + + if (strFuncName == "Serial.begin") + { + if (nParamNum == 0) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else if ((strFuncName == "Serial.print") || (strFuncName == "Serial.println")) + { + if (nParamNum == 0) + strType = "void"; + else if (nParamNum == 1) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else if ((strFuncName == "digitalWrite") || (strFuncName == "analogWrite")) + { + if (nParamNum == 0) + strType = "int"; + else if (nParamNum == 1) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else if ((strFuncName == "digitalRead") || (strFuncName == "analogRead")) + { + if (nParamNum == 0) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else if (strFuncName == "delay") + { + if (nParamNum == 0) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else if (strFuncName == "pinMode") + { + if (nParamNum == 0) + strType = "int"; + else if (nParamNum == 1) + strType = "int"; + else + doErrorMessage("doGetArduinoFunctionParamType, parameter '" + nParamNum + "' not expected for function '" + strFuncName + "'!"); + } + else + { + doErrorMessage("doGetArduinoFunctionParamType, no type available for function '" + strFuncName + "', parameter " + nParamNum + "!"); + } + return strType; +} + +function doGetFunctionCallParamType(strFunctionName, nParamNum) +{ + var Function = g_arrayFunctions.find(strFunctionName); + var Param = null; + var strType = ""; + + if (Function != null) + { + Param = Function.getParam(nParamNum); + if (Param != null) + { + strType = Param.getType(); + } + else + { + doErrorMessage("doGetFunctionCallParamType, function '" + strFunctionName + "' does not have " + nParamNum + " parameters!"); + } + } + else if (isArduinoFunctionCall(strFunctionName)) + { + strType = doGetArduinoFunctionParamType(strFunctionName, nParamNum); + } + else + { + doErrorMessage("doGetFunctionCallParamType, function '" + strFunctionName + "' was not found!"); + } + return strType; +} + +function doParseFunctionCallParams(strFuncName) +{ + var arrayParams = new CVariableArray(); + var Variable = new CVariable(); + var strType = "", strName = "", strLastCode = g_strCode, strSymbol = doGetNextSymbol("("); + var nParamNum = 0; + + if (strSymbol == "(") + { + do + { + strName = doGetNextToken(); + + if (strName != "") + { + strType = doGetFunctionCallParamType(strFuncName, nParamNum); + Variable.init(strName, strType, getInitValue(strType)); + arrayParams.add(Variable); + + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseFunctionCallParams", g_strCode, strLastCode); + + nParamNum++; + } + } + while (strName != ""); + + doGetNextSymbol(); // Consume the closing ) + } + else + doExpectingForErrorMessage("doParseFunctionCallParams", "(", strSymbol, strFuncName); + + return arrayParams; +} + +function isGlobalVariable(strName) +{ + return g_arrayGlobalVariables.indexOf(strName) > -1; +} + +function isFunctionCall(strName) +{ + return isArduinoFunctionCall(strName) || (g_arrayFunctions.indexOf(strName) > -1); +} + +function isArduinoConst(strName) +{ + return (strName == "HIGH") || (strName == "LOW") || (strName == "DEC") || (strName == "HEX") || (strName == "BIN"); +} + +function isString(strToken) +{ + return strToken.includes("\""); +} + +function isCharacter(strToken) +{ + return strToken.includes("\'"); +} + +function isNumber(strToken) +{ + var Number = null; + + if (strToken.includes(".")) + Number = parseFloat(strToken); + else + Number = parseInt(strToken); + + return !isNaN(Number); +} + +function getLiteralType(strLiteral) +{ + var strType = ""; + + if (strLiteral.includes("\"")) + strType = "String"; + else if (strLiteral.includes("'")) + strType = "char"; + else if (strLiteral.includes(".")) + strType = "float"; + else if (strLiteral.includes("true") || strLiteral.includes("false")) + strType = "boolean"; + else + strType = "int"; + + return strType; +} + +function doParseArduinoFunctionCall(strFuncName) +{ + var FuncCall = new CFunctionCall(); + var Variable = new CVariable(); + var nParamNum = 0; + var strType = "", strVal = "", strLastCode = g_strCode, strSymbol = doGetNextSymbol(); + var GlobalVar = null; + + FuncCall.init(strFuncName); + + if (strSymbol == "(") + { + do + { + strParam = doGetNextToken(); + if (strParam != "") + { + GlobalVar = g_arrayGlobalVariables.find(strParam); + + if (GlobalVar != null) + { + if (GlobalVar != null) + { + Variable = new CVariable(); + Variable.init(GlobalVar.getName(), GlobalVar.getType(), GlobalVar.getValue()); + } + else + doErrorMessage("doParseArduinoFunctionCall, cannot find global variable '" + strParam + ",!"); + } + else if (isArduinoConst(strParam)) + { + strType = doGetArduinoFunctionParamType(strFuncName, nParamNum); + strVal = strParam; + Variable = new CVariable(); + Variable.init("strParam" + nParamNum.toString(), strType, strVal); + } + else // Must be a literal value + { + strType = getLiteralType(strParam); + Variable = new CLiteral(); + Variable.init(strType, strParam); + } + FuncCall.addParameter(Variable); + if (g_strCode[0] == ',') + g_strCode = g_strCode.substring(1); + + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseArduinoFunctionCall", g_strCode, strLastCode); + } + } + while (strParam != ""); + + strSymbol = doGetNextSymbol(")"); // Consume the closing ) + strSymbol = doGetNextSymbol(";"); // Consume any terminating ; + } + else + doExpectingForErrorMessage("doParseArduinoFunctionCall", "(", g_strCode[0], strFuncName); + + return FuncCall; +} + +function doParseFunctionCall(strFuncName) +{ + var FuncCall = new CFunctionCall(); + var arrayParams = new CVariableArray(); + var nI = 0; + var Function = g_arrayFunctions.find(strFuncName); + var Variable = null; + var Literal = new CLiteral(); + var strLastCode = g_strCode; + + FuncCall.init(strFuncName); + + if (g_strCode.charCodeAt(0) == 40/*(*/) + { + g_strCode = g_strCode.substring(1); // Consume the ( + + while (g_strCode.charCodeAt(0) != 41/*)*/) + { + strParam = doGetNextToken(); + Variable = g_arrayGlobalVariables.find(strParam); + + if (Variable != null) + FuncCall.addParam(Variable); + else + { + Variable = Function.findParam(nI); + if (Variable != null) + Literal.init(Variable.getType(), strParam); + else + doErrorMessage("doParseFunctionCall, parameter '" + nI + "' for function '" + strFuncName + "' is null!"); + } + if (g_strCode[0] == ',') + g_strCode = g_strCode.substring(1); + nI++ + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseFunctionCall", g_strCode, strLastCode); + } + } + else + doExpectingForErrorMessage("doParseFunctionCall", "(", g_strCode[0], strFuncName); + + doGetNextSymbol(); // Consume the terminating ; + + return FuncCall; +} + +function doGetExpressionArg() +{ + var strToken = "", strOperator = ""; + var Arg = null; + var arrayParams = null; + + if (g_strCode.length > 0) + { + if (g_strCode.charCodeAt(0) == 33/*!*/) + strOperator = doGetNextSymbol(); + + if (isQuote(g_strCode.charCodeAt(0))) + strToken = doGetNextStringOrChar(); + else + strToken = doGetNextToken(); + + if (isArduinoConst(strToken)) + { + Arg = new CLiteral(); + Arg.init(getLiteralType(strToken), strToken); + } + else if (isNumber(strToken)) + { + Arg = new CLiteral() + Arg.init("int", strToken); + } + else if (isString(strToken)) + { + Arg = new CLiteral() + Arg.init("string", strToken); + } + else if (isCharacter(strToken)) + { + Arg = new CLiteral() + Arg.init("char", strToken); + } + else if (isGlobalVariable(strToken)) + { + Arg = g_arrayGlobalVariables.find(strToken); + } + else if (isArduinoFunctionCall(strToken) || isFunctionCall(strToken)) + { + Arg = new CFunctionCall(); + Arg.init(strToken); + arrayParams = doParseFunctionCallParams(strToken); + Arg.setParameters(arrayParams); + } + else + { + doErrorMessage("doGetExpressionArg, unknown token '" + strToken + "'!\n\n\n" + g_strCode); + } + if (strOperator == "!") + { + var Expression = new CExpression(); + Expression.init(null, Arg, strOperator); + Arg = Expression; + } + } + return Arg; +} + +function doGetExpression() +{ + var nI = 0; + var strExpression = ""; + + while ((g_strCode.charCodeAt(nI) == 40/* ( */) || (g_strCode.charCodeAt(nI) == 41/* ) */)|| (g_strCode.charCodeAt(nI) == 46/* . */) || + (g_strCode.charCodeAt(nI) == 33/* ! */) || (g_strCode.charCodeAt(nI) == 39/* ' */) || (g_strCode.charCodeAt(nI) == 34/* " */) || + isAlphaNumeric(g_strCode.charCodeAt(nI)) || isOperator(g_strCode.charCodeAt(nI))) + { + if ((g_strCode.charCodeAt(nI - 1) == 41/* ) */) && isAlphaNumeric(g_strCode.charCodeAt(nI))) + { + break; + } + nI++; + } + strExpression = g_strCode.substring(0, nI); + + if (g_strCode.charCodeAt(0) == 41/*)*/) + { + strExpression += g_strCode[0]; + g_strCode = g_strCode.substring(1); + } + return strExpression; +} + +function doAssertNotNull(Value, nLineNumber, strFuncName, strVarName) +{ + if (Value === null) + doErrorMessage(strFuncName + ", line " + nLineNum + ", '" + strVarName + "' cannot be null!\n\n\n" + g_strCode); +} + +function doAssertNotEmpty(strValue, nLineNumber, strFuncName, strVarName) +{ + if (strValue.length == 0) + doErrorMessage(strFuncName + ", line " + nLineNum + ", '" + strVarName + "' cannot be empty!\n\n\n" + g_strCode); +} + +function doParseExpression() +{ + var Expression = null, Arg = null; + var strOperator = "", strExpression = "", strOrigCode = "", strLastCode = ""; + var arrayExpressionStack = []; + var nState = 0, nNone = 0, nArg1 = 1, nArg2 = 2, nOperator = 3; + + strExpression = doGetExpression(); + g_strCode = g_strCode.substring(strExpression.length); + + // All because javascript does not allow you to return values through function parameters + strOrigCode = g_strCode; + g_strCode = strExpression; + strLastCode = g_strCode; + Expression = null; + + while (g_strCode.length > 0) + { + + if (g_strCode.charCodeAt(0) == 40) // ( + { + doGetNextSymbol(); // Consume the open ( + arrayExpressionStack.push(new CExpression()); + } + else if (isAlphaNumeric(g_strCode.charCodeAt(0)) || isQuote(g_strCode.charCodeAt(0))) + { + Arg = doGetExpressionArg(); + doAssertNotNull(Arg, 702, "doParseExpression", "Arg"); + Expression = arrayExpressionStack.pop(); + if (Expression == null) + Expression = new CExpression(); + + if (Expression.isEmpty()) + { + nState = nArg1; + Expression.setArg1(Arg); + } + else + { + nState = nArg2; + Expression.setArg2(Arg); + } + arrayExpressionStack.push(Expression); + } + else if (((g_strCode.charCodeAt(0) == 45 /* - */) || (g_strCode.charCodeAt(0) == 43 /* + */)) && ((nState == nNone) || (nState == nOperator))) + { + // E.G. -nSensorValue + // E.G. X > -nSensorValue + strOperator = doGetNextSymbol(); + Expression = new CExpression(); + Arg = doGetExpressionArg(); + Expression.init(null, Arg, strOperator); + Arg = Expression; + Expression = arrayExpressionStack.pop(); + if (Expression== null) + Expression = new CExpression(); + if (Expression.isEmpty()) + Expression.setArg1(Arg); + else + Expression.setArg2(Arg); + arrayExpressionStack.push(Expression); + } + else if (g_strCode.charCodeAt(0) == 33 /* ! */) + { + strOperator = doGetNextSymbol(); + doAssertNotEmpty(strOperator, 718, "doParseExpression", "strOperator"); + Arg = doGetExpressionArg(); + Expression = new CExpression(); + Expression.setArg2(Arg); + Expression.setOperator("!"); + Arg = Expression; + + Expression = arrayExpressionStack.pop(); + if (Expression == null) + Expression = new CExpression(); + + if (Expression.isEmpty()) + Expression.setArg1(Arg); + else + Expression.setArg2(Arg); + arrayExpressionStack.push(Expression); + } + else if (isOperator(g_strCode.charCodeAt(0))) + { + strOperator = doGetNextSymbol(); + doAssertNotEmpty(strOperator, 718, "doParseExpression", "strOperator"); + + Expression = arrayExpressionStack.pop(); + doAssertNotNull(Expression, 721, "doParseExpression", "Expression"); + + if (!Expression.isComplete()) + { + Expression.setOperator(strOperator); + arrayExpressionStack.push(Expression); + } + else + { + Arg = Expression; + Expression = new CExpression(); + Expression.setArg1(Arg); + Expression.setOperator(strOperator); + arrayExpressionStack.push(Expression); + } + nState = nOperator; + } + else if (g_strCode.charCodeAt(0) == 41) // ) + { + doGetNextSymbol(); // Consume the closing ) + + Arg = arrayExpressionStack.pop(); + doAssertNotNull(Arg, 732, "doParseExpression", "Arg"); + Expression = arrayExpressionStack.pop(); + if (Expression == null) + Expression = Arg; + else + { + if (Expression.isEmpty()) + Expression.setArg1(Arg); + else + Expression.setArg2(Arg); + } + arrayExpressionStack.push(Expression); + } + else + { + doUnexpectedErrorMessage("doParseExpression", g_strCode[0]) + } + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseExpression", g_strCode, strLastCode); + } + Expression = arrayExpressionStack.pop(); + + // All because javascript does not allow you to return values through function parameters + g_strCode = strOrigCode; + + return Expression; +} + +function doParseVariableStatement(strVarName) +{ + var Statement = new CVariableStatement(); + var strOperator = doGetNextSymbol(); + var Expression = new CExpression(); + var Const1 = new CLiteral(); + + if (strOperator == "--") + { + Const1.init("int", 1); + Expression.init(strVarName, Const1, "-"); + strOperator = "="; + } + else if (strOperator == "++") + { + Const1.init("int", 1); + Expression.init(strVarName, Const1, "-"); + strOperator = "="; + } + else + { + Expression = doParseExpression(); + } + Statement.init(strVarName, strOperator, Expression); + strOperator = doGetNextSymbol(); // Consume the terminating ; + + return Statement; +} + +function doParseBreak() +{ + var Break = new CBreak(); + var strSymbol = doGetNextSymbol(";"); + + if (strSymbol != ";") + doExpectingErrorMessage("doParseBreak", ";", strSymbol); + + return Break; +} + +function doParseStatement() +{ + var Statement = new CVariableStatement(); + var strToken = doGetNextToken(); + var arrayParams = null; + + if (strToken == "Serial") + { + if (g_strCode.charCodeAt(0) == 46/*.*/) + { + strToken += g_strCode[0] + g_strCode = g_strCode.substring(1); + g_strCode = g_strCode.trim(); + strToken += doGetNextToken(); + } + else + doExpectingErrorMessage("doParseStatement", ".", g_strCode[0]); + } + if (strToken == "switch") + { + Statement = doParseSwitch(); + } + else if (strToken == "if") + { + Statement = doParseIf(); + } + else if (strToken == "while") + { + Statement = doParseWhile(); + } + else if (strToken == "repeat") + { + Statement = doParseRepeat(); + } + else if (strToken == "for") + { + Statement = doParseFor(); + } + else if (strToken == "break") + { + Statement = doParseBreak(); + } + else if (isArduinoFunctionCall(strToken)) + { + Statement = doParseArduinoFunctionCall(strToken); + } + else if (isFunctionCall(strToken)) + { + Statement = doParseFunctionCall(strToken); + + } + else if (isGlobalVariable(strToken)) + { + Statement = doParseVariableStatement(strToken); + } + else + { + doErrorMessage("doParseStatement, unknown identifier '" + g_strCode[0] + "'!\n\n\n" + g_strCode); + } + return Statement; +} + +function doParseStatements() +{ + var arrayStatements = new CStatementArray(); + var Statement = null; + var strSymbol = doGetNextSymbol("{"), strLastCode = g_strCode; + + if (strSymbol == "{") + { + while (strSymbol != "}") + { + strSymbol = doGetNextSymbol("}"); + if (strSymbol != "}") + { + Statement = doParseStatement(); + arrayStatements.add(Statement); + } + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParseStatements", g_strCode, strLastCode); + } + } + else + { + Statement = doParseStatement(); + arrayStatements.add(Statement); + doGetNextSymbol(); // Consume the closing ; + } + return arrayStatements; +} + +function doParseFunction(strName, strReturnType) +{ + // E.G. char doSomething(char cParam, int nParam) { }; + var Function = new CFunction(); + var arrayParams = doParseFunctionParams(strName); + var arrayStatements = doParseStatements(); + + Function.init(strName, strReturnType, arrayParams, arrayStatements); + + return Function; +} + +function doParseVariable(strName, strType) +{ + var strSymbol = doGetNextSymbol(); + var strValue = doGetNextValue(strType == "float"); + var Variable = new CVariable(); + + strSymbol = doGetNextSymbol(); // Consume the semi colon + Variable.init(strName, strType, strValue); + + return Variable; +} + +function isFunction() +{ + // E.G. char doSomething(char cParam, int nParam) { }; + var nI = 0; + + while (isAlphaNumeric(g_strCode.charCodeAt(nI))) + { + nI++; + g_strCode = g_strCode.trim(); + } + return g_strCode.charCodeAt(nI) == '('; +} + +function doParse() +{ + var strIdentifier1 = "", strIdentifier2 = "", strLastCode = g_strCode; + var nI = 0; + var Variable = null, Function = null; + + while (g_strCode.length > 0) + { + if (isAlphaNumeric(g_strCode.charCodeAt(0))) + { + strIdentifier1 = doGetNextToken(); + + if ((strIdentifier1 == 'char') || (strIdentifier1 == 'float') || (strIdentifier1 == 'int') || (strIdentifier1 == 'long') || + (strIdentifier1 == 'byte') || (strIdentifier1 == 'uint8_t') || (strIdentifier1 == 'int8_t') || (strIdentifier1 == 'uint16_t') || + (strIdentifier1 == 'int16_t') || (strIdentifier1 == 'uint32_t') || (strIdentifier1 == 'int32_t') || (strIdentifier1 == 'void') || + (strIdentifier1 == 'bool') || (strIdentifier1 == 'boolean')) + { + strIdentifier2 = doGetNextToken(); + + if (strIdentifier2 == "setup") + g_SetupFunc = doParseFunction("setup", "void"); + else if (strIdentifier2 == "loop") + g_LoopFunc = doParseFunction("loop", "void"); + else if (isFunction()) + { + Function = doParseFunction(strIdentifier2, strIdentifier1); + g_arrayFunctions.add(Function); + } + else + { + Variable = doParseVariable(strIdentifier2, strIdentifier1); + g_arrayGlobalVariables.add(Variable); + } + } + if (strLastCode == g_strCode) + strLastCode = doInfiniteLoopErrorMessage("doParse", g_strCode, strLastCode); + } + + } +} + +function doReproduceCode() +{ + var strText = ""; + + strText += g_arrayGlobalVariables.toString("
", "") + "
"; + strText += g_arrayFunctions.toString("
", "") + "
"; + strText += g_SetupFunc.toString("
", "") + "
"; + strText += g_LoopFunc.toString("
", "") + "



"; + + return strText; +} + + + + +//************************************************************************* +//* +//* GLOBAL VARIBALES +//* +//************************************************************************* + +var g_arrayFunctions = new CFunctionArray(); +var g_SetupFunc = null, g_LoopFunc = null; +var g_arrayGlobalVariables = new CVariableArray(); + diff --git a/ardublockly/CommonComponentDataStructures.js b/ardublockly/CommonComponentDataStructures.js new file mode 100644 index 0000000000..a50cac78bb --- /dev/null +++ b/ardublockly/CommonComponentDataStructures.js @@ -0,0 +1,916 @@ +//************************************************************************* +//* +//* GLOBAL VARIBALES FOR COMPONENTS +//* +//************************************************************************* + +var g_mapPlacedComponents = new Map(); +var INPUT = "INPUT", INPUT_HIGH = "INPUT_HIGH", OUTPUT = "OUTPUT", HIGH = "HIGH", LOW = "LOW"; +var g_strErrorMessage = "ERROR: "; +var g_BUILT_IN_LED = 13; +var g_nMCUCount = 0; +var g_strSelectedComponentName = "", g_strMCUName = ""; + +function isArduinoConstant(strVal) +{ + return (strVal == INPUT) || (strVal == INPUT_HIGH) || (strVal == OUTPUT) || (strVal == HIGH) || (strVal == LOW) || (strVal == "true") || (strVal == "false"); +} + +function doCreateComponent(strComponentType) +{ + var strComponentName = doGetUniqueName(strComponentType); + var Component = null; + + if (strComponentType == "UNO") + { + if (g_nMCUCount == 0) + { + Component = new CArduinoUno(); + g_nMCUCount++; + } + else + doErrorMessage(g_strErrorMessage + " only one MCU is permitted!"); + } + else if (strComponentType == "MEGA") + { + if (g_nMCUCount == 0) + { + Component = new CArduinoMega(); + g_nMCUCount++; + } + else + doErrorMessage(g_strErrorMessage + " only one MCU is permitted!"); + } + else if (strComponentType == "MICROBIT") + { + if (g_nMCUCount == 0) + { + Component = new CMicrobit(); + g_nMCUCount++; + } + else + doErrorMessage(g_strErrorMessage + " only one MCU is permitted!"); + } + else if (strComponentType == "MICROBIT_BREAKOUT") + { + if (g_nMCUCount == 0) + { + Component = new CMicrobit(true); + g_nMCUCount++; + } + else + doErrorMessage(g_strErrorMessage + " only one MCU is permitted!"); + } + else if (strComponentType == "LED") + Component = new CLED(); + else if (strComponentType == "RESISTOR") + Component = new CResistor(); + else + alert(strComponentType); + + // ******************************* + // ******************************* + // ******************************* + // TO DO + // ******************************* + // ******************************* + // ******************************* + + if (Component != null) + { + Component.setDeviceName(strComponentName); + Component.doSelect(); + g_mapPlacedComponents.set(strComponentName, Component); + } + return Component; +} + +function doGetUniqueName(strName) +{ + var strFind = ""; + + for (let nI = 1; nI <= 1000; nI++) + { + strFind = strName + nI; + if (!g_mapPlacedComponents.has(strFind)) + { + break; + } + } + return strFind; +} + +function doCreateMCU(strMCUType) +{ + if ((strMCUType != "UNO") && (strMCUType != "MEGA")) + { + alert("'" + strMCUType + "' is not supported at this time!"); + strMCUType = "UNO"; + } + var Component = doCreateComponent(strMCUType); + var strMCUName = Component.getDeviceName(); + g_mapPlacedComponents.set(strMCUName, Component); + doDisplayAllComponents(); + return strMCUName; +} + +function doShowEditFields(strHTMLEditField) +{ + var ComponentEdit = document.getElementById("component_edit"); + + if (ComponentEdit != null) + { + ComponentEdit.innerHTML = strHTMLEditField; + } +} + +function doErrorMessage(strErrorMessage) +{ + doDisplayInfo(strErrorMessage); +} + +function doDisplayInfo(strMessage) +{ + var LargeMessageDiv = document.getElementById("large_message_area"); + + if (LargeMessageDiv != null) + { + LargeMessageDiv.innerHTML = strMessage; + } +} + +function doDisplayHint(strHeading, strInfo) +{ + var Info = getElement("info"); + var InfoHeading = getElement("info_heading"); + + if (Info && InfoHeading) + { + InfoHeading.innerText = strHeading; + Info.innerText = strInfo; + } +} + + + + +//************************************************************************* +//* +//* PLACED COMPONENTS MAP FUNCTIONS +//* +//************************************************************************* + +function doStopRunAllComponents() +{ + var arrayDeviceName = []; + var strDeviceName = "", strSelectedDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + if (g_mapPlacedComponents.get(arrayDeviceName[nI])) + g_mapPlacedComponents.get(arrayDeviceName[nI]).doStopRun(); + } +} + +function doZoomAllDrawingObjects(strInOut) +{ + var arrayDeviceName = []; + var strDeviceName = "", strSelectedDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + if (strInOut == "+") + g_mapPlacedComponents.get(strDeviceName).doZoomIn(); + else if (strInOut == "-") + g_mapPlacedComponents.get(strDeviceName).doZoomOut(); + else if (strInOut == "100") + g_mapPlacedComponents.get(strDeviceName).doDefaultZoom(); + g_mapPlacedComponents.get(strDeviceName).doRotate(0); + } + doDisplayAllComponents(); +} + +function doFindSelectedComponent(pointMousePos) +{ + var arrayDeviceName = []; + var strDeviceName = "", strSelectedDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + if (g_mapPlacedComponents.get(strDeviceName).isMouseIn(pointMousePos)) + { + strSelectedDeviceName = strDeviceName; + break; + } + } + return strSelectedDeviceName; +} + +function doFindSelectedComponentNoMouse() +{ + var arrayDeviceName = []; + var strDeviceName = "", strSelectedDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + if (g_mapPlacedComponents.get(strDeviceName).isSelected()) + { + strSelectedDeviceName = strDeviceName; + break; + } + } + return strSelectedDeviceName; +} + +function doUnselectAllComponents() +{ + var arrayDeviceName = []; + var strDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + g_mapPlacedComponents.get(strDeviceName).doUnselect(); + } +} + +function doDisplayAllComponents() +{ + var arrayDeviceName = []; + var strDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + + doEraseCanvas(); + for (let nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + g_mapPlacedComponents.get(strDeviceName).doDisplay(); + } +} + +function doMouseOverAllComponents(pointMousePos) +{ + var arrayDeviceName = []; + var strDeviceName = ""; + var nI = 0; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){arrayDeviceName.push(strKey)}); + g_Canvas.style.cursor = "default"; + + for (nI = 0; nI < arrayDeviceName.length; nI++) + { + strDeviceName = arrayDeviceName[nI]; + if (g_mapPlacedComponents.get(strDeviceName).doMouseOver(pointMousePos)) + break; + } +} + + + + + +//************************************************************************* +//* +//* STYLES - BECAUSE HTML CLASS PROPERTIES WON'T WORK +//* +//************************************************************************* + +var g_strTextStyle = "background-color:white;border-style:solid;border-width:2Px;border-radius:5Px;border-top-color:#799B8A;border-left-color:#79B98A;border-right-color:#B9DBCA;border-bottom-color:#B9DBCA;width:120Px;height:30Px;"; +var g_strButtonStyle = "color:#006468;height:30px;border-radius: 5Px;background-color: #99BBAA;border-left-color:#B9DBCA;border-top-color:#B9DBCA;border-right-color:#799B8A;border-bottom-color:#79B98A;" +var g_strLabelStyle = "display:inline-block;color:#006468;"; +var g_strSelectStyle = "display:inline;height:30Px;background-color:white;border-style:solid;border-width:2Px;border-radius:5Px;border-top-color:#799B8A;border-left-color:#79B98A;border-right-color:#B9DBCA;border-bottom-color:#B9DBCA;"; +var g_strSecondDivDisplayStyle = "display:inline-block;height:100%;vertical-align:middle;border-style:none;border-thickness:3Px;border-color:blue;"; + + + + +//************************************************************************* +//* +//* INPUT FIELDS +//* +//************************************************************************* + +//var g_strRename = "
NEW NAME
 
"; +var g_strRename = "
NEW NAME 
 
"; + + + + +//************************************************************************* +//* +//* BASE COMPONENT +//* +//************************************************************************* + +function doRename(strNewName) +{ + var strDeviceName = doFindSelectedComponentNoMouse(); + + if (g_mapPlacedComponents.get(strDeviceName) != null) + { + g_mapPlacedComponents.get(strDeviceName).setDeviceName(strNewName); + doDisplayAllComponents(); + } +} + + + + +class CComponentBase +{ + constructor(strType) + { + this.m_ImageObject0 = null; + this.m_ImageObject90 = null; + this.m_ImageObject180 = null; + this.m_ImageObject270 = null; + this.m_arrayPins = []; + this.m_strDeviceName = ""; + this.m_rectangle = new CRectangle(new CPoint(g_pointCanvasScrollPos.m_nX + 50, g_pointCanvasScrollPos.m_nY + 50), new CSize(0, 0)); + this.m_fScale = this.m_fDefaultScale = 1; + this.m_nRotationAngle = 0; + this.m_bSelected = false; + this.m_pointLastMousePos = new CPoint(0, 0); + this.m_strEditHTML = ""; + this.m_strType = strType; + this.m_strEditHTML = g_strRename; + this.m_nZoom = 0; + } + + getZoom() + { + return this.m_nZoom; + } + + getZoomScaledValue(nValue) + { + return (this.m_fDefaultScale / this.m_fScale) * nValue; + } + + doDefaultZoom() + { + this.m_fScale = this.m_fDefaultScale; + this.m_nZoom = 1; + } + + doZoomIn() + { + if (this.m_nZoom < 10) + { + this.m_nZoom++; + this.m_fScale -= 0.1; + } + } + + doZoomOut() + { + if (this.m_nZoom > -10) + { + this.m_nZoom--; + this.m_fScale += 0.1; + } + } + + doAddPin(Pin) + { + this.m_arrayPins[this.m_arrayPins.length] = Pin; + } + + doSetPinPos(nIndex, pointPos, sizeDimen) + { + if ((nIndex >= 0) && (nIndex < this.m_arrayPins.length)) + this.m_arrayPins[nIndex].set(pointPos, sizeDimen); + } + + doRead(strFileContents) + { + var strTemp = ""; + + this.m_strDeviceName = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strDeviceName); + + strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_nRotationAngle = parseInt(strTemp); + + strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_rectangle.m_pointTL.m_nX = parseInt(strTemp); + + strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_rectangle.m_pointTL.m_nY = parseInt(strTemp); + + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + strFileContents = this.m_arrayPins[nI].doRead(strFileContents); + + this.doMove(this.m_rectangle.m_pointTL); + this.doRotate(this.m_rectangle.m_nRotationAngle); + + return strFileContents; + } + + doWrite(strFileContents) + { + strFileContents = this.m_strType + "\r\n"; + strFileContents += this.m_strDeviceName + "\r\n"; + strFileContents += this.m_nRotationAngle + "\r\n"; + strFileContents += this.m_rectangle.m_pointTL.m_nX + "\r\n"; + strFileContents += this.m_rectangle.m_pointTL.m_nY + "\r\n"; + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + strFileContents = this.m_arrayPins[nI].doWrite(strFileContents); + + return strFileContents; + } + + getType() + { + return this.m_strType; + } + + doRotate(nAddAngle) + { + this.m_nRotationAngle += nAddAngle; + + if (this.m_nRotationAngle >= 360) + this.m_nRotationAngle -= 360; + else if (this.m_nRotationAngle < 0) + this.m_nRotationAngle += 360; + + if (this.m_nRotationAngle == 0) + { + this.m_rectangle.m_size.m_nWidth = this.m_ImageObject0.naturalWidth / this.m_fScale; + this.m_rectangle.m_size.m_nHeight = this.m_ImageObject0.naturalHeight / this.m_fScale; + } + else if (this.m_nRotationAngle == 90) + { + this.m_rectangle.m_size.m_nWidth = this.m_ImageObject90.naturalWidth / this.m_fScale; + this.m_rectangle.m_size.m_nHeight = this.m_ImageObject90.naturalHeight / this.m_fScale; + } + else if (this.m_nRotationAngle == 180) + { + this.m_rectangle.m_size.m_nWidth = this.m_ImageObject180.naturalWidth / this.m_fScale; + this.m_rectangle.m_size.m_nHeight = this.m_ImageObject180.naturalHeight / this.m_fScale; + } + else if (this.m_nRotationAngle == 270) + { + this.m_rectangle.m_size.m_nWidth = this.m_ImageObject270.naturalWidth / this.m_fScale; + this.m_rectangle.m_size.m_nHeight = this.m_ImageObject270.naturalHeight / this.m_fScale; + } + this.doSetPinPositions(); + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doConnectedMove(this.m_strDeviceName); + } + + static doGetImageObject(strImageFileName) + { + var ImageObject = new Image(); + + ImageObject.onload = function(){}; + ImageObject.src = strImageFileName; + + return ImageObject; + } + + setDeviceName(strDeviceName) + { + this.m_strDeviceName = strDeviceName; + } + + getDeviceName() + { + return this.m_strDeviceName; + } + + isSelected() + { + return this.m_bSelected; + } + + doSelect() + { + this.m_bSelected = true; + + var strHTML = this.m_strEditHTML; + strHTML = strHTML.replace("XXXX", this.m_strDeviceName); + doShowEditFields(strHTML); + } + + doUnselect() + { + this.m_bSelected = false; + } + + doDelete() + { + } + + doDeleteWire(strWireName) + { + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doDeleteWire(strWireName); + } + + doDrawBorder() + { + g_CanvasContext.beginPath(); + g_CanvasContext.strokeStyle = "red"; + g_CanvasContext.lineWidth = "2"; + g_CanvasContext.rect(this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + g_CanvasContext.stroke(); + } + + doDisplayName() + { + g_CanvasContext.font = "bold 20px Arial"; + g_CanvasContext.fillStyle = "#000000"; + g_CanvasContext.fillText(this.m_strDeviceName, this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY - 2); + } + + doDisplayPins() + { + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doDisplay(); + } + + doDisplay() + { + if ((this.m_nRotationAngle == 0) && (this.m_ImageObject0 != null)) + g_CanvasContext.drawImage(this.m_ImageObject0, this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + else if ((this.m_nRotationAngle == 90) && (this.m_ImageObject90 != null)) + g_CanvasContext.drawImage(this.m_ImageObject90, this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + else if ((this.m_nRotationAngle == 180) && (this.m_ImageObject180 != null)) + g_CanvasContext.drawImage(this.m_ImageObject180, this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + else if ((this.m_nRotationAngle == 270) && (this.m_ImageObject270 != null)) + g_CanvasContext.drawImage(this.m_ImageObject270, this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + + if (this.m_bSelected) + this.doDrawBorder(); + + this.doDisplayName(); + this.doDisplayPins(); + } + + doGrab(pointMousePos) + { + this.doSelect(); + this.m_pointLastMousePos.m_nX = pointMousePos.m_nX; + this.m_pointLastMousePos.m_nY = pointMousePos.m_nY; + g_Canvas.style.cursor = "grabbing"; + } + + doMove(pointMousePos) + { + this.m_rectangle.m_pointTL.m_nX = pointMousePos.m_nX; + this.m_rectangle.m_pointTL.m_nY = pointMousePos.m_nY; + this.m_bSelected = true; + this.doSetPinPositions(); + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doConnectedMove(this.m_strDeviceName); + } + + hasMouseMoved(pointMousePos) + { + var bResult = (pointMousePos.m_nX != this.m_pointLastMousePos.m_nX) || (pointMousePos.m_nY != this.m_pointLastMousePos.m_nY); + + return bResult; + } + + doDrop(pointMousePos) + { + var nFinalX = 0, nFinalY = 0; + + if (this.hasMouseMoved(pointMousePos)) + { + pointMousePos.m_nX -= (pointMousePos.m_nX % g_nGridSize); + pointMousePos.m_nY -= (pointMousePos.m_nY % g_nGridSize); + this.doMove(pointMousePos); + } + g_Canvas.style.cursor = "pointer"; + } + + doMouseOver(pointMousePos) + { + var bResult = false; + var OldCursor = g_Canvas.style.cursor; + + if (this.isMouseIn(pointMousePos)) + { + g_Canvas.style.cursor = "pointer"; + bResult = true; + + for (var nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (this.m_arrayPins[nI].doMouseOver(pointMousePos)) + break; + } + if (nI >= this.m_arrayPins.length) + this.doDisplay(); + } + else + { + doDisplayHint("", ""); + doDisplayAllComponents(); + } + return bResult; + } + + isMouseIn(pointMousePos) + { + return this.m_rectangle.isMouseIn(pointMousePos); + } + + isMouseInPin(pointMousePos) + { + var nPinNum = -1; + + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (this.m_arrayPins[nI].canAcceptConection() && this.m_arrayPins[nI].isMouseIn(pointMousePos)) + { + nPinNum = nI; + break; + } + } + return nPinNum; + } + + getPinID(nPinNum) + { + var strPindID = ""; + + if ((nPinNum >= 0) && (nPinNum < this.m_arrayPins.length)) + { + strPindID = this.m_arrayPins[nPinNum].getPinID(); + } + return strPindID; + } + + getPinPos(strPinID) + { + var point = new CPoint(0, 0); + + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (this.m_arrayPins[nI].getPinID() == strPinID) + { + point = this.m_arrayPins[nI].getPosition(); + } + } + return point; + } + + getPinState(strPinID) + { + var nState = LOW; + + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (this.m_arrayPins[nI].getPinID() == strPinID) + { + nState = this.m_arrayPins[nI].getState(); + } + } + return nState; + } + + setWire(strPinID, strWireName) + { + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (this.m_arrayPins[nI].getPinID() == strPinID) + { + this.m_arrayPins[nI].setWire(strWireName); + } + } + } + + doRun() + { + } + + doStopRun() + { + } + + getVoltage() + { + return 0; + } + + getResistance() + { + return 0; + } + +} + + + + +//************************************************************************* +//* +//* BASE MCU +//* +//************************************************************************* + +class CMCUBase extends CComponentBase +{ + constructor(strType) + { + super("MCU " + strType); + this.m_mapAnalogPins = new Map(); + this.m_nMaxPin = 0; + this.m_fVoltage = 0; + } + + getLogicVoltage() + { + return this.m_fVoltage; + } + + getVoltage(strDeviceName, strPinID) + { + var fVoltage = 0; + + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + { + if (strPinID == this.m_arrayPins[nI].getPinID()) + { + if (this.m_arrayPins[nI].getState() == 1) + fVoltage = this.m_fVoltage; + else if (this.m_arrayPins[nI].getPWM() > -1) + fVoltage = this.m_fVoltage * (this.m_arrayPins[nI].getPWM() / 255) + else + fVoltage = 0; + break; + } + } + return fVoltage; + } + + doWrite() + { + var strFileContents = super.doWrite(); + return strFileContents; + } + + getType() + { + var strType = super.getType(); + strType = strType.substring(0, 3); + + return strType; + } + + setDeviceName(strDeviceName) + { + super.setDeviceName(strDeviceName); + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doSetDeviceName(strDeviceName); + } + + getImageFileName() + { + return super.getImageFileName(); + } + + getPin(PinID) + { + var nPinNum = -1; + + if (isNaN(PinID)) + { + if (this.m_mapAnalogPins.has(PinID)) + nPinNum = m_mapAnalogPins.get(PinID); + else + doErrorMessage(g_strErrorMessage + "'" + this.getDeviceName() + "' does not have pin '" + PinID + "'!"); + } + else + nPinNum = PinID; + + if (nPinNum == 0) + { + doErrorMessage(g_strErrorMessage + "shouldn't digital read from pin '0' as it belongs to Serial Monitor!"); + nPinNum = -1; + } + else if (nPinNum == 1) + { + doErrorMessage(g_strErrorMessage + "shouldn't digital read from pin '1' as it belongs to Serial Monitor!"); + nPinNum = -1; + } + else if (nPinNum > this.m_nMaxPin) + { + doErrorMessage(g_strErrorMessage + "no such pin '" + nPinNum + "'!"); + nPinNum = -1; + } + return nPinNum; + } + + pinMode(PinID, strMode) + { + var nPinNum = this.getPin(PinID, this); + + if (nPinNum != -1) + this.m_arrayPins[nPinNum].pinMode(strMode); + + } + + digitalRead(PinID) + { + var nPinNum = this.getPin(PinID, this); + var strState = ""; + + if (nPinNum != -1) + strState = this.m_arrayPins[nPinNum].digitalRead(); + + return strState; + } + + digitalWrite(PinID, strState) + { + var nPinNum = this.getPin(PinID, this); + + if (nPinNum != -1) + this.m_arrayPins[nPinNum].digitalWrite(strState); + } + + analogRead(nPinNum) + { + var nPinNum = this.getPin(PinID, this); + var strState = ""; + + if (nPinNum != -1) + strState = this.m_arrayPins[nPinNum].analogRead(); + + return strState; + } + + analogWrite(nPinNum, strPWMVal) + { + var nPinNum = this.getPin(PinID, this); + + if (nPinNum != -1) + this.m_arrayPins[nPinNum].analogWrite(strPWMVal); + } + + doDisplay() + { + super.doDisplay(); + } + + doRotate(nAngleAdd) + { + super.doRotate(nAngleAdd); + } +} + + + + +//************************************************************************* +//* +//* DELAY CLASSES +//* +//************************************************************************* + +class CDelay +{ + constructor(nMillisDelay) + { + this.set(nMillisDelay); + } + + set(nMillisDelay) + { + this.m_timeStart = performance.now(); + this.m_millisDelay = nMillisDelay; + } + + isExpired() + { + var bResult = false; + var timeNow = performance.now(); + + if ((timeNow - this.m_timeStart) >= this.m_millisDelay) + bResult = true; + + return bResult; + } +} + + diff --git a/ardublockly/DataStructures.js b/ardublockly/DataStructures.js new file mode 100644 index 0000000000..8a491faee1 --- /dev/null +++ b/ardublockly/DataStructures.js @@ -0,0 +1,1101 @@ + + //************************************************************************* + //* + //* CODE CLASSES + //* + //************************************************************************* + + var g_strIndent = "    "; + + class CLiteral + { + constructor() + { + this.m_strType = ""; + this.m_strValue = ""; + this.m_strKINDOF = "LITERAL"; + }; + + init(strType, strValue) + { + this.m_strType = strType; + this.m_strValue = strValue; + }; + + evaluate() + { + var Value = null; + + if (this.m_strType == "char") + Value = this.m_strValue[0]; + else if (this.m_strType == "boolean") + { + if ((this.m_strValue == "true") || (this.m_strValue == "1")) + Value = true; + else if ((this.m_strValue == "false") || (this.m_strValue == "0")) + Value = false; + } + else if (this.m_strType == "float") + Value = parseFoat(this.m_strValue); + else if (this.m_strType == "String") + Value = this.m_strValue; + else + Value = parseInt(this.m_strType[0], 10); + + return Value; + } + + isEmpty() + { + return (this.m_strType == "") && (this.m_strValue == ""); + } + + toString() + { + return this.m_strValue; + } + + }; + + class CVariable + { + constructor() + { + this.m_strName = ""; + this.m_strType = ""; + this.m_strValue = null; + this.m_strKINDOF = "VARIABLE"; + } + + init(strName, strType, strValue) + { + this.m_strName = strName; + this.m_strType = strType; + this.m_strValue = strValue; + } + + evaluate() + { + var Value = null; + + if (this.m_strType == "char") + Value = this.m_strValue[0]; + else if (this.m_strType == "boolean") + { + if ((this.m_strValue == "true") || (this.m_strValue == "1")) + Value = true; + else if ((this.m_strValue == "false") || (this.m_strValue == "0")) + Value = false; + } + else if (this.m_strType == "float") + Value = parseFoat(this.m_strValue); + else if (this.m_strType == "String") + Value = this.m_strValue; + else + Value = parseInt(this.m_strType[0], 10); + + return Value; + } + + setValue(strValue) + { + this.m_strValue = strValue; + } + + getType() + { + return this.m_strType; + } + + getName() + { + return this.m_strName; + } + + getValue() + { + return this.m_strValue; + } + + isEmpty() + { + return (this.m_strName == "") && (this.m_strType == "") && (this.m_strValue == ""); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + if (strNewLine == "") + strText = this.m_strName; + else + strText = strIndent + this.m_strType + " " + this.m_strName + " = " + this.m_strValue + ";" + strNewLine; + + return strText; + } + + }; + + class CVariableArray + { + constructor() + { + this.m_arrayVariables = []; + this.m_strKINDOF = "VARIABLE ARRAY"; + } + + add(Variable) + { + this.m_arrayVariables.push(Variable); + } + + getLength() + { + return this.m_arrayVariables.length; + } + + setValue(nI, Value) + { + if (nI >= this.m_arrayVariables.length) + alert("ERROR: CVariableArray:setValue, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + + this.m_arrayVariables[nI].setValue(Value); + } + setValue(strVariableName, Value) + { + var nI = this.indexOf(strName); + this.setValue(nI, Value); + } + + getValue(nI) + { + if (nI >= this.m_arrayVariables.length) + alert("ERROR: CVariableArray:getValue, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + return this.m_arrayVariables[nI].getValue(); + } + + getType(nI) + { + if (nI >= this.m_arrayVariables.length) + alert("ERROR: CVariableArray:getType, nI = " + nI + ", m_arrayVariables.length = " + this.m_arrayVariables.length + "!"); + return this.m_arrayVariables[nI].getType(); + } + + getValue(strVariableName) + { + var nI = this.indexOf(strName); + return this.getValue(nI); + } + + getType(strVariableName) + { + var nI = this.indexOf(strName); + return this.getType(nI); + } + + find(strName) + { + var Variable = null; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strName == this.m_arrayVariables[nI].getName()) + { + Variable = this.m_arrayVariables[nI]; + break; + } + } + return Variable; + } + + indexOf(strName) + { + var nIndex = -1; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strName == this.m_arrayVariables[nI].getName()) + { + nIndex = nI; + break; + } + } + return nIndex; + } + + isEmpty() + { + return this.m_arrayVariables.length == 0; + } + + toString(strNewLine, strIndent) + { + var strValues = ""; + + for (let nI = 0; nI < this.m_arrayVariables.length; nI++) + { + if (strNewLine.length > 0) + strValues += this.m_arrayVariables[nI].toString(strNewLine, strIndent); + else + { + strValues += this.m_arrayVariables[nI].toString("", ""); + if (nI < (this.m_arrayVariables.length - 1)) + strValues += ", "; + } + + } + return strValues; + } + + }; + + class CExpression + { + constructor() + { + this.m_Arg1 = null; + this.m_Arg2 = null; + this.m_strOperator = ""; + this.m_strKINDOF = "EXPRESSION"; + } + + init(Arg1, Arg2, strOperator) + { + this.m_Arg1 = Arg1; + this.m_Arg2 = Arg2; + this.m_strOperator = strOperator; + } + + setArg1(Arg1) + { + this.m_Arg1 = Arg1; + } + + setArg2(Arg2) + { + this.m_Arg2 = Arg2; + } + + getArg1() + { + return this.m_Arg1; + } + + getArg2() + { + return this.m_Arg2; + } + + setOperator(strOperator) + { + this.m_strOperator = strOperator; + } + + isSimple() + { + return this.m_strOperator == ""; + } + + evaluate() + { + var Result + + if (this.m_strOperator == "!") + Result = !this.m_Arg2.evaluate(); + else if (this.m_strOperator == "+") + Result = this.m_Arg1.evaluate(); + else if (this.m_strOperator == "-") + Result = -1 * this.m_Arg1.evaluate(); + else if (this.m_strOperator == "") + Result = this.m_Arg1.evaluate(); + else if (this.m_strOperator == "==") + Result = this.m_Arg1.evaluate() == this.m_Arg2.evaluate(); + else if (this.m_strOperator == "!=") + Result = this.m_Arg1.evaluate() != this.m_Arg2.evaluate(); + else if (this.m_strOperator == ">") + Result = this.m_Arg1.evaluate() > this.m_Arg2.evaluate(); + else if (this.m_strOperator == ">=") + Result = this.m_Arg1.evaluate() >= this.m_Arg2.evaluate(); + else if (this.m_strOperator == "<") + Result = this.m_Arg1.evaluate() < this.m_Arg2.evaluate(); + else if (this.m_strOperator == "<=") + Result = this.m_Arg1.evaluate() <= this.m_Arg2.evaluate(); + else if (this.m_strOperator == "+") + Result = this.m_Arg1.evaluate() + this.m_Arg2.evaluate(); + else if (this.m_strOperator == "-") + Result = this.m_Arg1.evaluate() - this.m_Arg2.evaluate(); + else if (this.m_strOperator == "*") + Result = this.m_Arg1.evaluate() * this.m_Arg2.evaluate(); + else if (this.m_strOperator == "/") + Result = this.m_Arg1.evaluate() / this.m_Arg2.evaluate(); + + return Result; + } + + isEmpty() + { + return (this.m_Arg1 == null) && (this.m_strOperator == "") && (this.m_Arg2 == null); + } + + hasArg1() + { + return this.m_Arg1 != null; + } + + isComplete() + { + return (this.m_Arg1 != null) && (this.m_strOperator != "") && (this.m_Arg2 != null); + } + + toString() + { + var strExpression = ""; + + if ((this.m_Arg1 == null) && (this.m_Arg2 != null)) + { + if ((this.m_strOperator == "!") || (this.m_strOperator == "-") || (this.m_strOperator == "+")) + strExpression = this.m_strOperator + this.m_Arg2.toString("", ""); + else + doErrorMessage("CExpression::toString, unexptected operator for argument 2 '" + this.m_strOperator + "'!"); + } + else if ((this.m_Arg1 != null) && (this.m_Arg2 == null) && (this.m_strOperator == "")) + { + strExpression = this.m_Arg1.toString("", ""); + } + else if ((this.m_Arg1 != null) && (this.m_Arg2 != null) && (this.m_strOperator != "")) + { + strExpression = "(" + this.m_Arg1.toString("", "") + " " + this.m_strOperator + " " + this.m_Arg2.toString("", "") + ")"; + } + else + doErrorMessage("CExpression::toString!"); + + return strExpression; + } + + }; + + class CVariableStatement + { + constructor() + { + this.m_strVariableName = null; + this.m_strOperator = ""; + this.m_Expression = null; + this.m_strKINDOF = "VARIABLE STATEMENT"; + } + + init(strVariableName, strOperator, Expression) + { + this.m_strVariableName = strVariableName; + this.m_strOperator = strOperator; + this.m_Expression = Expression; + } + + getName() + { + return this.m_strVariableName; + } + + getOperator() + { + return this.m_strOperator; + } + + getName() + { + return this.m_strVariableName; + } + + evaluate() + { + var NewValue = this.m_Expression.evaluate(), + OldValue = g_arrayGlobalVariables.find(this.strVariableName); + + if (this.m_strOperator == "=") + g_arrayGlobalVariables.setValue(this.strVariableName, NewValue); + else if (this.m_strOperator == "+=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue + NewValue); + else if (this.m_strOperator == "-=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue - NewValue); + else if (this.m_strOperator == "*=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue * NewValue); + else if (this.m_strOperator == "/=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue / NewValue); + else if (this.m_strOperator == "&=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue & NewValue); + else if (this.m_strOperator == "|=") + g_arrayGlobalVariables.setValue(this.strVariableName, OldValue | NewValue); + else + alert("ERROR: CVariableStatement::evaluate, invalid operator '" + this.m_strOperator + "'!"); + } + + isEmpty() + { + return (this.m_strVariableName == "") && (this.m_strOperator == "") && this.m_Expression.isEmpty(); + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + this.m_strVariableName + " " + this.m_strOperator + " "; + + if (this.m_Expression == null) + strText += "null" + ";" + strNewLine; + else + strText += this.m_Expression.toString("", "") + ";" + strNewLine; + + return strText; + } + + }; + + class CStatementArray + { + constructor() + { + this.m_arrayStatements = []; + this.m_strKINDOF = "STATEMENT ARRAY"; + }; + + getLength() + { + this.m_arrayStatements.length; + } + + add(Statement) + { + this.m_arrayStatements.push(Statement); + }; + + isEmpty() + { + return this.m_arrayStatements.length == 0; + } + evaluate() + { + for (let nI = 0; nI < this.m_arrayStatements.length; nI++) + m_arrayStatements.evaluate(); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayStatements.length; nI++) + { + strText += this.m_arrayStatements[nI].toString(strNewLine, strIndent); + } + return strText; + } + + }; + + class CForStatement + { + constructor() + { + this.m_strCounterVarName = ""; + this.m_ExpressionStart = null; + this.m_ExpressionEnd = null; + this.m_ExpressionContinue = null; + this.m_strOperator = ""; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "FOR"; + } + + init(strCounterVarName, ExpressionStart, ExpressionEnd, ExpressionContinue, strOperator, arrayStatements) + { + this.m_strCounterVarName = strCounterVarName; + this.m_ExpressionStart = ExpressionStart; + this.m_ExpressionEnd = ExpressionEnd; + this.m_ExpressionContinue = ExpressionContinue; + this.m_strOperator = strOperator; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + for (let nI = this.m_ExpressionStart.evaluate(); nI < this.m_ExpressionContinue.m_ExpressionEnd(); n += this.m_ExpressionContinue.evaluate()) + { + strReturnVal = this.m_arrayStatements.evaluate(); + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "for (" + this.m_strCounterVarName + " = " + this.m_ExpressionStart.toString("", "") + "; " + + this.m_strCounterVarName + " " + this.m_strOperator + " " + this.m_ExpressionEnd.toString("", "") + "; " + + this.m_strCounterVarName + this.m_ExpressionContinue + ")" + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + + return strText; + } + + } + + class CWhileStatement + { + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "WHILE"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + while (this.m_Expression.evaluate()) + { + strReturnVal = this.m_arrayStatements.evaluate(); + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "while " + this.m_Expression.toString("", "") + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + + return strText; + } + } + + class CRepeatStatement + { + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "REPEAT"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + evaluate() + { + var strReturnVal = ""; + + do + { + strReturnVal = this.m_arrayStatements.evaluate(); + + if (strReturnVal == null) + continue; + else if (strReturnVal == "break") + break; + } + while (this.m_Expression.evaluate()); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + strText += strIndent + "do" + strNewLine; + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + strText += strIndent + "while " + this.m_Expression.toString("", "") + ";" + strNewLine; + + return strText; + } + } + + class CBreak + { + constructor() + { + this.m_strKINDOF = "BREAK"; + } + + evaluate() + { + return "break"; + } + + toString(strNewLine, strIndent) + { + return strIndent + "break" + strNewLine; + } + + } + + class CCaseArray + { + constructor() + { + this.m_Expression = null; + this.m_arrayCases = []; + this.m_strKINDOF = "CASE ARRAY"; + } + + getLength() + { + this.m_arrayCases.length; + } + + add(Case) + { + this.m_arrayCases.push(Case); + }; + + isEmpty() + { + return this.m_arrayCases.length == 0; + } + evaluate() + { + for (let nI = 0; nI < this.m_arrayCases.length; nI++) + m_arrayCases.evaluate(); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayCases.length; nI++) + { + strText += this.m_arrayCases[nI].toString(strNewLine, strIndent); + } + return strText; + } + } + + class CSwitchCase + { + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "CASE"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + setExpression(Expression) + { + this.m_Expression = Expression; + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + "case "; + + strText += this.m_Expression.toString("", ""); + strText += ":" + strNewLine + strIndent + "{" + strNewLine + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent) + strText += strIndent + "}" + strNewLine + strNewLine; + + return strText; + } + } + + class CSwitchStatement + { + constructor() + { + this.m_Expression = null; + this.m_arrayCases = new CCaseArray(); + this.m_arrayDefaultStatements = null; + this.m_strKINDOF = "SWITCH"; + } + + init(Expression, arrayCases) + { + this.m_Expression = Expression; + this.m_m_arrayCases = arrayCases; + this.m_arrayDefaultStatements = null; + } + + setDefault(arrayDefaultStatements) + { + this.m_arrayDefaultStatements = arrayDefaultStatements; + } + + setExpression(Expression) + { + this.m_Expression = Expression; + } + + setCases(arrayCases) + { + this.m_arrayCases = arrayCases; + } + + addCase(Case) + { + this.m_arrayCases.add(Case); + } + + toString(strNewLine, strIndent) + { + var strText = strIndent + "switch ("; + + strText += this.m_Expression.toString("", ""); + strText += ")" + strNewLine + strIndent + "{" + strNewLine; + strText += this.m_arrayCases.toString(strNewLine, strIndent + g_strIndent); + if (this.m_arrayDefaultStatements != null) + { + strText += strIndent + g_strIndent + "default:" + strNewLine; + strText += strIndent + g_strIndent + "{" + strNewLine; + strText += this.m_arrayDefaultStatements.toString(strNewLine, strIndent + g_strIndent + g_strIndent); + strText += strIndent + g_strIndent + "}" + strNewLine; + } + strText += strIndent + "}" + strNewLine; + + return strText; + } + } + + class CIfStatement + { + constructor() + { + this.m_Expression = null; + this.m_arrayStatements = new CStatementArray(); + this.m_Next = null; + this.m_strKINDOF = "IF"; + } + + init(Expression, arrayStatements) + { + this.m_Expression = Expression; + this.m_arrayStatements = arrayStatements; + this.m_Next = null; + } + + setKindOf(strKindOf) + { + this.m_strKINDOF = strKindOf; + } + + getNext() + { + return this.m_Next; + } + + setNext(Next) + { + this.m_Next = Next; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + if (this.m_Expression != null) + { + if (this.m_strKINDOF == "IF") + { + strText = strIndent + "if " + this.m_Expression.toString("", "") + strNewLine; + } + else if (this.m_strKINDOF == "ELSE IF") + { + strText = strIndent + "else if " + this.m_Expression.toString("", "") + strNewLine; + } + } + else + strText = strIndent + "else" + strNewLine; + + strText += strIndent + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += strIndent + "}" + strNewLine; + if (this.m_Next != null) + strText += this.m_Next.toString(strNewLine, strIndent); + + return strText; + } + } + + class CFunction + { + constructor() + { + this.m_strFunctionName = ""; + this.m_strReturnType = ""; + this.m_arrayParams = new CVariableArray(); + this.m_arrayStatements = new CStatementArray(); + this.m_strKINDOF = "FUNCTION"; + } + + init(strFuncName, strReturnType, arrayParams, arrayStatements) + { + this.m_strFunctionName = strFuncName; + this.m_strReturnType = strReturnType; + this.m_arrayParams = arrayParams; + this.m_arrayStatements = arrayStatements; + } + + addStatement(Statement) + { + this.m_arrayStatements.add(Statement); + } + + setStatementList(arrayStatement) + { + this.m_arrayStatements = arrayStatement; + } + + addParam(Param) + { + this.m_arrayParams.add(Param); + } + + setStatementList(arrayParams) + { + this.m_arrayStatements = arrayParams; + } + + getName() + { + return this.m_strFunctionName; + } + + getParam(nI) + { + var Param = null; + + if (nI >= this.m_arrayParams.getLength()) + alert("ERROR: CFunction::getParam, '" + nI + "' is an invalid parameter number (" + this.m_arrayParams.getLength() + ")!"); + else + { + Param = this.m_arrayParams[nI]; + } + return Param; + } + + evaluate() //(...) + { + for (let nI = 0; nI < arguments.length; nI++) + { + if (nI < this.m_arrayParams.getLength()) + this.m_arrayParams.setValue(nI, arguments[nI]); + } + for (let nI = 0; nI < arguments.length; nI++) + this.m_arrayStatements; + } + + isEmpty() + { + return (this.m_strFunctionName == "") && (this.m_strReturnType == "") && this.m_arrayParams.isEmpty() && this.m_arrayStatements.isEmpty(); + } + + toString(strNewLine, strIndent) + { + var strText = this.m_strReturnType + " " + this.m_strFunctionName + "(" + this.m_arrayParams.toString("", "") + ")"; + strText += strNewLine + "{" + strNewLine; + strText += this.m_arrayStatements.toString(strNewLine, strIndent + g_strIndent); + strText += "}" + strNewLine; + + return strText; + } + + }; + + class CFunctionArray + { + constructor() + { + this.m_arrayFunctions = []; + this.m_strKINDOF = "FUNCTION ARRAY"; + } + + add(strName, arrayParams, arrayStatements) + { + var Function = new CFunction() + Function.init(strName, arrayParams, arrayStatements); + this.add(Function); + } + + getLength() + { + return this.m_arrayFunctions.length; + } + + add(Function) + { + this.m_arrayFunctions.push(Function); + } + + find(strName) + { + var Function = null; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + { + if (this.m_arrayFunctions[nI].getName() == strName) + { + Function = this.m_arrayFunctions[nI]; + break; + } + } + return Function; + } + + indexOf(strName) + { + var nIndex = -1; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + { + if (this.m_arrayFunctions[nI].getName() == strName) + { + nIndex = nI; + break; + } + } + return nIndex; + } + + getNameAt(nI) + { + var strName = ""; + + if ((nI >= 0) && (nI < this.m_arrayFunctions.length)) + strName = this.m_arrayFunctions[nI].getName(); + + return strName; + } + + isEmpty() + { + return this.m_arrayFunctions.length == 0; + } + + toString(strNewLine, strIndent) + { + var strText = ""; + + for (let nI = 0; nI < this.m_arrayFunctions.length; nI++) + strText += this.m_arrayFunctions[nI].toString(strNewLine, strIndent); + + return strText; + } + + }; + + g_arrayArduinoFunctions = ["Serial.print", "Serial.println", "Serial.begin", "digtalRead", "digtalWrite", + "analogRead", "analogWrite", "pinMode", "setup", "loop"]; + + function isArduinoFunctionCall(strFuncName) + { + var bResult = false; + + for (let nI = 0; nI < g_arrayArduinoFunctions.length; nI++) + { + bResult = strFuncName == g_arrayArduinoFunctions[nI]; + if (bResult) + break; + } + return bResult; + } + + class CFunctionCall + { + constructor() + { + this.m_strFuncName = ""; + this.m_arrayParams = new CVariableArray(); + this.m_strKINDOF = "FUNCTION CALL"; + } + + init(strFuncName) + { + //var Function = g_arrayFunctions.find(strFuncName); + + if ((Function == null) && !isArduinoFunctionCall(strFuncName)) + alert("ERROR: CFunctionCall:init, function '" + strFuncName + "' not found!"); + else + this.m_strFuncName = strFuncName; + } + + addParameter(Parameter) + { + this.m_arrayParams.add(Parameter); + } + + setParameters(arrayParameters) + { + this.m_arrayParams = arrayParameters; + } + + isEmpty() + { + return (this.m_strFunctionName == "") && (this.m_arrayParams.length == 0); + } + + toString(strNewLine, strIndent) + { + var strFuncCall = ""; + + if (strNewLine == "") + { + strFuncCall = this.m_strFuncName + "(" + this.m_arrayParams.toString("") + ")"; + } + else + { + strFuncCall = strIndent + this.m_strFuncName + "(" + this.m_arrayParams.toString("") + ");" + strNewLine; + } + return strFuncCall; + } + + }; + + diff --git a/ardublockly/FileReader.js b/ardublockly/FileReader.js new file mode 100644 index 0000000000..b7b4d6aa9d --- /dev/null +++ b/ardublockly/FileReader.js @@ -0,0 +1,432 @@ +/*! +FileReader.js - v0.99 +A lightweight wrapper for common FileReader usage. +Copyright 2014 Brian Grinstead - MIT License. +See http://github.com/bgrins/filereader.js for documentation. +*/ + +(function(window, document) { + + var FileReader = window.FileReader; + var FileReaderSyncSupport = false; + var workerScript = "self.addEventListener('message', function(e) { var data=e.data; try { var reader = new FileReaderSync; postMessage({ result: reader[data.readAs](data.file), extra: data.extra, file: data.file})} catch(e){ postMessage({ result:'error', extra:data.extra, file:data.file}); } }, false);"; + var syncDetectionScript = "onmessage = function(e) { postMessage(!!FileReaderSync); };"; + var fileReaderEvents = ['loadstart', 'progress', 'load', 'abort', 'error', 'loadend']; + var sync = false; + var FileReaderJS = window.FileReaderJS = { + enabled: false, + setupInput: setupInput, + setupDrop: setupDrop, + setupClipboard: setupClipboard, + setSync: function (value) { + sync = value; + + if (sync && !FileReaderSyncSupport) { + checkFileReaderSyncSupport(); + } + }, + getSync: function() { + return sync && FileReaderSyncSupport; + }, + output: [], + opts: { + dragClass: "drag", + accept: false, + readAsDefault: 'DataURL', + readAsMap: { + }, + on: { + loadstart: noop, + progress: noop, + load: noop, + abort: noop, + error: noop, + loadend: noop, + skip: noop, + groupstart: noop, + groupend: noop, + beforestart: noop + } + } + }; + + // Setup jQuery plugin (if available) + if (typeof(jQuery) !== "undefined") { + jQuery.fn.fileReaderJS = function(opts) { + return this.each(function() { + if (jQuery(this).is("input")) { + setupInput(this, opts); + } + else { + setupDrop(this, opts); + } + }); + }; + + jQuery.fn.fileClipboard = function(opts) { + return this.each(function() { + setupClipboard(this, opts); + }); + }; + } + + // Not all browsers support the FileReader interface. Return with the enabled bit = false. + if (!FileReader) { + return; + } + + + // makeWorker is a little wrapper for generating web workers from strings + function makeWorker(script) { + var URL = window.URL || window.webkitURL; + var Blob = window.Blob; + var Worker = window.Worker; + + if (!URL || !Blob || !Worker || !script) { + return null; + } + + var blob = new Blob([script]); + var worker = new Worker(URL.createObjectURL(blob)); + return worker; + } + + // setupClipboard: bind to clipboard events (intended for document.body) + function setupClipboard(element, opts) { + + if (!FileReaderJS.enabled) { + return; + } + var instanceOptions = extend(extend({}, FileReaderJS.opts), opts); + + element.addEventListener("paste", onpaste, false); + + function onpaste(e) { + var files = []; + var clipboardData = e.clipboardData || {}; + var items = clipboardData.items || []; + + for (var i = 0; i < items.length; i++) { + var file = items[i].getAsFile(); + + if (file) { + + // Create a fake file name for images from clipboard, since this data doesn't get sent + var matches = new RegExp("/\(.*\)").exec(file.type); + if (!file.name && matches) { + var extension = matches[1]; + file.name = "clipboard" + i + "." + extension; + } + + files.push(file); + } + } + + if (files.length) { + processFileList(e, files, instanceOptions); + e.preventDefault(); + e.stopPropagation(); + } + } + } + + // setupInput: bind the 'change' event to an input[type=file] + function setupInput(input, opts) { + + if (!FileReaderJS.enabled) { + return; + } + var instanceOptions = extend(extend({}, FileReaderJS.opts), opts); + + input.addEventListener("change", inputChange, false); + input.addEventListener("drop", inputDrop, false); + + function inputChange(e) { + processFileList(e, input.files, instanceOptions); + } + + function inputDrop(e) { + e.stopPropagation(); + e.preventDefault(); + processFileList(e, e.dataTransfer.files, instanceOptions); + } + } + + // setupDrop: bind the 'drop' event for a DOM element + function setupDrop(dropbox, opts) { + + if (!FileReaderJS.enabled) { + return; + } + var instanceOptions = extend(extend({}, FileReaderJS.opts), opts); + var dragClass = instanceOptions.dragClass; + var initializedOnBody = false; + + // Bind drag events to the dropbox to add the class while dragging, and accept the drop data transfer. + dropbox.addEventListener("dragenter", onlyWithFiles(dragenter), false); + dropbox.addEventListener("dragleave", onlyWithFiles(dragleave), false); + dropbox.addEventListener("dragover", onlyWithFiles(dragover), false); + dropbox.addEventListener("drop", onlyWithFiles(drop), false); + + // Bind to body to prevent the dropbox events from firing when it was initialized on the page. + document.body.addEventListener("dragstart", bodydragstart, true); + document.body.addEventListener("dragend", bodydragend, true); + document.body.addEventListener("drop", bodydrop, false); + + function bodydragend(e) { + initializedOnBody = false; + } + + function bodydragstart(e) { + initializedOnBody = true; + } + + function bodydrop(e) { + if (e.dataTransfer.files && e.dataTransfer.files.length ){ + e.stopPropagation(); + e.preventDefault(); + } + } + + function onlyWithFiles(fn) { + return function() { + if (!initializedOnBody) { + fn.apply(this, arguments); + } + }; + } + + function drop(e) { + e.stopPropagation(); + e.preventDefault(); + if (dragClass) { + removeClass(dropbox, dragClass); + } + processFileList(e, e.dataTransfer.files, instanceOptions); + } + + function dragenter(e) { + e.stopPropagation(); + e.preventDefault(); + if (dragClass) { + addClass(dropbox, dragClass); + } + } + + function dragleave(e) { + if (dragClass) { + removeClass(dropbox, dragClass); + } + } + + function dragover(e) { + e.stopPropagation(); + e.preventDefault(); + if (dragClass) { + addClass(dropbox, dragClass); + } + } + } + + // setupCustomFileProperties: modify the file object with extra properties + function setupCustomFileProperties(files, groupID) { + for (var i = 0; i < files.length; i++) { + var file = files[i]; + file.extra = { + nameNoExtension: file.name.substring(0, file.name.lastIndexOf('.')), + extension: file.name.substring(file.name.lastIndexOf('.') + 1), + fileID: i, + uniqueID: getUniqueID(), + groupID: groupID, + prettySize: prettySize(file.size) + }; + } + } + + // getReadAsMethod: return method name for 'readAs*' - http://www.w3.org/TR/FileAPI/#reading-a-file + function getReadAsMethod(type, readAsMap, readAsDefault) { + for (var r in readAsMap) { + if (type.match(new RegExp(r))) { + return 'readAs' + readAsMap[r]; + } + } + return 'readAs' + readAsDefault; + } + + // processFileList: read the files with FileReader, send off custom events. + function processFileList(e, files, opts) { + + var filesLeft = files.length; + var group = { + groupID: getGroupID(), + files: files, + started: new Date() + }; + + function groupEnd() { + group.ended = new Date(); + opts.on.groupend(group); + } + + function groupFileDone() { + if (--filesLeft === 0) { + groupEnd(); + } + } + + FileReaderJS.output.push(group); + setupCustomFileProperties(files, group.groupID); + + opts.on.groupstart(group); + + // No files in group - end immediately + if (!files.length) { + groupEnd(); + return; + } + + var supportsSync = sync && FileReaderSyncSupport; + var syncWorker; + + // Only initialize the synchronous worker if the option is enabled - to prevent the overhead + if (supportsSync) { + syncWorker = makeWorker(workerScript); + syncWorker.onmessage = function(e) { + var file = e.data.file; + var result = e.data.result; + + // Workers seem to lose the custom property on the file object. + if (!file.extra) { + file.extra = e.data.extra; + } + + file.extra.ended = new Date(); + + // Call error or load event depending on success of the read from the worker. + opts.on[result === "error" ? "error" : "load"]({ target: { result: result } }, file); + groupFileDone(); + }; + } + + Array.prototype.forEach.call(files, function(file) { + + file.extra.started = new Date(); + + if (opts.accept && !file.type.match(new RegExp(opts.accept))) { + opts.on.skip(file); + groupFileDone(); + return; + } + + if (opts.on.beforestart(file) === false) { + opts.on.skip(file); + groupFileDone(); + return; + } + + var readAs = getReadAsMethod(file.type, opts.readAsMap, opts.readAsDefault); + + if (syncWorker) { + syncWorker.postMessage({ + file: file, + extra: file.extra, + readAs: readAs + }); + } + else { + + var reader = new FileReader(); + reader.originalEvent = e; + + fileReaderEvents.forEach(function(eventName) { + reader['on' + eventName] = function(e) { + if (eventName == 'load' || eventName == 'error') { + file.extra.ended = new Date(); + } + opts.on[eventName](e, file); + if (eventName == 'loadend') { + groupFileDone(); + } + }; + }); + reader[readAs](file); + } + }); + } + + // checkFileReaderSyncSupport: Create a temporary worker and see if FileReaderSync exists + function checkFileReaderSyncSupport() { + var worker = makeWorker(syncDetectionScript); + if (worker) { + worker.onmessage =function(e) { + FileReaderSyncSupport = e.data; + }; + worker.postMessage({}); + } + } + + // noop: do nothing + function noop() { + + } + + // extend: used to make deep copies of options object + function extend(destination, source) { + for (var property in source) { + if (source[property] && source[property].constructor && + source[property].constructor === Object) { + destination[property] = destination[property] || {}; + arguments.callee(destination[property], source[property]); + } + else { + destination[property] = source[property]; + } + } + return destination; + } + + // hasClass: does an element have the css class? + function hasClass(el, name) { + return new RegExp("(?:^|\\s+)" + name + "(?:\\s+|$)").test(el.className); + } + + // addClass: add the css class for the element. + function addClass(el, name) { + if (!hasClass(el, name)) { + el.className = el.className ? [el.className, name].join(' ') : name; + } + } + + // removeClass: remove the css class from the element. + function removeClass(el, name) { + if (hasClass(el, name)) { + var c = el.className; + el.className = c.replace(new RegExp("(?:^|\\s+)" + name + "(?:\\s+|$)", "g"), " ").replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + } + } + + // prettySize: convert bytes to a more readable string. + function prettySize(bytes) { + var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB']; + var e = Math.floor(Math.log(bytes)/Math.log(1024)); + return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e]; + } + + // getGroupID: generate a unique int ID for groups. + var getGroupID = (function(id) { + return function() { + return id++; + }; + })(0); + + // getUniqueID: generate a unique int ID for files + var getUniqueID = (function(id) { + return function() { + return id++; + }; + })(0); + + // The interface is supported, bind the FileReaderJS callbacks + FileReaderJS.enabled = true; + +})(this, document); \ No newline at end of file diff --git a/ardublockly/FileSaver.js b/ardublockly/FileSaver.js new file mode 100644 index 0000000000..7b66e7c0da --- /dev/null +++ b/ardublockly/FileSaver.js @@ -0,0 +1,171 @@ +/* +* FileSaver.js +* A saveAs() FileSaver implementation. +* +* By Eli Grey, http://eligrey.com +* +* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) +* source : http://purl.eligrey.com/github/FileSaver.js +*/ + +// The one and only way of getting global scope in all environments +// https://stackoverflow.com/q/3277182/1008999 +var _global = typeof window === 'object' && window.window === window + ? window : typeof self === 'object' && self.self === self + ? self : typeof global === 'object' && global.global === global + ? global + : this + +function bom (blob, opts) { + if (typeof opts === 'undefined') opts = { autoBom: false } + else if (typeof opts !== 'object') { + console.warn('Deprecated: Expected third argument to be a object') + opts = { autoBom: !opts } + } + + // prepend BOM for UTF-8 XML and text/* types (including HTML) + // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF + if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { + return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type }) + } + return blob +} + +function download (url, name, opts) { + var xhr = new XMLHttpRequest() + xhr.open('GET', url) + xhr.responseType = 'blob' + xhr.onload = function () { + saveAs(xhr.response, name, opts) + } + xhr.onerror = function () { + console.error('could not download file') + } + xhr.send() +} + +function corsEnabled (url) { + var xhr = new XMLHttpRequest() + // use sync to avoid popup blocker + xhr.open('HEAD', url, false) + try { + xhr.send() + } catch (e) {} + return xhr.status >= 200 && xhr.status <= 299 +} + +// `a.click()` doesn't work for all browsers (#465) +function click (node) { + try { + node.dispatchEvent(new MouseEvent('click')) + } catch (e) { + var evt = document.createEvent('MouseEvents') + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, + 20, false, false, false, false, 0, null) + node.dispatchEvent(evt) + } +} + +// Detect WebView inside a native macOS app by ruling out all browsers +// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too +// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos +var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent) + +var saveAs = _global.saveAs || ( + // probably in some web worker + (typeof window !== 'object' || window !== _global) + ? function saveAs () { /* noop */ } + + // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView + : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView) + ? function saveAs (blob, name, opts) { + var URL = _global.URL || _global.webkitURL + var a = document.createElement('a') + name = name || blob.name || 'download' + + a.download = name + a.rel = 'noopener' // tabnabbing + + // TODO: detect chrome extensions & packaged apps + // a.target = '_blank' + + if (typeof blob === 'string') { + // Support regular links + a.href = blob + if (a.origin !== location.origin) { + corsEnabled(a.href) + ? download(blob, name, opts) + : click(a, a.target = '_blank') + } else { + click(a) + } + } else { + // Support blobs + a.href = URL.createObjectURL(blob) + setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s + setTimeout(function () { click(a) }, 0) + } + } + + // Use msSaveOrOpenBlob as a second approach + : 'msSaveOrOpenBlob' in navigator + ? function saveAs (blob, name, opts) { + name = name || blob.name || 'download' + + if (typeof blob === 'string') { + if (corsEnabled(blob)) { + download(blob, name, opts) + } else { + var a = document.createElement('a') + a.href = blob + a.target = '_blank' + setTimeout(function () { click(a) }) + } + } else { + navigator.msSaveOrOpenBlob(bom(blob, opts), name) + } + } + + // Fallback to using FileReader and a popup + : function saveAs (blob, name, opts, popup) { + // Open a popup immediately do go around popup blocker + // Mostly only available on user interaction and the fileReader is async so... + popup = popup || open('', '_blank') + if (popup) { + popup.document.title = + popup.document.body.innerText = 'downloading...' + } + + if (typeof blob === 'string') return download(blob, name, opts) + + var force = blob.type === 'application/octet-stream' + var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari + var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent) + + if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') { + // Safari doesn't allow downloading of blob URLs + var reader = new FileReader() + reader.onloadend = function () { + var url = reader.result + url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;') + if (popup) popup.location.href = url + else location = url + popup = null // reverse-tabnabbing #460 + } + reader.readAsDataURL(blob) + } else { + var URL = _global.URL || _global.webkitURL + var url = URL.createObjectURL(blob) + if (popup) popup.location = url + else location.href = url + popup = null // reverse-tabnabbing #460 + setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s + } + } +) + +_global.saveAs = saveAs.saveAs = saveAs + +if (typeof module !== 'undefined') { + module.exports = saveAs; +} diff --git a/ardublockly/GeneralDataStructures.js b/ardublockly/GeneralDataStructures.js new file mode 100644 index 0000000000..60e6738f21 --- /dev/null +++ b/ardublockly/GeneralDataStructures.js @@ -0,0 +1,203 @@ +//************************************************************************* +//* +//* POSITION +//* +//************************************************************************* + +class CPoint +{ + constructor(nX, nY) + { + if (typeof(nX) === "undefined") + this.m_nX = 0; + else + this.m_nX = nX; + + if (typeof(nY) === "undefined") + this.m_nY = 0; + else + this.m_nY = nY; + } + + initEvent(Event) + { + this.m_nX = Event.clientX; + this.m_nY = Event.clientY; + } + + relativeToID(strElementID) + { + relativeTo(document.getElementById(strElementID)); + } + + relativeTo(Element) + { + var rect = null; + + if (Element != null) + { + rect = Element.getBoundingClientRect(); + this.m_nX = event.clientX - rect.left + g_pointCanvasScrollPos.m_nX; + this.m_nY = event.clientY - rect.top + g_pointCanvasScrollPos.m_nY; + } + } + + isEmpty() + { + return (this.m_nX == 0) && (this.m_nY == 0); + } + + isGreater(pointOther) + { + return (this.m_nX > pointOther.m_nX) || (this.m_nY > pointOther.m_nY); + } + + isLesser(pointOther) + { + return (this.m_nX < pointOther.m_nX) || (this.m_nY < pointOther.m_nY); + } + + isEqual(pointOther) + { + return (this.m_nX == pointOther.m_nX) && (this.m_nY == pointOther.m_nY); + } + + isGreaterOrEqual() + { + return isGreater(pointOther) || isEqual(pointOther); + } + + isLesserOrEqual() + { + return isLesser(pointOther) || isEqual(pointOther); + } + + move(nX, nY) + { + this.m_nX += nX; + this.m_nY += nY; + } + +} + + + + +//************************************************************************* +//* +//* SIZE +//* +//************************************************************************* + +class CSize +{ + constructor(nWidth, nHeight) + { + if (typeof(nWidth) === "undefined") + this.m_nWidth = 0; + else + this.m_nWidth = nWidth; + + if (typeof(nHeight) === "undefined") + this.m_nHeight = 0; + else + this.m_nHeight = nHeight; + } + + isEmpty() + { + return (this.m_nWidth == 0) && (this.m_nHeight == 0); + } + +} + + + + + +//************************************************************************* +//* +//* RECTANGLE +//* +//************************************************************************* + +class CRectangle +{ + constructor(pointTL, size) + { + if (typeof(pointTL) === "undefined") + this.m_pointTL = new CPoint(0, 0); + else + this.m_pointTL = new CPoint(pointTL.m_nX, pointTL.m_nY); + + if (typeof(size) === "undefined") + this.m_size = new CSize(0, 0); + else + this.m_size = new CSize(size.m_nWidth, size.m_nHeight); + } + + set(pointTL, size) + { + this.m_size = new CSize(size.m_nWidth, size.m_nHeight); + this.m_pointTL = new CPoint(pointTL.m_nX, pointTL.m_nY); + } + + setPosition(pointTL) + { + this.m_pointTL = new CPoint(pointTL.m_nX, pointTL.m_nY); + } + + setSize(size) + { + this.m_size = new CSize(size.m_nWidth, size.m_nHeight); + } + + relativeToID(strElementID) + { + relativeTo(document.getElementById(strElementID)); + } + + relativeTo(Element) + { + var rect = null; + + if (Element != null) + { + rect = Element.getBoundingClientRect(); + this.m_pointTL.m_nX = event.clientX - rect.left + g_pointCanvasScrollPos.m_nX; + this.m_pointTL.m_nY = event.clientY - rect.top + g_pointCanvasScrollPos.m_nY; + } + } + + addOffset(sizeOffset) + { + this.m_pointTL.m_nX += sizeOffset.m_nWidth; + this.m_pointTL.m_nY += sizeOffset.m_nHeight; + } + + isMouseIn(RelativeMousePos) + { + var nMaxX = this.m_pointTL.m_nX + this.m_size.m_nWidth; + var nMaxY = this.m_pointTL.m_nY + this.m_size.m_nHeight; + var bResult = (RelativeMousePos.m_nX >= this.m_pointTL.m_nX) && (RelativeMousePos.m_nX <= nMaxX) && + (RelativeMousePos.m_nY >= this.m_pointTL.m_nY) && (RelativeMousePos.m_nY <= nMaxY); + + //console.log("#####" + RelativeMousePos.m_nX + ", " + RelativeMousePos.m_nY + "####" + this.m_pointTL.m_nX + ", " + this.m_pointTL.m_nY + "####" + nMaxX + ", " + nMaxY + "####" + (RelativeMousePos.m_nX >= this.m_pointTL.m_nX) + ", " + (RelativeMousePos.m_nX <= nMaxX) + "####" + (RelativeMousePos.m_nY >= this.m_pointTL.m_nY) + ", " + (RelativeMousePos.m_nY <= nMaxY) + "####" + bResult); + + return bResult; + } + + getCenter() + { + var pointCenter = new CPoint(this.m_pointTL.m_nX + (this.m_size.m_nWidth / 2), this.m_pointTL.m_nY + (this.m_size.m_nHeight / 2)); + + return pointCenter; + } + + isEmpty() + { + return this.m_pointTL.isEmpty() && this.m_size.isEmpty(); + } + +} + diff --git a/ardublockly/GlobalVariables.js b/ardublockly/GlobalVariables.js new file mode 100644 index 0000000000..8fea0998fa --- /dev/null +++ b/ardublockly/GlobalVariables.js @@ -0,0 +1,9 @@ +//************************************************************************* +//* +//* GLOBAL VARIBALES +//* +//************************************************************************* + +var g_arrayFunctions = new CFunctionArray(); +var g_SetupFunc = null, g_LoopFunc = null; +var g_arrayGlobalVariables = new CVariableArray(); diff --git a/ardublockly/LEDDataStructures.js b/ardublockly/LEDDataStructures.js new file mode 100644 index 0000000000..c9a2d92602 --- /dev/null +++ b/ardublockly/LEDDataStructures.js @@ -0,0 +1,251 @@ +//************************************************************************* +//* +//* STANDARD LED +//* +//************************************************************************* + +function doClick(strDeviceName) +{ + var Component = g_mapPlacedComponents.get(strDeviceName); + + if ((Component != null) && (Component.getType() == "LED")) + { + if (Component.getBlown()) + Component.doUnblown(); + else + Component.doBlown(); + doDisplayAllComponents(); + } +} + + + + +class CLED extends CComponentBase +{ + static m_ImageObjectOff0 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_OFF.png"); + static m_ImageObjectOff90 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_OFF90.png"); + static m_ImageObjectOff180 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_OFF180.png"); + static m_ImageObjectOff270 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_OFF270.png"); + + static m_ImageObjectOn0 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_ON.png"); + static m_ImageObjectOn90 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_ON90.png"); + static m_ImageObjectOn180 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_ON180.png"); + static m_ImageObjectOn270 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_ON270.png"); + + static m_ImageObjectBlown0 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_BLOWN.png"); + static m_ImageObjectBlown90 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_BLOWN90.png"); + static m_ImageObjectBlown180 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_BLOWN180.png"); + static m_ImageObjectBlown270 = CComponentBase.doGetImageObject("img\\Components\\LEDs\\LED_BLOWN270.png"); + + constructor() + { + super("LED"); + this.m_bIsBlown = false; + this.m_bIsOn = false; + this.setDeviceName("LED1"); + this.m_ImageObject0 = CLED.m_ImageObjectOff0; + this.m_ImageObject90 = CLED.m_ImageObjectOff90; + this.m_ImageObject180 = CLED.m_ImageObjectOff180; + this.m_ImageObject270 = CLED.m_ImageObjectOff270; + this.m_fScale = this.m_fDefaultScale = 8.2; + this.m_fLEDVoltage = 2.4; + + this.doAddPin(new CPin(0, false, false, "anode", this.getDeviceName())); + this.doAddPin(new CPin(1, false, false, "cathode", this.getDeviceName())); + this.doRotate(0); + + this.m_strEditHTML += "  
"; + } + + getVoltage(strDeviceNameIn, strPinIDIn) + { + return -this.m_fLEDVoltage; + } + + getResistance(strDeviceNameIn, strPinIDIn) + { + return 0; + } + + doRead(strFileContents) + { + strFileContents = super.doRead(strFileContents); + + return strFileContents; + } + + doWrite() + { + var strFileContents = super.doWrite(); + + return strFileContents; + } + + doSetPinPositions() + { + if (this.m_nRotationAngle == 0) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(13, 32)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(2, 32)); + } + else if (this.m_nRotationAngle == 90) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(2, 13)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(2, 2)); + } + else if (this.m_nRotationAngle == 180) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(2, 2)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(13, 2)); + } + else if (this.m_nRotationAngle == 270) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(32, 2)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(32, 13)); + } + } + + doSelect() + { + this.m_bSelected = true; + var strHTML = this.m_strEditHTML; + strHTML = strHTML.replace("XXXX", this.m_strDeviceName); + strHTML = strHTML.replace("YYYY", this.m_strDeviceName); + doShowEditFields(strHTML); + } + + doTurnOn() + { + this.m_bIsOn = true; + this.m_ImageObject0 = CLED.m_ImageObjectOn0; + this.m_ImageObject90 = CLED.m_ImageObjectOn90; + this.m_ImageObject180 = CLED.m_ImageObjectOn180; + this.m_ImageObject270 = CLED.m_ImageObjectOn270; + } + + doTurnOff() + { + this.m_bIsOn = false; + this.m_ImageObject0 = CLED.m_ImageObjectOff0; + this.m_ImageObject90 = CLED.m_ImageObjectOff90; + this.m_ImageObject180 = CLED.m_ImageObjectOff180; + this.m_ImageObject270 = CLED.m_ImageObjectOff270; + } + + doBlown() + { + this.m_bIsBlown = true; + this.m_ImageObject0 = CLED.m_ImageObjectBlown0; + this.m_ImageObject90 = CLED.m_ImageObjectBlown90; + this.m_ImageObject180 = CLED.m_ImageObjectBlown180; + this.m_ImageObject270 = CLED.m_ImageObjectBlown270; + } + + doUnblown() + { + this.m_bIsBlown = false; + this.m_bIsOn = false; + this.m_ImageObject0 = CLED.m_ImageObjectOff0; + this.m_ImageObject90 = CLED.m_ImageObjectOff90; + this.m_ImageObject180 = CLED.m_ImageObjectOff180; + this.m_ImageObject270 = CLED.m_ImageObjectOff270; + } + + getBlown() + { + return this.m_bIsBlown; + } + + doStopRun() + { + doTurnOff(); + } + + doRun() + { + if (!this.m_bIsBlown) + { + var fAnodeVoltage = this.m_arrayPins[0].getVoltage(); + var fCathodVoltage = this.m_arrayPins[1].getVoltage(); + var fAnodeVoltage = this.m_arrayPins[0].getVoltage(); + var fCathodeResistance = 0; + var fCurrent = 0; + + if (!this.m_bIsBlown && ((fAnodeVoltage - fCathodVoltage) >= 2.4)) + { + fAnodeResistance = this.m_arrayPins[0].getResistance(); + fCathodeResistance = this.m_arrayPins[1].getResistance(); + fCurrent = (fAnodeVoltage - this.m_fLEDVoltage) / (fAnodeResistance + fCathodeResistance); + if (fCurrent > 0.035) + this.doBlown(); + else if (fCurrent >= 0.01) + this.doTurnOn(); + else + this.doTurnOff(); + } + else + this.doTurnOff(); + } + } + + doDisplay() + { + var fAnodeVoltage = this.m_arrayPins[0].getVoltage(); + var fMaxVoltage = g_mapPlacedComponents.get(g_strMCUName).getLogicVoltage(); + + if (fAnodeVoltage == fMaxVoltage) + { + this.doTurnOn(); + super.doDisplay(); + } + else + { + this.doTurnOff(); + super.doDisplay(); + + var point = new CPoint(this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY); + var nRadius = 8; + var strColor = ""; + + if (fAnodeVoltage < 1) + strColor = "#802020"; + else if ((fAnodeVoltage >= 1) && (fAnodeVoltage <= 1.5)) + strColor = "#8D2323"; + else if ((fAnodeVoltage >= 1.5) && (fAnodeVoltage < 2)) + strColor = "#9A2626"; + else if ((fAnodeVoltage >= 2) && (fAnodeVoltage < 2.5)) + strColor = "#A72929"; + else if ((fAnodeVoltage >= 2.5) && (fAnodeVoltage < 3)) + strColor = "#B42D2D"; + else if ((fAnodeVoltage >= 3) && (fAnodeVoltage < 3.5)) + strColor = "#C13030"; + else if ((fAnodeVoltage >= 3.5) && (fAnodeVoltage < 4)) + strColor = "#CE3333"; + else if ((fAnodeVoltage >= 4.5) && (fAnodeVoltage < 5)) + strColor = "#D83636"; + else + strColor = "#E83A3A"; + + if (this.m_nRotationAngle == 0) + point.move(9, 8); + else if (this.m_nRotationAngle == 90) + point.move(0, 0); + else if (this.m_nRotationAngle == 180) + point.move(0, 0); + else if (this.m_nRotationAngle == 270) + point.move(0, 0); + + g_CanvasContext.fillStyle = strColor; + g_CanvasContext.strokeStyle = strColor; + g_CanvasContext.beginPath(); + g_CanvasContext.arc(point.m_nX, point.m_nY, nRadius, 0, 2 * Math.PI); + g_CanvasContext.fillRect(point.m_nX - 8, point.m_nY + 3, 16, 11); + g_CanvasContext.stroke(); + g_CanvasContext.fill(); + } + } + +} + diff --git a/ardublockly/MCUDataStructures.js b/ardublockly/MCUDataStructures.js new file mode 100644 index 0000000000..ce062e1b69 --- /dev/null +++ b/ardublockly/MCUDataStructures.js @@ -0,0 +1,1364 @@ +//************************************************************************* +//* +//* ARDUINO MEGA +//* +//************************************************************************* + +class CArduinoMega extends CMCUBase +{ + static m_ImageObject0 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoMega.png"); + static m_ImageObject90 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoMega90.png"); + static m_ImageObject180 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoMega180.png"); + static m_ImageObject270 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoMega270.png"); + + constructor() + { + var strName = ""; + + super("MEGA"); + this.m_fScale = this.m_fDefaultScale = 1.9; + this.m_strDeviceName = "MEGA1"; + this.m_ImageObject0 = CArduinoMega.m_ImageObject0; + this.m_ImageObject90 = CArduinoMega.m_ImageObject90; + this.m_ImageObject180 = CArduinoMega.m_ImageObject180; + this.m_ImageObject270 = CArduinoMega.m_ImageObject270; + this.m_fVoltage = 5.0; + + for (var nI = 0, bIsPWM = false, bIsAnalog = false; nI <= 69; nI++) + { + bIsPWM = ((nI >= 2) && (nI <= 13)) || ((nI >= 44) && (nI <= 46)); + bIsAnalog = (nI >= 54) && (nI <= 69); + + if (nI == 0) + strName = "Rx"; + else if (nI == 1) + strName = "Tx"; + else if (nI == 14) + strName = "Tx1"; + else if (nI == 15) + strName = "Rx1"; + else if (nI == 16) + strName = "Tx2"; + else if (nI == 17) + strName = "Rx2"; + else if (nI == 18) + strName = "Tx3"; + else if (nI == 19) + strName = "Rx3"; + else if (nI == 20) + strName = "SDA"; + else if (nI == 21) + strName = "SCL"; + else if (bIsAnalog) + strName = "A" + (nI - 54).toString() + else + strName = nI.toString(); + + this.doAddPin(new CPin(nI, bIsPWM, bIsAnalog, strName, this.getDeviceName())); + } + this.m_nMaxPin = 70; + + this.doAddPin(new CResetPin(nI++, this.getDeviceName())); + this.doAddPin(new C3_3VPin(nI++, this.getDeviceName())); + this.doAddPin(new C5VPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + + this.doAddPin(new C5VPin(nI++, this.getDeviceName())); + this.doAddPin(new C5VPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doRotate(0); + + this.m_SPI = new CSPIPort(51, 50, 52, this.getDeviceName()); + this.m_I2C = new CI2CPort(21, 20, this.getDeviceName()); + this.m_Serial = new CSerialPort(1, 0, this.getDeviceName()); + this.m_Serial1 = new CSerialPort(14, 15, this.getDeviceName()); + this.m_Serial2 = new CSerialPort(16, 17, this.getDeviceName()); + this.m_Serial3 = new CSerialPort(18, 19, this.getDeviceName()); + this.setDeviceName(this.m_strDeviceName); + + this.m_mapAnalogPins.set("A0", 54); + this.m_mapAnalogPins.set("A1", 55); + this.m_mapAnalogPins.set("A2", 56); + this.m_mapAnalogPins.set("A3", 57); + this.m_mapAnalogPins.set("A4", 58); + this.m_mapAnalogPins.set("A5", 59); + this.m_mapAnalogPins.set("A6", 60); + this.m_mapAnalogPins.set("A7", 61); + this.m_mapAnalogPins.set("A8", 62); + this.m_mapAnalogPins.set("A9", 63); + this.m_mapAnalogPins.set("A10", 64); + this.m_mapAnalogPins.set("A11", 65); + this.m_mapAnalogPins.set("A12", 66); + this.m_mapAnalogPins.set("A13", 67); + this.m_mapAnalogPins.set("A14", 68); + this.m_mapAnalogPins.set("A15", 69); + + this.m_mapAnalogPins.set("Tx3", 14); + this.m_mapAnalogPins.set("Rx3", 15); + this.m_mapAnalogPins.set("Tx2", 16); + this.m_mapAnalogPins.set("Rx2", 17); + this.m_mapAnalogPins.set("Tx1", 18); + this.m_mapAnalogPins.set("Rx1", 19); + this.m_mapAnalogPins.set("SDA", 20); + this.m_mapAnalogPins.set("SCL", 21); + } + + doRun() + { + } + + doWrite() + { + return super.doWrite(); + } + + doSetPinPositions() + { + if (this.m_nRotationAngle == 0) + { + // Standard D0 -> D13 + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(378, 8)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(369, 8)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(360, 8)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(351, 8)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(342, 8)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(333, 8)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(324, 8)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(315, 8)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(298, 8)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(289, 8)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(280, 8)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(271, 8)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(262, 8)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(253, 8)); + + // Serial1, Serial2, Serial3 & I2C + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(435, 8)); // Tx1 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(444, 8)); // Rx1 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(416, 8)); // Tx2 + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(425, 8)); // Rx2 + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(398, 8)); // Tx3 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(407, 8)); // Rx3 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(453, 8)); // SDA + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(462, 8)); // SCL + + // D22 -> D54 + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(490, 17)); + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(499, 17)); + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(490, 27)); + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(499, 27)); + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(490, 36)); + this.doSetPinPos(27, this.m_rectangle.m_pointTL, new CSize(499, 36)); + this.doSetPinPos(28, this.m_rectangle.m_pointTL, new CSize(490, 45)); + this.doSetPinPos(29, this.m_rectangle.m_pointTL, new CSize(499, 45)); + this.doSetPinPos(30, this.m_rectangle.m_pointTL, new CSize(490, 55)); + this.doSetPinPos(31, this.m_rectangle.m_pointTL, new CSize(499, 55)); + this.doSetPinPos(32, this.m_rectangle.m_pointTL, new CSize(490, 64)); + this.doSetPinPos(33, this.m_rectangle.m_pointTL, new CSize(499, 64)); + this.doSetPinPos(34, this.m_rectangle.m_pointTL, new CSize(490, 73)); + this.doSetPinPos(35, this.m_rectangle.m_pointTL, new CSize(499, 73)); + this.doSetPinPos(36, this.m_rectangle.m_pointTL, new CSize(490, 82)); + this.doSetPinPos(37, this.m_rectangle.m_pointTL, new CSize(499, 82)); + this.doSetPinPos(38, this.m_rectangle.m_pointTL, new CSize(490, 92)); + this.doSetPinPos(39, this.m_rectangle.m_pointTL, new CSize(499, 92)); + this.doSetPinPos(40, this.m_rectangle.m_pointTL, new CSize(490, 101)); + this.doSetPinPos(41, this.m_rectangle.m_pointTL, new CSize(499, 101)); + this.doSetPinPos(42, this.m_rectangle.m_pointTL, new CSize(490, 110)); + this.doSetPinPos(43, this.m_rectangle.m_pointTL, new CSize(499, 110)); + this.doSetPinPos(44, this.m_rectangle.m_pointTL, new CSize(490, 120)); + this.doSetPinPos(45, this.m_rectangle.m_pointTL, new CSize(499, 120)); + this.doSetPinPos(46, this.m_rectangle.m_pointTL, new CSize(490, 129)); + this.doSetPinPos(47, this.m_rectangle.m_pointTL, new CSize(499, 129)); + this.doSetPinPos(48, this.m_rectangle.m_pointTL, new CSize(490, 138)); + this.doSetPinPos(49, this.m_rectangle.m_pointTL, new CSize(499, 138)); + this.doSetPinPos(50, this.m_rectangle.m_pointTL, new CSize(490, 148)); + this.doSetPinPos(51, this.m_rectangle.m_pointTL, new CSize(499, 148)); + this.doSetPinPos(52, this.m_rectangle.m_pointTL, new CSize(490, 157)); + this.doSetPinPos(53, this.m_rectangle.m_pointTL, new CSize(499, 157)); + + // A0 -> A15 + this.doSetPinPos(54, this.m_rectangle.m_pointTL, new CSize(332, 184)); + this.doSetPinPos(55, this.m_rectangle.m_pointTL, new CSize(341, 184)); + this.doSetPinPos(56, this.m_rectangle.m_pointTL, new CSize(350, 184)); + this.doSetPinPos(57, this.m_rectangle.m_pointTL, new CSize(359, 184)); + this.doSetPinPos(58, this.m_rectangle.m_pointTL, new CSize(369, 184)); + this.doSetPinPos(59, this.m_rectangle.m_pointTL, new CSize(378, 184)); + this.doSetPinPos(60, this.m_rectangle.m_pointTL, new CSize(388, 184)); + this.doSetPinPos(61, this.m_rectangle.m_pointTL, new CSize(398, 184)); + this.doSetPinPos(62, this.m_rectangle.m_pointTL, new CSize(416, 184)); + this.doSetPinPos(63, this.m_rectangle.m_pointTL, new CSize(425, 184)); + this.doSetPinPos(64, this.m_rectangle.m_pointTL, new CSize(433, 184)); + this.doSetPinPos(65, this.m_rectangle.m_pointTL, new CSize(443, 184)); + this.doSetPinPos(66, this.m_rectangle.m_pointTL, new CSize(453, 184)); + this.doSetPinPos(67, this.m_rectangle.m_pointTL, new CSize(461, 184)); + this.doSetPinPos(68, this.m_rectangle.m_pointTL, new CSize(471, 184)); + this.doSetPinPos(69, this.m_rectangle.m_pointTL, new CSize(480, 184)); + + this.doSetPinPos(70, this.m_rectangle.m_pointTL, new CSize(266, 184)); // RESET + this.doSetPinPos(71, this.m_rectangle.m_pointTL, new CSize(276, 184)); // 3.3V + this.doSetPinPos(72, this.m_rectangle.m_pointTL, new CSize(285, 184)); // 5V + this.doSetPinPos(73, this.m_rectangle.m_pointTL, new CSize(294, 184)); // GND + this.doSetPinPos(74, this.m_rectangle.m_pointTL, new CSize(303, 184)); // GND + this.doSetPinPos(75, this.m_rectangle.m_pointTL, new CSize(243, 8)); // GND near AREF + + this.doSetPinPos(76, this.m_rectangle.m_pointTL, new CSize(490, 8)); // 5V + this.doSetPinPos(77, this.m_rectangle.m_pointTL, new CSize(499, 8)); // 5V + this.doSetPinPos(78, this.m_rectangle.m_pointTL, new CSize(490, 166)); // GND + this.doSetPinPos(79, this.m_rectangle.m_pointTL, new CSize(499, 166)); // GND + } + else if (this.m_nRotationAngle == 90) + { + // Standard D0 -> D13 + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(185, 379)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(185, 370)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(185, 361)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(185, 352)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(185, 343)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(185, 333)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(185, 324)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(185, 315)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(185, 296)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(185, 287)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(185, 278)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(185, 269)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(185, 260)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(185, 251)); + + // Serial1, Serial2, Serial3 & I2C + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(185, 434)); // Tx1 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(185, 443)); // Rx1 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(185, 416)); // Tx2 + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(185, 425)); // Rx2 + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(185, 398)); // Tx3 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(185, 407)); // Rx3 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(185, 452)); // SDA + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(185, 461)); // SCL + + // D22 -> D54 + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(173, 491)); + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(173, 500)); + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(164, 491)); + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(164, 500)); + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(155, 491)); + this.doSetPinPos(27, this.m_rectangle.m_pointTL, new CSize(155, 500)); + this.doSetPinPos(28, this.m_rectangle.m_pointTL, new CSize(146, 491)); + this.doSetPinPos(29, this.m_rectangle.m_pointTL, new CSize(146, 500)); + this.doSetPinPos(30, this.m_rectangle.m_pointTL, new CSize(137, 491)); + this.doSetPinPos(31, this.m_rectangle.m_pointTL, new CSize(137, 500)); + this.doSetPinPos(32, this.m_rectangle.m_pointTL, new CSize(128, 491)); + this.doSetPinPos(33, this.m_rectangle.m_pointTL, new CSize(128, 500)); + this.doSetPinPos(34, this.m_rectangle.m_pointTL, new CSize(118, 491)); + this.doSetPinPos(35, this.m_rectangle.m_pointTL, new CSize(118, 500)); + this.doSetPinPos(36, this.m_rectangle.m_pointTL, new CSize(109, 491)); + this.doSetPinPos(37, this.m_rectangle.m_pointTL, new CSize(109, 500)); + this.doSetPinPos(38, this.m_rectangle.m_pointTL, new CSize(100, 491)); + this.doSetPinPos(39, this.m_rectangle.m_pointTL, new CSize(100, 500)); + this.doSetPinPos(40, this.m_rectangle.m_pointTL, new CSize(90, 491)); + this.doSetPinPos(41, this.m_rectangle.m_pointTL, new CSize(90, 500)); + this.doSetPinPos(42, this.m_rectangle.m_pointTL, new CSize(81, 491)); + this.doSetPinPos(43, this.m_rectangle.m_pointTL, new CSize(81, 500)); + this.doSetPinPos(44, this.m_rectangle.m_pointTL, new CSize(72, 491)); + this.doSetPinPos(45, this.m_rectangle.m_pointTL, new CSize(72, 500)); + this.doSetPinPos(46, this.m_rectangle.m_pointTL, new CSize(63, 491)); + this.doSetPinPos(47, this.m_rectangle.m_pointTL, new CSize(63, 500)); + this.doSetPinPos(48, this.m_rectangle.m_pointTL, new CSize(54, 491)); + this.doSetPinPos(49, this.m_rectangle.m_pointTL, new CSize(54, 500)); + this.doSetPinPos(50, this.m_rectangle.m_pointTL, new CSize(45, 491)); + this.doSetPinPos(51, this.m_rectangle.m_pointTL, new CSize(45, 500)); + this.doSetPinPos(52, this.m_rectangle.m_pointTL, new CSize(36, 491)); + this.doSetPinPos(53, this.m_rectangle.m_pointTL, new CSize(36, 500)); + + // A0 -> A15 + this.doSetPinPos(54, this.m_rectangle.m_pointTL, new CSize(8, 333)); + this.doSetPinPos(55, this.m_rectangle.m_pointTL, new CSize(8, 342)); + this.doSetPinPos(56, this.m_rectangle.m_pointTL, new CSize(8, 351)); + this.doSetPinPos(57, this.m_rectangle.m_pointTL, new CSize(8, 361)); + this.doSetPinPos(58, this.m_rectangle.m_pointTL, new CSize(8, 370)); + this.doSetPinPos(59, this.m_rectangle.m_pointTL, new CSize(8, 379)); + this.doSetPinPos(60, this.m_rectangle.m_pointTL, new CSize(8, 388)); + this.doSetPinPos(61, this.m_rectangle.m_pointTL, new CSize(8, 397)); + this.doSetPinPos(62, this.m_rectangle.m_pointTL, new CSize(8, 417)); + this.doSetPinPos(63, this.m_rectangle.m_pointTL, new CSize(8, 426)); + this.doSetPinPos(64, this.m_rectangle.m_pointTL, new CSize(8, 435)); + this.doSetPinPos(65, this.m_rectangle.m_pointTL, new CSize(8, 444)); + this.doSetPinPos(66, this.m_rectangle.m_pointTL, new CSize(8, 453)); + this.doSetPinPos(67, this.m_rectangle.m_pointTL, new CSize(8, 462)); + this.doSetPinPos(68, this.m_rectangle.m_pointTL, new CSize(8, 471)); + this.doSetPinPos(69, this.m_rectangle.m_pointTL, new CSize(8, 480)); + + this.doSetPinPos(70, this.m_rectangle.m_pointTL, new CSize(8, 267)); // RESET + this.doSetPinPos(71, this.m_rectangle.m_pointTL, new CSize(8, 276)); // 3.3V + this.doSetPinPos(72, this.m_rectangle.m_pointTL, new CSize(8, 285)); // 5V + this.doSetPinPos(73, this.m_rectangle.m_pointTL, new CSize(8, 294)); // GND + this.doSetPinPos(74, this.m_rectangle.m_pointTL, new CSize(8, 303)); // GND + this.doSetPinPos(75, this.m_rectangle.m_pointTL, new CSize(185, 242)); // GND near AREF + + this.doSetPinPos(76, this.m_rectangle.m_pointTL, new CSize(182, 491)); // 5V + this.doSetPinPos(77, this.m_rectangle.m_pointTL, new CSize(182, 500)); // 5V + this.doSetPinPos(78, this.m_rectangle.m_pointTL, new CSize(27, 491)); // GND + this.doSetPinPos(79, this.m_rectangle.m_pointTL, new CSize(27, 500)); // GND + } + else if (this.m_nRotationAngle == 180) + { + // Standard D0 -> D13 + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(138, 184)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(147, 184)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(156, 184)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(164, 184)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(173, 184)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(183, 184)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(192, 184)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(201, 184)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(217, 184)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(226, 184)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(236, 184)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(245, 184)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(254, 184)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(263, 184)); + + // Serial1, Serial2, Serial3 & I2C + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(81, 184)); // Tx1 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(72, 184)); // Rx1 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(99, 184)); // Tx2 + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(90, 184)); // Rx2 + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(117, 184)); // Tx3 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(108, 184)); // Rx3 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(62, 184)); // SDA + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(53, 184)); // SCL + + // D22 -> D54 + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(25, 173)); + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(16, 173)); + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(25, 164)); + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(16, 164)); + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(25, 154)); + this.doSetPinPos(27, this.m_rectangle.m_pointTL, new CSize(16, 154)); + this.doSetPinPos(28, this.m_rectangle.m_pointTL, new CSize(25, 145)); + this.doSetPinPos(29, this.m_rectangle.m_pointTL, new CSize(16, 145)); + this.doSetPinPos(30, this.m_rectangle.m_pointTL, new CSize(25, 136)); + this.doSetPinPos(31, this.m_rectangle.m_pointTL, new CSize(16, 136)); + this.doSetPinPos(32, this.m_rectangle.m_pointTL, new CSize(25, 127)); + this.doSetPinPos(33, this.m_rectangle.m_pointTL, new CSize(16, 127)); + this.doSetPinPos(34, this.m_rectangle.m_pointTL, new CSize(25, 118)); + this.doSetPinPos(35, this.m_rectangle.m_pointTL, new CSize(16, 118)); + this.doSetPinPos(36, this.m_rectangle.m_pointTL, new CSize(25, 109)); + this.doSetPinPos(37, this.m_rectangle.m_pointTL, new CSize(16, 109)); + this.doSetPinPos(38, this.m_rectangle.m_pointTL, new CSize(25, 100)); + this.doSetPinPos(39, this.m_rectangle.m_pointTL, new CSize(16, 100)); + this.doSetPinPos(40, this.m_rectangle.m_pointTL, new CSize(25, 91)); + this.doSetPinPos(41, this.m_rectangle.m_pointTL, new CSize(16, 91)); + this.doSetPinPos(42, this.m_rectangle.m_pointTL, new CSize(25, 81)); + this.doSetPinPos(43, this.m_rectangle.m_pointTL, new CSize(16, 81)); + this.doSetPinPos(44, this.m_rectangle.m_pointTL, new CSize(25, 72)); + this.doSetPinPos(45, this.m_rectangle.m_pointTL, new CSize(16, 72)); + this.doSetPinPos(46, this.m_rectangle.m_pointTL, new CSize(25, 62)); + this.doSetPinPos(47, this.m_rectangle.m_pointTL, new CSize(16, 62)); + this.doSetPinPos(48, this.m_rectangle.m_pointTL, new CSize(25, 53)); + this.doSetPinPos(49, this.m_rectangle.m_pointTL, new CSize(16, 53)); + this.doSetPinPos(50, this.m_rectangle.m_pointTL, new CSize(25, 44)); + this.doSetPinPos(51, this.m_rectangle.m_pointTL, new CSize(16, 44)); + this.doSetPinPos(52, this.m_rectangle.m_pointTL, new CSize(25, 35)); + this.doSetPinPos(53, this.m_rectangle.m_pointTL, new CSize(16, 35)); + + // A0 -> A15 + this.doSetPinPos(54, this.m_rectangle.m_pointTL, new CSize(183, 7)); + this.doSetPinPos(55, this.m_rectangle.m_pointTL, new CSize(174, 7)); + this.doSetPinPos(56, this.m_rectangle.m_pointTL, new CSize(165, 7)); + this.doSetPinPos(57, this.m_rectangle.m_pointTL, new CSize(156, 7)); + this.doSetPinPos(58, this.m_rectangle.m_pointTL, new CSize(147, 7)); + this.doSetPinPos(59, this.m_rectangle.m_pointTL, new CSize(138, 7)); + this.doSetPinPos(60, this.m_rectangle.m_pointTL, new CSize(129, 7)); + this.doSetPinPos(61, this.m_rectangle.m_pointTL, new CSize(120, 7)); + this.doSetPinPos(62, this.m_rectangle.m_pointTL, new CSize(99, 7)); + this.doSetPinPos(63, this.m_rectangle.m_pointTL, new CSize(90, 7)); + this.doSetPinPos(64, this.m_rectangle.m_pointTL, new CSize(81, 7)); + this.doSetPinPos(65, this.m_rectangle.m_pointTL, new CSize(72, 7)); + this.doSetPinPos(66, this.m_rectangle.m_pointTL, new CSize(63, 7)); + this.doSetPinPos(67, this.m_rectangle.m_pointTL, new CSize(54, 7)); + this.doSetPinPos(68, this.m_rectangle.m_pointTL, new CSize(45, 7)); + this.doSetPinPos(69, this.m_rectangle.m_pointTL, new CSize(36, 7)); + + this.doSetPinPos(70, this.m_rectangle.m_pointTL, new CSize(249, 7)); // RESET + this.doSetPinPos(71, this.m_rectangle.m_pointTL, new CSize(240, 7)); // 3.3V + this.doSetPinPos(72, this.m_rectangle.m_pointTL, new CSize(231, 7)); // 5V + this.doSetPinPos(73, this.m_rectangle.m_pointTL, new CSize(222, 7)); // GND + this.doSetPinPos(74, this.m_rectangle.m_pointTL, new CSize(213, 7)); // GND + this.doSetPinPos(75, this.m_rectangle.m_pointTL, new CSize(273, 184)); // GND near AREF + + this.doSetPinPos(76, this.m_rectangle.m_pointTL, new CSize(16, 25)); // 5V + this.doSetPinPos(77, this.m_rectangle.m_pointTL, new CSize(25, 25)); // 5V + this.doSetPinPos(78, this.m_rectangle.m_pointTL, new CSize(16, 183)); // GND + this.doSetPinPos(79, this.m_rectangle.m_pointTL, new CSize(25, 183)); // GND + } + else if (this.m_nRotationAngle == 270) + { + // Standard D0 -> D13 + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(9, 137)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(9, 146)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(9, 155)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(9, 164)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(9, 173)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(9, 182)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(9, 191)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(9, 200)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(9, 217)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(9, 226)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(9, 235)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(9, 244)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(9, 253)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(9, 262)); + + // Serial1, Serial2, Serial3 & I2C + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(9, 81)); // Tx1 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(9, 72)); // Rx1 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(9, 99)); // Tx2 + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(9, 90)); // Rx2 + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(9, 117)); // Tx3 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(9, 108)); // Rx3 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(9, 62)); // SDA + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(9, 53)); // SCL + + // D22 -> D54 + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(19, 15)); + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(19, 24)); + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(28, 15)); + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(28, 24)); + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(37, 15)); + this.doSetPinPos(27, this.m_rectangle.m_pointTL, new CSize(37, 24)); + this.doSetPinPos(28, this.m_rectangle.m_pointTL, new CSize(46, 15)); + this.doSetPinPos(29, this.m_rectangle.m_pointTL, new CSize(46, 24)); + this.doSetPinPos(30, this.m_rectangle.m_pointTL, new CSize(56, 15)); + this.doSetPinPos(31, this.m_rectangle.m_pointTL, new CSize(56, 24)); + this.doSetPinPos(32, this.m_rectangle.m_pointTL, new CSize(65, 15)); + this.doSetPinPos(33, this.m_rectangle.m_pointTL, new CSize(65, 24)); + this.doSetPinPos(34, this.m_rectangle.m_pointTL, new CSize(74, 15)); + this.doSetPinPos(35, this.m_rectangle.m_pointTL, new CSize(74, 24)); + this.doSetPinPos(36, this.m_rectangle.m_pointTL, new CSize(83, 15)); + this.doSetPinPos(37, this.m_rectangle.m_pointTL, new CSize(83, 24)); + this.doSetPinPos(38, this.m_rectangle.m_pointTL, new CSize(92, 15)); + this.doSetPinPos(39, this.m_rectangle.m_pointTL, new CSize(92, 24)); + this.doSetPinPos(40, this.m_rectangle.m_pointTL, new CSize(101, 15)); + this.doSetPinPos(41, this.m_rectangle.m_pointTL, new CSize(101, 24)); + this.doSetPinPos(42, this.m_rectangle.m_pointTL, new CSize(111, 15)); + this.doSetPinPos(43, this.m_rectangle.m_pointTL, new CSize(111, 24)); + this.doSetPinPos(44, this.m_rectangle.m_pointTL, new CSize(120, 15)); + this.doSetPinPos(45, this.m_rectangle.m_pointTL, new CSize(120, 24)); + this.doSetPinPos(46, this.m_rectangle.m_pointTL, new CSize(129, 15)); + this.doSetPinPos(47, this.m_rectangle.m_pointTL, new CSize(129, 24)); + this.doSetPinPos(48, this.m_rectangle.m_pointTL, new CSize(139, 15)); + this.doSetPinPos(49, this.m_rectangle.m_pointTL, new CSize(139, 24)); + this.doSetPinPos(50, this.m_rectangle.m_pointTL, new CSize(148, 15)); + this.doSetPinPos(51, this.m_rectangle.m_pointTL, new CSize(148, 24)); + this.doSetPinPos(52, this.m_rectangle.m_pointTL, new CSize(157, 15)); + this.doSetPinPos(53, this.m_rectangle.m_pointTL, new CSize(157, 24)); + + // A0 -> A15 + this.doSetPinPos(54, this.m_rectangle.m_pointTL, new CSize(185, 182)); + this.doSetPinPos(55, this.m_rectangle.m_pointTL, new CSize(185, 173)); + this.doSetPinPos(56, this.m_rectangle.m_pointTL, new CSize(185, 164)); + this.doSetPinPos(57, this.m_rectangle.m_pointTL, new CSize(185, 155)); + this.doSetPinPos(58, this.m_rectangle.m_pointTL, new CSize(185, 146)); + this.doSetPinPos(59, this.m_rectangle.m_pointTL, new CSize(185, 137)); + this.doSetPinPos(60, this.m_rectangle.m_pointTL, new CSize(185, 128)); + this.doSetPinPos(61, this.m_rectangle.m_pointTL, new CSize(185, 119)); + this.doSetPinPos(62, this.m_rectangle.m_pointTL, new CSize(185, 99)); + this.doSetPinPos(63, this.m_rectangle.m_pointTL, new CSize(185, 90)); + this.doSetPinPos(64, this.m_rectangle.m_pointTL, new CSize(185, 81)); + this.doSetPinPos(65, this.m_rectangle.m_pointTL, new CSize(185, 72)); + this.doSetPinPos(66, this.m_rectangle.m_pointTL, new CSize(185, 62)); + this.doSetPinPos(67, this.m_rectangle.m_pointTL, new CSize(185, 53)); + this.doSetPinPos(68, this.m_rectangle.m_pointTL, new CSize(185, 44)); + this.doSetPinPos(69, this.m_rectangle.m_pointTL, new CSize(185, 35)); + + this.doSetPinPos(70, this.m_rectangle.m_pointTL, new CSize(185, 249)); // RESET + this.doSetPinPos(71, this.m_rectangle.m_pointTL, new CSize(185, 240)); // 3.3V + this.doSetPinPos(72, this.m_rectangle.m_pointTL, new CSize(185, 231)); // 5V + this.doSetPinPos(73, this.m_rectangle.m_pointTL, new CSize(185, 221)); // GND + this.doSetPinPos(74, this.m_rectangle.m_pointTL, new CSize(185, 212)); // GND + this.doSetPinPos(75, this.m_rectangle.m_pointTL, new CSize(9, 272)); // GND near AREF + + this.doSetPinPos(76, this.m_rectangle.m_pointTL, new CSize(9, 15)); // 5V + this.doSetPinPos(77, this.m_rectangle.m_pointTL, new CSize(9, 24)); // 5V + this.doSetPinPos(78, this.m_rectangle.m_pointTL, new CSize(167, 15)); // GND + this.doSetPinPos(79, this.m_rectangle.m_pointTL, new CSize(167, 24)); // GND + } + } + + setDeviceName(strDeviceName) + { + super.setDeviceName(strDeviceName); + this.m_SPI.setDeviceName(strDeviceName); + this.m_I2C .setDeviceName(strDeviceName); + this.m_Serial.setDeviceName(strDeviceName); + this.m_Serial1.setDeviceName(strDeviceName); + this.m_Serial2.setDeviceName(strDeviceName); + this.m_Serial3.setDeviceName(strDeviceName); + } + +} + + + +//************************************************************************* +//* +//* ARDUINO UNO +//* +//************************************************************************* + +class CArduinoUno extends CMCUBase +{ + static m_ImageObject0 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoUno.png"); + static m_ImageObject90 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoUno90.png"); + static m_ImageObject180 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoUno180.png"); + static m_ImageObject270 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\ArduinoUno270.png"); + + constructor() + { + var strName = ""; + + super("UNO"); + this.m_fScale = this.m_fDefaultScale = 1.75; + this.m_ImageObject0 = CArduinoUno.m_ImageObject0; + this.m_ImageObject90 = CArduinoUno.m_ImageObject90; + this.m_ImageObject180 = CArduinoUno.m_ImageObject180; + this.m_ImageObject270 = CArduinoUno.m_ImageObject270; + this.m_strDeviceName = "UNO1"; + this.m_fVoltage = 5.0; + + for (var nI = 0, bIsPWM = false, bIsAnalog = false; nI <= 19; nI++) + { + bIsPWM = (nI == 3) || (nI == 5) || (nI == 6) || (nI == 9) || (nI == 11); + bIsAnalog = (nI >= 14) && (nI <= 19); + + if (nI == 0) + strName = "Rx"; + else if (nI == 1) + strName = "Tx"; + else if (bIsAnalog) + strName = "A" + (nI - 14).toString(); + else + strName = nI.toString(); + + this.doAddPin(new CPin(nI, bIsPWM, bIsAnalog, strName, this.getDeviceName())); + } + this.m_nMaxPin = 19; + + this.doAddPin(new CResetPin(nI++, this.getDeviceName())); + this.doAddPin(new C3_3VPin(nI++, this.getDeviceName())); + this.doAddPin(new C5VPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doRotate(0); + + this.m_SPI = new CSPIPort(11, 12, 13, this.getDeviceName()); + this.m_I2C = new CI2CPort(19, 18, this.getDeviceName()); + this.m_Serial = new CSerialPort(1, 0, this.getDeviceName()); + this.setDeviceName(this.m_strDeviceName); + + this.m_mapAnalogPins.set("A0", 14); + this.m_mapAnalogPins.set("A1", 15); + this.m_mapAnalogPins.set("A2", 16); + this.m_mapAnalogPins.set("A3", 17); + this.m_mapAnalogPins.set("A4", 18); + this.m_mapAnalogPins.set("A5", 19); + } + + doWrite() + { + return super.doWrite(); + } + + doSetPinPositions() + { + if (this.m_nRotationAngle == 0) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(394, 10)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(385, 10)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(376, 10)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(367, 10)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(357, 10)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(347, 10)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(338, 10)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(329, 10)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(314, 10)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(305, 10)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(295, 10)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(285, 10)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(275, 10)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(267, 10)); + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(348, 189)); + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(358, 189)); + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(367, 189)); + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(376, 189)); + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(385, 189)); + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(395, 189)); + + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(281, 189)); // RESET + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(291, 189)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(300, 189)); // 5V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(310, 189)); // GND + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(319, 189)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(257, 10)); // GND near AREF + } + else if (this.m_nRotationAngle == 90) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(187, 394)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(187, 384)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(187, 374)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(187, 365)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(187, 356)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(187, 347)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(187, 338)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(187, 329)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(187, 314)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(187, 305)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(187, 296)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(187, 287)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(187, 278)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(187, 269)); + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(9, 347)); + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(9, 356)); + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(9, 366)); + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(9, 375)); + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(9, 384)); + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(9, 394)); + + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(9, 284)); // RESET + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(9, 293)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(9, 302)); // 5V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(9, 311)); // GND + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(9, 320)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(187, 260)); // GND near AREF + } + else if (this.m_nRotationAngle == 180) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(19, 188)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(28, 188)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(37, 188)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(47, 188)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(56, 188)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(66, 188)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(75, 188)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(84, 188)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(99, 188)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(109, 188)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(119, 188)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(128, 188)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(138, 188)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(147, 188)); + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(66, 9)); + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(55, 9)); + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(45, 9)); + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(36, 9)); + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(27, 9)); + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(18, 9)); + + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(131, 9)); // RESET + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(122, 9)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(113, 9)); // 5V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(104, 9)); // GND + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(95, 9)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(156, 188)); // GND near AREF + } + else if (this.m_nRotationAngle == 270) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(10, 17)); + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(10, 26)); + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(10, 36)); + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(10, 45)); + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(10, 55)); + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(10, 64)); + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(10, 74)); + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(10, 83)); + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(10, 99)); + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(10, 108)); + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(10, 117)); + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(10, 126)); + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(10, 136)); + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(10, 145)); + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(189, 65)); + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(189, 56)); + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(189, 46)); + this.doSetPinPos(17, this.m_rectangle.m_pointTL, new CSize(189, 36)); + this.doSetPinPos(18, this.m_rectangle.m_pointTL, new CSize(189, 27)); + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(189, 18)); + + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(189, 132)); // RESET + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(189, 123)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(189, 114)); // 5V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(189, 105)); // GND + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(189, 96)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(10, 155)); // GND near AREF + } + } + + setDeviceName(strDeviceName) + { + super.setDeviceName(strDeviceName); + this.m_SPI.setDeviceName(strDeviceName); + this.m_I2C.setDeviceName(strDeviceName); + this.m_Serial.setDeviceName(strDeviceName); + } + +} + + + + +//************************************************************************* +//* +//* MICROBIT LED +//* +//************************************************************************* + +class CMicrobitLED +{ + constructor() + { + this.m_rectangle = new CRectangle(new CPoint(0, 0), new CSize(4, 4)); + this.m_bOn = false; + } + + doMove(pointNew) + { + this.m_rectangle.m_pointTL = new CPoint(pointNew.m_nX, pointNew.m_nY); + } + + doTurnOn() + { + this.m_bOn = true; + } + + doTurnOff() + { + this.m_bOn = false; + } + + doDisplay() + { + if (this.m_bOn) + { + g_CanvasContext.strokeStyle = 'red'; + g_CanvasContext.fillStyle = 'red'; + g_CanvasContext.fillRect(this.m_rectangle.m_pointTL.m_nX, this.m_rectangle.m_pointTL.m_nY, this.m_rectangle.m_size.m_nWidth, this.m_rectangle.m_size.m_nHeight); + } + } +} + + + + +class CMicrobitLEDColumn +{ + constructor() + { + this.m_rectangle = new CRectangle(new CPoint(0, 0), new CSize(0, 0)); + this.m_bOn = false; + this.m_arrayLEDs = []; + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDs[nI] = new CMicrobitLED(); + this.m_nGap = 15; + } + + doMove(pointNew) + { + var point = new CPoint(pointNew.m_nX, pointNew.m_nY); + + for (let nI = 0; nI < 5; nI++) + { + this.m_arrayLEDs[nI].doMove(point); + point.m_nY += this.m_nGap; + } + } + + doTurnOn(nLEDNum) + { + if ((nLEDNum >= 0) && (nLEDNum < 5)) + this.m_arrayLEDs[nLEDNum].doTurnOn(); + } + + doTurnOff(nLEDNum) + { + if ((nLEDNum >= 0) && (nLEDNum < 5)) + this.m_arrayLEDs[nLEDNum].doTurnOff(); + } + + doTurnOnAll() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDs[nI].doTurnOn(nI); + } + + doTurnOffAll() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDs[nI].doTurnOff(nI); + } + + doDisplay() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDs[nI].doDisplay(); + } + +} + + + + +class CMicrobitLEDMatrix +{ + constructor() + { + this.m_rectangle = new CRectangle(new CPoint(0, 0), new CSize(0, 0)); + this.m_bOn = false; + this.m_arrayLEDColumns = []; + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI] = new CMicrobitLEDColumn(); + this.m_nGap = 15; + this.m_nRotationAngle = 0; + } + + doMove(pointNew) + { + var point = new CPoint(pointNew.m_nX, pointNew.m_nY); + + for (let nI = 0; nI < 5; nI++) + { + this.m_arrayLEDColumns[nI].doMove(point); + point.m_nX += this.m_nGap; + } + } + + doGetXCoord(nX) + { + if (this.m_nRotationAngle == 0) + nX = nX; + else if (this.m_nRotationAngle == 90) + nX = nX; + else if (this.m_nRotationAngle == 180) + nX = 4 - nX; + else if (this.m_nRotationAngle == 270) + nX = 4 - nX; + + return nX; + } + + doGetYCoord(nY) + { + if (this.m_nRotationAngle == 0) + nY = 4 - nY; + else if (this.m_nRotationAngle == 90) + nY = nY; + else if (this.m_nRotationAngle == 180) + nY = nY; + else if (this.m_nRotationAngle == 270) + nY = 4 - nY; + + return nY; + } + + doTurnOn(nX, nY) + { + if ((nX >= 0) && (nX < 5)) + this.m_arrayLEDColumns[this.doGetXCoord(nX)].doTurnOn(this.doGetYCoord(nY)); + } + + doTurnOff(nX, nY) + { + if ((nX >= 0) && (nX < 5)) + this.m_arrayLEDColumns[this.doGetXCoord(nX)].doTurnOff(this.doGetYCoord(nY)); + } + + doTurnOnRow(nY) + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI].doTurnOn(this.doGetYCoord(nY)); + } + + doTurnOffRow(nY) + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI].doTurnOff(this.doGetYCoord(nY)); + } + + doTurnOnColumn(nX) + { + if ((nX >= 0) && (nX < 5)) + this.m_arrayLEDColumns[this.doGetXCoord(nX)].doTurnOnAll(); + } + + doTurnOffColumn(nX) + { + if ((nX >= 0) && (nX < 5)) + this.m_arrayLEDColumns[this.doGetXCoord(nX)].doTurnOffAll(); + } + + doTurnOnAll() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI].doTurnOnAll(); + } + + doTurnOffAll() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI].doTurnOffAll(); + } + + doDisplay() + { + for (let nI = 0; nI < 5; nI++) + this.m_arrayLEDColumns[nI].doDisplay(); + } + +} + + + + +//************************************************************************* +//* +//* MICROBIT +//* +//************************************************************************* + +function doChangeSelectBreakout(strType) +{ + var strDeviceName = doFindSelectedComponentNoMouse(); + + if ((strDeviceName != null) && (strDeviceName != "")) + { + g_mapPlacedComponents.get(strDeviceName).doSetBreakout(strType == "BREAKOUT"); + doDisplayAllComponents(); + } +} + +class CMicrobit extends CMCUBase +{ + static m_ImageObjectBreakout0 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\MicrobitBreakout.png"); + static m_ImageObjectBreakout90 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\MicrobitBreakout90.png"); + static m_ImageObjectBreakout180 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\MicrobitBreakout180.png"); + static m_ImageObjectBreakout270 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\MicrobitBreakout270.png"); + static m_ImageObjectNoBreakout0 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\Microbit.png"); + static m_ImageObjectNoBreakout90 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\Microbit90.png"); + static m_ImageObjectNoBreakout180 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\Microbit180.png"); + static m_ImageObjectNoBreakout270 = CComponentBase.doGetImageObject("img\\Components\\MCUs\\Microbit270.png"); + + constructor(bBreakout) + { + super("MICROBIT"); + this.m_bBreakout = bBreakout; + this.m_fScale = this.m_fDefaultScale = 1.7; + this.m_arrayLEDMatrix = new CMicrobitLEDMatrix(); + this.m_strEditHTML += "  
BREAKOUT  
"; + this.doSetImages(bBreakout); + this.m_strDeviceName = "MICROBIT1"; + this.m_fVoltage = 3.3; + + for (var nI = 0, bIsAnalog = false; nI <= 20; nI++) + { + bIsAnalog = ((nI >= 0) && (nI <= 4)) || (nI == 10); + this.doAddPin(new CPin(nI, true, bIsAnalog, "P" + nI.toString(), this.getDeviceName())); + } + this.m_nMaxPin = 20; + + this.doAddPin(new C3_3VPin(nI++, this.getDeviceName())); + this.doAddPin(new C3_3VPin(nI++, this.getDeviceName())); + this.doAddPin(new C3_3VPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doAddPin(new CGNDPin(nI++, this.getDeviceName())); + this.doRotate(0); + + this.m_SPI = new CSPIPort(15, 14, 13, this.getDeviceName()); + this.m_I2C = new CI2CPort(19, 20, this.getDeviceName()); + this.setDeviceName(this.m_strDeviceName); + + this.m_nButtonAPin = 5; + this.m_nButtonBPin = 11; + + this.m_mapDigitalPinNames = new Map(); + this.m_mapDigitalPinNames.set("P0", 0); + this.m_mapDigitalPinNames.set("P1", 1); + this.m_mapDigitalPinNames.set("P2", 2); + this.m_mapDigitalPinNames.set("P3", 3); + this.m_mapDigitalPinNames.set("P4", 4); + this.m_mapDigitalPinNames.set("P5", 5); + this.m_mapDigitalPinNames.set("P6", 6); + this.m_mapDigitalPinNames.set("P7", 7); + this.m_mapDigitalPinNames.set("P8", 8); + this.m_mapDigitalPinNames.set("P9", 9); + this.m_mapDigitalPinNames.set("P10", 10); + this.m_mapDigitalPinNames.set("P11", 11); + this.m_mapDigitalPinNames.set("P13", 13); + this.m_mapDigitalPinNames.set("P14", 14); + this.m_mapDigitalPinNames.set("P15", 15); + this.m_mapDigitalPinNames.set("P16", 16); + this.m_mapDigitalPinNames.set("P19", 19); + this.m_mapDigitalPinNames.set("P20", 20); + } + + doRead(strFileContents) + { + strFileContents = super.doRead(strFileContents); + var strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_bBreakout = strTemp == "true"; + + return strFileContents; + } + + doWrite(strFileContents) + { + strFileContents = super.doWrite(strFileContents); + strFileContents += this.m_bBreakout + "\r\n"; + return strFileContents; + } + + doSetImages(bBreakout) + { + if (bBreakout) + { + this.m_ImageObject0 = CMicrobit.m_ImageObjectBreakout0; + this.m_ImageObject90 = CMicrobit.m_ImageObjectBreakout90; + this.m_ImageObject180 = CMicrobit.m_ImageObjectBreakout180; + this.m_ImageObject270 = CMicrobit.m_ImageObjectBreakout270; + } + else + { + this.m_ImageObject0 = CMicrobit.m_ImageObjectNoBreakout0; + this.m_ImageObject90 = CMicrobit.m_ImageObjectNoBreakout90; + this.m_ImageObject180 = CMicrobit.m_ImageObjectNoBreakout180; + this.m_ImageObject270 = CMicrobit.m_ImageObjectNoBreakout270; + } + } + + doSetBreakout(bBreakout) + { + this.m_bBreakout = bBreakout; + this.doSetImages(bBreakout); + this.doRotate(0); + } + + doTurnOnLED(nX, nY) + { + this.m_arrayLEDMatrix.turnOn(nX, nY); + } + + doTurnOffLED(nX, nY) + { + this.m_arrayLEDMatrix.turnOff(nX, nY); + } + + doTurnOnRow(nY) + { + this.m_arrayLEDMatrix.doTurnOnRow(nY); + } + + doTurnOffRow(nY) + { + this.m_arrayLEDMatrix.doTurnOffRow(nY); + } + + doTurnOnColumn(nX) + { + this.m_arrayLEDMatrix.doTurnOnColumn(); + } + + doTurnOffColumn(nX) + { + this.m_arrayLEDMatrix.doTurnOffColumn(); + } + + doTurnOnAll() + { + this.m_arrayLEDMatrix.doTurnOnAll(); + } + + doTurnOffAll() + { + this.m_arrayLEDMatrix.doTurnOffAll(); + } + + doRotate(nAngleAdd) + { + super.doRotate(nAngleAdd); + this.m_arrayLEDMatrix.doRotate(this.m_nRotationAngle); + this.m_arrayLEDMatrix.doTurnOffAll(); + } + + doSetPinPositions() + { + var pointCenter = this.m_rectangle.getCenter(); + + if (this.m_bBreakout) + { + if (this.m_nRotationAngle == 0) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(358, 209)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(358, 199)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(358, 190)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(358, 180)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(358, 171)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(358, 161)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(358, 151)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(358, 142)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(358, 132)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(358, 122)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(358, 113)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(358, 103)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(358, 93)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(358, 84)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(358, 74)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(358, 64)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(358, 54)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(358, 45)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(358, 35)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(358, 219)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(358, 229)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(358, 238)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 175, this.m_rectangle.m_pointTL.m_nY + 66)); + + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 174.75, this.m_rectangle.m_pointTL.m_nY + 107.5)); + } + else if (this.m_nRotationAngle == 90) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(65, 358)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(75, 358)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(84, 358)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(94, 358)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(104, 358)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(113, 358)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(123, 358)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(133, 358)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(142, 358)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(152, 358)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(161, 358)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(171, 358)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(181, 358)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(191, 358)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(201, 358)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(210, 358)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(220, 358)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(230, 358)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(239, 358)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(56, 358)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(46, 358)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(36, 358)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX+ 107.5, this.m_rectangle.m_pointTL.m_nY + 175.5)); + } + else if (this.m_nRotationAngle == 180) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(9, 65)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(9, 75)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(9, 84)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(9, 94)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(9, 103)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(9, 113)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(9, 123)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(9, 133)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(9, 142)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(9, 152)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(9, 162)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(9, 171)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(9, 181)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(9, 191)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(9, 201)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(9, 210)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(9, 220)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(9, 230)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(9, 239)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(9, 56)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(9, 46)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(9, 36)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 131.5, this.m_rectangle.m_pointTL.m_nY + 107.5)); + } + else if (this.m_nRotationAngle == 270) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(209, 9)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(200, 9)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(190, 9)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(180, 9)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(171, 9)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(161, 9)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(151, 9)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(142, 9)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(132, 9)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(122, 9)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(112, 9)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(103, 9)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(93, 9)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(83, 9)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(74, 9)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(64, 9)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(55, 9)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(45, 9)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(35, 9)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(219, 9)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(229, 9)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(238, 9)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(-1000000, -1000000)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 107.5, this.m_rectangle.m_pointTL.m_nY + 132)); + } + } + else + { + if (this.m_nRotationAngle == 0) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(268, 178)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(268, 140)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(268, 96)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(268, 190)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(268, 166)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(268, 162)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(268, 156)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(268, 152)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(268, 127)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(268, 122)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(268, 117)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(268, 112)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(268, 107)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(268, 84)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(268, 79)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(268, 74)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(268, 69)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(268, 35)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(268, 30)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(268, 40)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(268, 52)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(268, 64)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(268, 0)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(268, 13)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(268, 25)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 175, this.m_rectangle.m_pointTL.m_nY + 66)); + } + else if (this.m_nRotationAngle == 90) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(13, 268)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(52, 268)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(96, 268)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(2, 268)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(25, 268)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(30, 268)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(35, 268)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(40, 268)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(64, 268)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(69, 268)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(74, 268)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(79, 268)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(84, 268)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(107, 268)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(112, 268)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(117, 268)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(122, 268)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(155, 268)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(160, 268)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(127, 268)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(139, 268)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(150, 268)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(166, 268)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(178, 268)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(190, 268)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 66, this.m_rectangle.m_pointTL.m_nY + 175)); + } + else if (this.m_nRotationAngle == 180) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(15, 14)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(15, 52)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(15, 95)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(15, 2)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(15, 26)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(15, 31)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(15, 36)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(15, 41)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(15, 64)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(15, 69)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(15, 74)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(15, 79)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(15, 84)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(15, 107)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(15, 112)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(15, 117)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(15, 122)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(15, 155)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(15, 160)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(15, 128)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(15, 140)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(15, 151)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(15, 166)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(15, 178)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(15, 189)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 49, this.m_rectangle.m_pointTL.m_nY + 66)); + } + else if (this.m_nRotationAngle == 270) + { + this.doSetPinPos(0, this.m_rectangle.m_pointTL, new CSize(178, 16)); // P0 + this.doSetPinPos(1, this.m_rectangle.m_pointTL, new CSize(139, 16)); // P1 + this.doSetPinPos(2, this.m_rectangle.m_pointTL, new CSize(96, 16)); // P2 + this.doSetPinPos(3, this.m_rectangle.m_pointTL, new CSize(190, 16)); // P3 + this.doSetPinPos(4, this.m_rectangle.m_pointTL, new CSize(166, 16)); // P4 + this.doSetPinPos(5, this.m_rectangle.m_pointTL, new CSize(161, 16)); // P5 + this.doSetPinPos(6, this.m_rectangle.m_pointTL, new CSize(156, 16)); // P6 + this.doSetPinPos(7, this.m_rectangle.m_pointTL, new CSize(151, 16)); // P7 + this.doSetPinPos(8, this.m_rectangle.m_pointTL, new CSize(127, 16)); // P8 + this.doSetPinPos(9, this.m_rectangle.m_pointTL, new CSize(122, 16)); // P9 + this.doSetPinPos(10, this.m_rectangle.m_pointTL, new CSize(117, 16)); // P10 + this.doSetPinPos(11, this.m_rectangle.m_pointTL, new CSize(112, 16)); // P11 + this.doSetPinPos(12, this.m_rectangle.m_pointTL, new CSize(107, 16)); // P12 + this.doSetPinPos(13, this.m_rectangle.m_pointTL, new CSize(83, 16)); // P13 + this.doSetPinPos(14, this.m_rectangle.m_pointTL, new CSize(78, 16)); // P14 + this.doSetPinPos(15, this.m_rectangle.m_pointTL, new CSize(73, 16)); // P15 + this.doSetPinPos(16, this.m_rectangle.m_pointTL, new CSize(68, 16)); // P16 + this.doSetPinPos(19, this.m_rectangle.m_pointTL, new CSize(36, 16)); // P19 + this.doSetPinPos(20, this.m_rectangle.m_pointTL, new CSize(31, 16)); // P20 + this.doSetPinPos(21, this.m_rectangle.m_pointTL, new CSize(65, 16)); // 3.3V + this.doSetPinPos(22, this.m_rectangle.m_pointTL, new CSize(52, 16)); // 3.3V + this.doSetPinPos(23, this.m_rectangle.m_pointTL, new CSize(40, 16)); // 3.3V + this.doSetPinPos(24, this.m_rectangle.m_pointTL, new CSize(26, 16)); // GND + this.doSetPinPos(25, this.m_rectangle.m_pointTL, new CSize(13, 16)); // GND + this.doSetPinPos(26, this.m_rectangle.m_pointTL, new CSize(1, 16)); // GND + this.m_arrayLEDMatrix.doMove(new CPoint(this.m_rectangle.m_pointTL.m_nX + 66, this.m_rectangle.m_pointTL.m_nY + 49)); + } + } + } + + setDeviceName(strDeviceName) + { + super.setDeviceName(strDeviceName); + this.m_SPI.setDeviceName(strDeviceName); + this.m_I2C.setDeviceName(strDeviceName); + } + + + doDisplay() + { + super.doDisplay(); + this.m_arrayLEDMatrix.doDisplay(); + } + + doRun() + { + for (let nI = 0; nI < this.m_arrayPins.length; nI++) + this.m_arrayPins[nI].doRun(); + } + +} + diff --git a/ardublockly/PassiveDataStructures.js b/ardublockly/PassiveDataStructures.js new file mode 100644 index 0000000000..3f36664954 --- /dev/null +++ b/ardublockly/PassiveDataStructures.js @@ -0,0 +1,1059 @@ +//************************************************************************* +//* +//* 0.25W RESISTOR +//* +//************************************************************************* + +function doChangeResistance(strDeviceName, fResistance) +{ + if ((strDeviceName != null) && (strDeviceName != "") && (g_mapPlacedComponents.get(strDeviceName) != null) && + (g_mapPlacedComponents.get(strDeviceName).getType() == "RESISTOR")) + { + g_mapPlacedComponents.get(strDeviceName).doSetResistance(fResistance); + doDisplayAllComponents(); + } +} + +function doGetResistance() +{ + var ResistenceSel = document.getElementById("resistance"); + var ResistanceMultSel = document.getElementById("resistance_multiplier"); + var fResistance = 0; + + if (ResistenceSel && ResistanceMultSel) + { + fResistance = ResistenceSel.options[ResistenceSel.selectedIndex].value; + fResistance *= ResistanceMultSel.options[ResistanceMultSel.selectedIndex].value; + } + return fResistance; +} + +class CResistor extends CComponentBase +{ + static m_ImageObjectBlown_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\RBlown.png"); + static m_ImageObjectBlown_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\RBlown_90.png"); + static m_ImageObjectBlown_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\RBlown_180.png"); + static m_ImageObjectBlown_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\RBlown_270.png"); + + static m_ImageObject1_0_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_0.png"); + static m_ImageObject1_0_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_90.png"); + static m_ImageObject1_0_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_180.png"); + static m_ImageObject1_0_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_270.png"); + + static m_ImageObject1_2_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2.png"); + static m_ImageObject1_2_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2_90.png"); + static m_ImageObject1_2_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2_180.png"); + static m_ImageObject1_2_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2_270.png"); + + static m_ImageObject1_5_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5.png"); + static m_ImageObject1_5_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5_90.png"); + static m_ImageObject1_5_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5_180.png"); + static m_ImageObject1_5_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5_270.png"); + + static m_ImageObject1_8_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8.png"); + static m_ImageObject1_8_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8_90.png"); + static m_ImageObject1_8_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8_180.png"); + static m_ImageObject1_8_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8_270.png"); + + static m_ImageObject2_2_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2.png"); + static m_ImageObject2_2_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2_90.png"); + static m_ImageObject2_2_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2_180.png"); + static m_ImageObject2_2_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2_270.png"); + + static m_ImageObject2_7_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7.png"); + static m_ImageObject2_7_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7_90.png"); + static m_ImageObject2_7_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7_180.png"); + static m_ImageObject2_7_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7_270.png"); + + static m_ImageObject3_3_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3.png"); + static m_ImageObject3_3_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3_90.png"); + static m_ImageObject3_3_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3_180.png"); + static m_ImageObject3_3_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3_270.png"); + + static m_ImageObject3_9_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9.png"); + static m_ImageObject3_9_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9_90.png"); + static m_ImageObject3_9_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9_180.png"); + static m_ImageObject3_9_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9_270.png"); + + static m_ImageObject4_7_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7.png"); + static m_ImageObject4_7_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7_90.png"); + static m_ImageObject4_7_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7_180.png"); + static m_ImageObject4_7_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7_270.png"); + + static m_ImageObject5_6_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6.png"); + static m_ImageObject5_6_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6_90.png"); + static m_ImageObject5_6_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6_180.png"); + static m_ImageObject5_6_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6_270.png"); + + static m_ImageObject6_8_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8.png"); + static m_ImageObject6_8_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8_90.png"); + static m_ImageObject6_8_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8_180.png"); + static m_ImageObject6_8_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8_270.png"); + + static m_ImageObject8_2_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2.png"); + static m_ImageObject8_2_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2_90.png"); + static m_ImageObject8_2_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2_180.png"); + static m_ImageObject8_2_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2_270.png"); + + static m_ImageObject10_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10.png"); + static m_ImageObject10_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10_90.png"); + static m_ImageObject10_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10_180.png"); + static m_ImageObject10_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10_270.png"); + + static m_ImageObject12_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12.png"); + static m_ImageObject12_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12_90.png"); + static m_ImageObject12_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12_180.png"); + static m_ImageObject12_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12_270.png"); + + static m_ImageObject15_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15.png"); + static m_ImageObject15_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15_90.png"); + static m_ImageObject15_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15_180.png"); + static m_ImageObject15_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15_270.png"); + + static m_ImageObject18_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R18.png"); + static m_ImageObject18_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R18_90.png"); + static m_ImageObject18_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R18_180.png"); + static m_ImageObject18_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R18_270.png"); + + static m_ImageObject22_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22.png"); + static m_ImageObject22_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22_90.png"); + static m_ImageObject22_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22_180.png"); + static m_ImageObject22_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22_270.png"); + + static m_ImageObject27_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27.png"); + static m_ImageObject27_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27_90.png"); + static m_ImageObject27_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27_180.png"); + static m_ImageObject27_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27_270.png"); + + static m_ImageObject33_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33.png"); + static m_ImageObject33_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33_90.png"); + static m_ImageObject33_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33_180.png"); + static m_ImageObject33_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33_270.png"); + + static m_ImageObject39_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39.png"); + static m_ImageObject39_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39_90.png"); + static m_ImageObject39_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39_180.png"); + static m_ImageObject39_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39_270.png"); + + static m_ImageObject47_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47.png"); + static m_ImageObject47_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47_90.png"); + static m_ImageObject47_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47_180.png"); + static m_ImageObject47_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47_270.png"); + + static m_ImageObject56_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56.png"); + static m_ImageObject56_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56_90.png"); + static m_ImageObject56_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56_180.png"); + static m_ImageObject56_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56_270.png"); + + static m_ImageObject68_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68.png"); + static m_ImageObject68_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68_90.png"); + static m_ImageObject68_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68_180.png"); + static m_ImageObject68_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68_270.png"); + + static m_ImageObject82_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82.png"); + static m_ImageObject82_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82_90.png"); + static m_ImageObject82_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82_180.png"); + static m_ImageObject82_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82_270.png"); + + static m_ImageObject100_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100.png"); + static m_ImageObject100_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100_90.png"); + static m_ImageObject100_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100_180.png"); + static m_ImageObject100_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100_270.png"); + + static m_ImageObject120_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120.png"); + static m_ImageObject120_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120_90.png"); + static m_ImageObject120_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120_180.png"); + static m_ImageObject120_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120_270.png"); + + static m_ImageObject150_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150.png"); + static m_ImageObject150_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150_90.png"); + static m_ImageObject150_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150_180.png"); + static m_ImageObject150_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150_270.png"); + + static m_ImageObject180_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180.png"); + static m_ImageObject180_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180_90.png"); + static m_ImageObject180_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180_180.png"); + static m_ImageObject180_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180_270.png"); + + static m_ImageObject220_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220.png"); + static m_ImageObject220_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220_90.png"); + static m_ImageObject220_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220_180.png"); + static m_ImageObject220_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220_270.png"); + + static m_ImageObject270_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R270.png"); + static m_ImageObject270_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R270_90.png"); + static m_ImageObject270_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R270_180.png"); + static m_ImageObject270_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R270_270.png"); + + static m_ImageObject330_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330.png"); + static m_ImageObject330_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330_90.png"); + static m_ImageObject330_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330_180.png"); + static m_ImageObject330_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330_270.png"); + + static m_ImageObject390_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390.png"); + static m_ImageObject390_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390_90.png"); + static m_ImageObject390_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390_180.png"); + static m_ImageObject390_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390_270.png"); + + static m_ImageObject470_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470.png"); + static m_ImageObject470_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470_90.png"); + static m_ImageObject470_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470_180.png"); + static m_ImageObject470_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470_270.png"); + + static m_ImageObject560_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560.png"); + static m_ImageObject560_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560_90.png"); + static m_ImageObject560_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560_180.png"); + static m_ImageObject560_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560_270.png"); + + static m_ImageObject680_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680.png"); + static m_ImageObject680_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680_90.png"); + static m_ImageObject680_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680_180.png"); + static m_ImageObject680_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680_270.png"); + + static m_ImageObject820_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820.png"); + static m_ImageObject820_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820_90.png"); + static m_ImageObject820_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820_180.png"); + static m_ImageObject820_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820_270.png"); + + static m_ImageObject1k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1k.png"); + static m_ImageObject1k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1k_90.png"); + static m_ImageObject1k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1k_180.png"); + static m_ImageObject1k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1k_270.png"); + + static m_ImageObject1_2k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2k.png"); + static m_ImageObject1_2k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2k_90.png"); + static m_ImageObject1_2k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2k_180.png"); + static m_ImageObject1_2k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2k_270.png"); + + static m_ImageObject1_5k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5k.png"); + static m_ImageObject1_5k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5k_90.png"); + static m_ImageObject1_5k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5k_180.png"); + static m_ImageObject1_5k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5k_270.png"); + + static m_ImageObject1_8_k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8k.png"); + static m_ImageObject1_8k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8k_90.png"); + static m_ImageObject1_8k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8k_180.png"); + static m_ImageObject1_8k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8k_270.png"); + + static m_ImageObject2_2k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2k.png"); + static m_ImageObject2_2k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2k_90.png"); + static m_ImageObject2_2k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2k_180.png"); + static m_ImageObject2_2k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2k_270.png"); + + static m_ImageObject2_7k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7k.png"); + static m_ImageObject2_7k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7k_90.png"); + static m_ImageObject2_7k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7k_180.png"); + static m_ImageObject2_7k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7k_270.png"); + + static m_ImageObject3_3k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3k.png"); + static m_ImageObject3_3k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3k_90.png"); + static m_ImageObject3_3k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3k_180.png"); + static m_ImageObject3_3k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3k_270.png"); + + static m_ImageObject3_9k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9k.png"); + static m_ImageObject3_9k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9k_90.png"); + static m_ImageObject3_9k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9k_180.png"); + static m_ImageObject3_9k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9k_270.png"); + + static m_ImageObject4_7k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7k.png"); + static m_ImageObject4_7k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7k_90.png"); + static m_ImageObject4_7k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7k_180.png"); + static m_ImageObject4_7k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7k_270.png"); + + static m_ImageObject5_6k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6k.png"); + static m_ImageObject5_6k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6k_90.png"); + static m_ImageObject5_6k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6k_180.png"); + static m_ImageObject5_6k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6k_270.png"); + + static m_ImageObject6_8k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8k.png"); + static m_ImageObject6_8k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8k_90.png"); + static m_ImageObject6_8k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8k_180.png"); + static m_ImageObject6_8k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8k_270.png"); + + static m_ImageObject8_2k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2k.png"); + static m_ImageObject8_2k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2k_90.png"); + static m_ImageObject8_2k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2k_180.png"); + static m_ImageObject8_2k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2k_270.png"); + + static m_ImageObject10k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10k.png"); + static m_ImageObject10k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10k_90.png"); + static m_ImageObject10k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10k_180.png"); + static m_ImageObject10k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10k_270.png"); + + static m_ImageObject12k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12k.png"); + static m_ImageObject12k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12k_90.png"); + static m_ImageObject12k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12k_180.png"); + static m_ImageObject12k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R12k_270.png"); + + static m_ImageObject15k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15k.png"); + static m_ImageObject15k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15k_90.png"); + static m_ImageObject15k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15k_180.png"); + static m_ImageObject15k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R15k_270.png"); + + static m_ImageObject22k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22k.png"); + static m_ImageObject22k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22k_90.png"); + static m_ImageObject22k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22k_180.png"); + static m_ImageObject22k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R22k_270.png"); + + static m_ImageObject27k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27k.png"); + static m_ImageObject27k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27k_90.png"); + static m_ImageObject27k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27k_180.png"); + static m_ImageObject27k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R27k_270.png"); + + static m_ImageObject33k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33k.png"); + static m_ImageObject33k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33k_90.png"); + static m_ImageObject33k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33k_180.png"); + static m_ImageObject33k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R33k_270.png"); + + static m_ImageObject39k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39k.png"); + static m_ImageObject39k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39k_90.png"); + static m_ImageObject39k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39k_180.png"); + static m_ImageObject39k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R39k_270.png"); + + static m_ImageObject47k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47k.png"); + static m_ImageObject47k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47k_90.png"); + static m_ImageObject47k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47k_180.png"); + static m_ImageObject47k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R47k_270.png"); + + static m_ImageObject56k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56k.png"); + static m_ImageObject56k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56k_90.png"); + static m_ImageObject56k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56k_180.png"); + static m_ImageObject56k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R56k_270.png"); + + static m_ImageObject68k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68k.png"); + static m_ImageObject68k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68k_90.png"); + static m_ImageObject68k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68k_180.png"); + static m_ImageObject68k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R68k_270.png"); + + static m_ImageObject82k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82k.png"); + static m_ImageObject82k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82k_90.png"); + static m_ImageObject82k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82k_180.png"); + static m_ImageObject82k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R82k_270.png"); + + static m_ImageObject100k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100k.png"); + static m_ImageObject100k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100k_90.png"); + static m_ImageObject100k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100k_180.png"); + static m_ImageObject100k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R100k_270.png"); + + static m_ImageObject120k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120k.png"); + static m_ImageObject120k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120k_90.png"); + static m_ImageObject120k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120k_180.png"); + static m_ImageObject120k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R120k_270.png"); + + static m_ImageObject150k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150k.png"); + static m_ImageObject150k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150k_90.png"); + static m_ImageObject150k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150k_180.png"); + static m_ImageObject150k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R150k_270.png"); + + static m_ImageObject180k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180k.png"); + static m_ImageObject180k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180k_90.png"); + static m_ImageObject180k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180k_180.png"); + static m_ImageObject180k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R180k_270.png"); + + static m_ImageObject220k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220k.png"); + static m_ImageObject220k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220k_90.png"); + static m_ImageObject220k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220k_180.png"); + static m_ImageObject220k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R220k_270.png"); + + static m_ImageObject330k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R30k.png"); + static m_ImageObject330k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330k_90.png"); + static m_ImageObject330k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330k_180.png"); + static m_ImageObject330k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R330k_270.png"); + + static m_ImageObject390k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390k.png"); + static m_ImageObject390k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390k_90.png"); + static m_ImageObject390k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390k_180.png"); + static m_ImageObject390k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R390k_270.png"); + + static m_ImageObject470k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470k.png"); + static m_ImageObject470k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470k_90.png"); + static m_ImageObject470k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470k_180.png"); + static m_ImageObject470k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R470k_270.png"); + + static m_ImageObject560k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560k.png"); + static m_ImageObject560k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560k_90.png"); + static m_ImageObject560k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560k_180.png"); + static m_ImageObject560k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R560k_270.png"); + + static m_ImageObject680k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680k.png"); + static m_ImageObject680k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680k_90.png"); + static m_ImageObject680k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680k_180.png"); + static m_ImageObject680k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R680k_270.png"); + + static m_ImageObject820k_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820k.png"); + static m_ImageObject820k_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820k_90.png"); + static m_ImageObject820k_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820k_180.png"); + static m_ImageObject820k_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R820k_270.png"); + + static m_ImageObject1M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1M.png"); + static m_ImageObject1M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1M_90.png"); + static m_ImageObject1M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1M_180.png"); + static m_ImageObject1M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1M_270.png"); + + static m_ImageObject1_2M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2M.png"); + static m_ImageObject1_2M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2M_90.png"); + static m_ImageObject1_2M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2M_180.png"); + static m_ImageObject1_2M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_2M_270.png"); + + static m_ImageObject1_5M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5M.png"); + static m_ImageObject1_5M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5M_90.png"); + static m_ImageObject1_5M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5M_180.png"); + static m_ImageObject1_5M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_5M_270.png"); + + static m_ImageObject1_8M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8M.png"); + static m_ImageObject1_8M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8M_90.png"); + static m_ImageObject1_8M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8M_180.png"); + static m_ImageObject1_8M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R1_8M_270.png"); + + static m_ImageObject2_2M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2M.png"); + static m_ImageObject2_2M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2M_90.png"); + static m_ImageObject2_2M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2M_180.png"); + static m_ImageObject2_2M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_2M_270.png"); + + static m_ImageObject2_7M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7M.png"); + static m_ImageObject2_7M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7M_90.png"); + static m_ImageObject2_7M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7M_180.png"); + static m_ImageObject2_7M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R2_7M_270.png"); + + static m_ImageObject3_3M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3M.png"); + static m_ImageObject3_3M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3M_90.png"); + static m_ImageObject3_3M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3M_180.png"); + static m_ImageObject3_3M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_3M_270.png"); + + static m_ImageObject3_9M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9M.png"); + static m_ImageObject3_9M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9M_90.png"); + static m_ImageObject3_9M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9M_180.png"); + static m_ImageObject3_9M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R3_9M_270.png"); + + static m_ImageObject4_7M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7M.png"); + static m_ImageObject4_7M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7M_90.png"); + static m_ImageObject4_7M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7M_180.png"); + static m_ImageObject4_7M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R4_7M_270.png"); + + static m_ImageObject5_6M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6M.png"); + static m_ImageObject5_6M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6M_90.png"); + static m_ImageObject5_6M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6M_180.png"); + static m_ImageObject5_6M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R5_6M_270.png"); + + static m_ImageObject6_8M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8M.png"); + static m_ImageObject6_8M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8M_90.png"); + static m_ImageObject6_8M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8M_180.png"); + static m_ImageObject6_8M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R6_8M_270.png"); + + static m_ImageObject8_2M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2M.png"); + static m_ImageObject8_2M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2M_90.png"); + static m_ImageObject8_2M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2M_180.png"); + static m_ImageObject8_2M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R8_2M_270.png"); + + static m_ImageObject10M_0 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10M.png"); + static m_ImageObject10M_90 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10M_90.png"); + static m_ImageObject10M_180 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10M_180.png"); + static m_ImageObject10M_270 = CComponentBase.doGetImageObject("img\\Components\\Resistors\\R10M_270.png"); + + static m_mapImageObjects = new Map(); + + static doCreateImageObjectMap() + { + if (CResistor.m_mapImageObjects.size == 0) + { + CResistor.m_mapImageObjects.set("1_0_0", CResistor.m_ImageObject1_0_0); + CResistor.m_mapImageObjects.set("1_0_90", CResistor.m_ImageObject1_0_90); + CResistor.m_mapImageObjects.set("1_0_180", CResistor.m_ImageObject1_0_180); + CResistor.m_mapImageObjects.set("1_0_270", CResistor.m_ImageObject1_0_270); + + CResistor.m_mapImageObjects.set("1_2_0", CResistor.m_ImageObject1_2_0); + CResistor.m_mapImageObjects.set("1_2_90", CResistor.m_ImageObject1_2_90); + CResistor.m_mapImageObjects.set("1_2_180", CResistor.m_ImageObject1_2_180); + CResistor.m_mapImageObjects.set("1_2_270", CResistor.m_ImageObject1_2_270); + + CResistor.m_mapImageObjects.set("1_5_0", CResistor.m_ImageObject1_5_0); + CResistor.m_mapImageObjects.set("1_5_90", CResistor.m_ImageObject1_5_90); + CResistor.m_mapImageObjects.set("1_5_180", CResistor.m_ImageObject1_5_180); + CResistor.m_mapImageObjects.set("1_5_270", CResistor.m_ImageObject1_5_270); + + CResistor.m_mapImageObjects.set("1_8_0", CResistor.m_ImageObject1_8_0); + CResistor.m_mapImageObjects.set("1_8_90", CResistor.m_ImageObject1_8_90); + CResistor.m_mapImageObjects.set("1_8_180", CResistor.m_ImageObject1_8_180); + CResistor.m_mapImageObjects.set("1_8_270", CResistor.m_ImageObject1_8_270); + + CResistor.m_mapImageObjects.set("2_2_0", CResistor.m_ImageObject2_2_0); + CResistor.m_mapImageObjects.set("2_2_90", CResistor.m_ImageObject2_2_90); + CResistor.m_mapImageObjects.set("2_2_180", CResistor.m_ImageObject2_2_180); + CResistor.m_mapImageObjects.set("2_2_270", CResistor.m_ImageObject2_2_270); + + CResistor.m_mapImageObjects.set("2_7_0", CResistor.m_ImageObject2_7_0); + CResistor.m_mapImageObjects.set("2_7_90", CResistor.m_ImageObject2_7_90); + CResistor.m_mapImageObjects.set("2_7_180", CResistor.m_ImageObject2_7_180); + CResistor.m_mapImageObjects.set("2_7_270", CResistor.m_ImageObject2_7_270); + + CResistor.m_mapImageObjects.set("3_3_0", CResistor.m_ImageObject3_3_0); + CResistor.m_mapImageObjects.set("3_3_90", CResistor.m_ImageObject3_3_90); + CResistor.m_mapImageObjects.set("3_3_180", CResistor.m_ImageObject3_3_180); + CResistor.m_mapImageObjects.set("3_3_270", CResistor.m_ImageObject3_3_270); + + CResistor.m_mapImageObjects.set("3_9_0", CResistor.m_ImageObject3_9_0); + CResistor.m_mapImageObjects.set("3_9_90", CResistor.m_ImageObject3_9_90); + CResistor.m_mapImageObjects.set("3_9_180", CResistor.m_ImageObject3_9_180); + CResistor.m_mapImageObjects.set("3_9_270", CResistor.m_ImageObject3_9_270); + + CResistor.m_mapImageObjects.set("4_7_0", CResistor.m_ImageObject4_7_0); + CResistor.m_mapImageObjects.set("4_7_90", CResistor.m_ImageObject4_7_90); + CResistor.m_mapImageObjects.set("4_7_180", CResistor.m_ImageObject4_7_180); + CResistor.m_mapImageObjects.set("4_7_270", CResistor.m_ImageObject4_7_270); + + CResistor.m_mapImageObjects.set("5_6_0", CResistor.m_ImageObject5_6_0); + CResistor.m_mapImageObjects.set("5_6_90", CResistor.m_ImageObject5_6_90); + CResistor.m_mapImageObjects.set("5_6_180", CResistor.m_ImageObject5_6_180); + CResistor.m_mapImageObjects.set("5_6_270", CResistor.m_ImageObject5_6_270); + + CResistor.m_mapImageObjects.set("6_8_0", CResistor.m_ImageObject6_8_0); + CResistor.m_mapImageObjects.set("6_8_90", CResistor.m_ImageObject6_8_90); + CResistor.m_mapImageObjects.set("6_8_180", CResistor.m_ImageObject6_8_180); + CResistor.m_mapImageObjects.set("6_8_270", CResistor.m_ImageObject6_8_270); + + CResistor.m_mapImageObjects.set("8_2_0", CResistor.m_ImageObject8_2_0); + CResistor.m_mapImageObjects.set("8_2_90", CResistor.m_ImageObject8_2_90); + CResistor.m_mapImageObjects.set("8_2_180", CResistor.m_ImageObject8_2_180); + CResistor.m_mapImageObjects.set("8_2_270", CResistor.m_ImageObject8_2_270); + + CResistor.m_mapImageObjects.set("10_0", CResistor.m_ImageObject10_0); + CResistor.m_mapImageObjects.set("10_90", CResistor.m_ImageObject10_90); + CResistor.m_mapImageObjects.set("10_180", CResistor.m_ImageObject10_180); + CResistor.m_mapImageObjects.set("10_270", CResistor.m_ImageObject10_270); + + CResistor.m_mapImageObjects.set("12_0", CResistor.m_ImageObject12_0); + CResistor.m_mapImageObjects.set("12_90", CResistor.m_ImageObject12_90); + CResistor.m_mapImageObjects.set("12_180", CResistor.m_ImageObject12_180); + CResistor.m_mapImageObjects.set("12_270", CResistor.m_ImageObject12_270); + + CResistor.m_mapImageObjects.set("15_0", CResistor.m_ImageObject15_0); + CResistor.m_mapImageObjects.set("15_90", CResistor.m_ImageObject15_90); + CResistor.m_mapImageObjects.set("15_180", CResistor.m_ImageObject15_180); + CResistor.m_mapImageObjects.set("15_270", CResistor.m_ImageObject15_270); + + CResistor.m_mapImageObjects.set("18_0", CResistor.m_ImageObject18_0); + CResistor.m_mapImageObjects.set("18_90", CResistor.m_ImageObject18_90); + CResistor.m_mapImageObjects.set("18_180", CResistor.m_ImageObject18_180); + CResistor.m_mapImageObjects.set("18_270", CResistor.m_ImageObject18_270); + + CResistor.m_mapImageObjects.set("22_0", CResistor.m_ImageObject22_0); + CResistor.m_mapImageObjects.set("22_90", CResistor.m_ImageObject22_90); + CResistor.m_mapImageObjects.set("22_180", CResistor.m_ImageObject22_180); + CResistor.m_mapImageObjects.set("22_270", CResistor.m_ImageObject22_270); + + CResistor.m_mapImageObjects.set("27_0", CResistor.m_ImageObject27_0); + CResistor.m_mapImageObjects.set("27_90", CResistor.m_ImageObject27_90); + CResistor.m_mapImageObjects.set("27_180", CResistor.m_ImageObject27_180); + CResistor.m_mapImageObjects.set("27_270", CResistor.m_ImageObject27_270); + + CResistor.m_mapImageObjects.set("33_0", CResistor.m_ImageObject33_0); + CResistor.m_mapImageObjects.set("33_90", CResistor.m_ImageObject33_90); + CResistor.m_mapImageObjects.set("33_180", CResistor.m_ImageObject33_180); + CResistor.m_mapImageObjects.set("33_270", CResistor.m_ImageObject33_270); + + CResistor.m_mapImageObjects.set("39_0", CResistor.m_ImageObject39_0); + CResistor.m_mapImageObjects.set("39_90", CResistor.m_ImageObject39_90); + CResistor.m_mapImageObjects.set("39_180", CResistor.m_ImageObject39_180); + CResistor.m_mapImageObjects.set("39_270", CResistor.m_ImageObject39_270); + + CResistor.m_mapImageObjects.set("47_0", CResistor.m_ImageObject47_0); + CResistor.m_mapImageObjects.set("47_90", CResistor.m_ImageObject47_90); + CResistor.m_mapImageObjects.set("47_180", CResistor.m_ImageObject47_180); + CResistor.m_mapImageObjects.set("47_270", CResistor.m_ImageObject47_270); + + CResistor.m_mapImageObjects.set("56_0", CResistor.m_ImageObject56_0); + CResistor.m_mapImageObjects.set("56_90", CResistor.m_ImageObject56_90); + CResistor.m_mapImageObjects.set("56_180", CResistor.m_ImageObject56_180); + CResistor.m_mapImageObjects.set("56_270", CResistor.m_ImageObject56_270); + + CResistor.m_mapImageObjects.set("68_0", CResistor.m_ImageObject68_0); + CResistor.m_mapImageObjects.set("68_90", CResistor.m_ImageObject68_90); + CResistor.m_mapImageObjects.set("68_180", CResistor.m_ImageObject68_180); + CResistor.m_mapImageObjects.set("68_270", CResistor.m_ImageObject68_270); + + CResistor.m_mapImageObjects.set("82_0", CResistor.m_ImageObject82_0); + CResistor.m_mapImageObjects.set("82_90", CResistor.m_ImageObject82_90); + CResistor.m_mapImageObjects.set("82_180", CResistor.m_ImageObject82_180); + CResistor.m_mapImageObjects.set("82_270", CResistor.m_ImageObject82_270); + + CResistor.m_mapImageObjects.set("100_0", CResistor.m_ImageObject100_0); + CResistor.m_mapImageObjects.set("100_90", CResistor.m_ImageObject100_90); + CResistor.m_mapImageObjects.set("100_180", CResistor.m_ImageObject100_180); + CResistor.m_mapImageObjects.set("100_270", CResistor.m_ImageObject100_270); + + CResistor.m_mapImageObjects.set("120_0", CResistor.m_ImageObject120_0); + CResistor.m_mapImageObjects.set("120_90", CResistor.m_ImageObject120_90); + CResistor.m_mapImageObjects.set("120_180", CResistor.m_ImageObject120_180); + CResistor.m_mapImageObjects.set("120_270", CResistor.m_ImageObject120_270); + + CResistor.m_mapImageObjects.set("150_0", CResistor.m_ImageObject150_0); + CResistor.m_mapImageObjects.set("150_90", CResistor.m_ImageObject150_90); + CResistor.m_mapImageObjects.set("150_180", CResistor.m_ImageObject150_180); + CResistor.m_mapImageObjects.set("150_270", CResistor.m_ImageObject150_270); + + CResistor.m_mapImageObjects.set("180_0", CResistor.m_ImageObject180_0); + CResistor.m_mapImageObjects.set("180_90", CResistor.m_ImageObject180_90); + CResistor.m_mapImageObjects.set("180_180", CResistor.m_ImageObject180_180); + CResistor.m_mapImageObjects.set("180_270", CResistor.m_ImageObject180_270); + + CResistor.m_mapImageObjects.set("220_0", CResistor.m_ImageObject220_0); + CResistor.m_mapImageObjects.set("220_90", CResistor.m_ImageObject220_90); + CResistor.m_mapImageObjects.set("220_180", CResistor.m_ImageObject220_180); + CResistor.m_mapImageObjects.set("220_270", CResistor.m_ImageObject220_270); + + CResistor.m_mapImageObjects.set("270_0", CResistor.m_ImageObject270_0); + CResistor.m_mapImageObjects.set("270_90", CResistor.m_ImageObject270_90); + CResistor.m_mapImageObjects.set("270_180", CResistor.m_ImageObject270_180); + CResistor.m_mapImageObjects.set("270_270", CResistor.m_ImageObject270_270); + + CResistor.m_mapImageObjects.set("330_0", CResistor.m_ImageObject330_0); + CResistor.m_mapImageObjects.set("330_90", CResistor.m_ImageObject330_90); + CResistor.m_mapImageObjects.set("330_180", CResistor.m_ImageObject330_180); + CResistor.m_mapImageObjects.set("330_270", CResistor.m_ImageObject330_270); + + CResistor.m_mapImageObjects.set("390_0", CResistor.m_ImageObject390_0); + CResistor.m_mapImageObjects.set("390_90", CResistor.m_ImageObject390_90); + CResistor.m_mapImageObjects.set("390_180", CResistor.m_ImageObject390_180); + CResistor.m_mapImageObjects.set("390_270", CResistor.m_ImageObject390_270); + + CResistor.m_mapImageObjects.set("470_0", CResistor.m_ImageObject470_0); + CResistor.m_mapImageObjects.set("470_90", CResistor.m_ImageObject470_90); + CResistor.m_mapImageObjects.set("470_180", CResistor.m_ImageObject470_180); + CResistor.m_mapImageObjects.set("470_270", CResistor.m_ImageObject470_270); + + CResistor.m_mapImageObjects.set("560_0", CResistor.m_ImageObject560_0); + CResistor.m_mapImageObjects.set("560_90", CResistor.m_ImageObject560_90); + CResistor.m_mapImageObjects.set("560_180", CResistor.m_ImageObject560_180); + CResistor.m_mapImageObjects.set("560_270", CResistor.m_ImageObject560_270); + + CResistor.m_mapImageObjects.set("680_0", CResistor.m_ImageObject680_0); + CResistor.m_mapImageObjects.set("680_90", CResistor.m_ImageObject680_90); + CResistor.m_mapImageObjects.set("680_180", CResistor.m_ImageObject680_180); + CResistor.m_mapImageObjects.set("680_270", CResistor.m_ImageObject680_270); + + CResistor.m_mapImageObjects.set("820_0", CResistor.m_ImageObject820_0); + CResistor.m_mapImageObjects.set("820_90", CResistor.m_ImageObject820_90); + CResistor.m_mapImageObjects.set("820_180", CResistor.m_ImageObject820_180); + CResistor.m_mapImageObjects.set("820_270", CResistor.m_ImageObject820_270); + + CResistor.m_mapImageObjects.set("1000_0", CResistor.m_ImageObject1k_0); + CResistor.m_mapImageObjects.set("1000_90", CResistor.m_ImageObject1k_90); + CResistor.m_mapImageObjects.set("1000_180", CResistor.m_ImageObject1k_180); + CResistor.m_mapImageObjects.set("1000_270", CResistor.m_ImageObject1k_270); + + CResistor.m_mapImageObjects.set("1200_0", CResistor.m_ImageObject1_2k_0); + CResistor.m_mapImageObjects.set("1200_90", CResistor.m_ImageObject1_2k_90); + CResistor.m_mapImageObjects.set("1200_180", CResistor.m_ImageObject1_2k_180); + CResistor.m_mapImageObjects.set("1200_270", CResistor.m_ImageObject1_2k_270); + + CResistor.m_mapImageObjects.set("1500_0", CResistor.m_ImageObject1_5k_0); + CResistor.m_mapImageObjects.set("1500_90", CResistor.m_ImageObject1_5k_90); + CResistor.m_mapImageObjects.set("1500_180", CResistor.m_ImageObject1_5k_180); + CResistor.m_mapImageObjects.set("1500_270", CResistor.m_ImageObject1_5k_270); + + CResistor.m_mapImageObjects.set("1800_0", CResistor.m_ImageObject1_8k_0); + CResistor.m_mapImageObjects.set("1800_90", CResistor.m_ImageObject1_8k_90); + CResistor.m_mapImageObjects.set("1800_180", CResistor.m_ImageObject1_8k_180); + CResistor.m_mapImageObjects.set("1800_270", CResistor.m_ImageObject1_8k_270); + + CResistor.m_mapImageObjects.set("2200_0", CResistor.m_ImageObject2_2k_0); + CResistor.m_mapImageObjects.set("2200_90", CResistor.m_ImageObject2_2k_90); + CResistor.m_mapImageObjects.set("2200_180", CResistor.m_ImageObject2_2k_180); + CResistor.m_mapImageObjects.set("2200_270", CResistor.m_ImageObject2_2k_270); + + CResistor.m_mapImageObjects.set("2700_0", CResistor.m_ImageObject2_7k_0); + CResistor.m_mapImageObjects.set("2700_90", CResistor.m_ImageObject2_7k_90); + CResistor.m_mapImageObjects.set("2700_180", CResistor.m_ImageObject2_7k_180); + CResistor.m_mapImageObjects.set("2700_270", CResistor.m_ImageObject2_7k_270); + + CResistor.m_mapImageObjects.set("3300_0", CResistor.m_ImageObject3_3k_0); + CResistor.m_mapImageObjects.set("3300_90", CResistor.m_ImageObject3_3k_90); + CResistor.m_mapImageObjects.set("3300_180", CResistor.m_ImageObject3_3k_180); + CResistor.m_mapImageObjects.set("3300_270", CResistor.m_ImageObject3_3k_270); + + CResistor.m_mapImageObjects.set("3900_0", CResistor.m_ImageObject3_9k_0); + CResistor.m_mapImageObjects.set("3900_90", CResistor.m_ImageObject3_9k_90); + CResistor.m_mapImageObjects.set("3900_180", CResistor.m_ImageObject3_9k_180); + CResistor.m_mapImageObjects.set("3900_270", CResistor.m_ImageObject3_9k_270); + + CResistor.m_mapImageObjects.set("4700_0", CResistor.m_ImageObject4_7k_0); + CResistor.m_mapImageObjects.set("4700_90", CResistor.m_ImageObject4_7k_90); + CResistor.m_mapImageObjects.set("4700_180", CResistor.m_ImageObject4_7k_180); + CResistor.m_mapImageObjects.set("4700_270", CResistor.m_ImageObject4_7k_270); + + CResistor.m_mapImageObjects.set("5600_0", CResistor.m_ImageObject5_6k_0); + CResistor.m_mapImageObjects.set("5600_90", CResistor.m_ImageObject5_6k_90); + CResistor.m_mapImageObjects.set("5600_180", CResistor.m_ImageObject5_6k_180); + CResistor.m_mapImageObjects.set("5600_270", CResistor.m_ImageObject5_6k_270); + + CResistor.m_mapImageObjects.set("6800_0", CResistor.m_ImageObject6_8k_0); + CResistor.m_mapImageObjects.set("6800_90", CResistor.m_ImageObject6_8k_90); + CResistor.m_mapImageObjects.set("6800_180", CResistor.m_ImageObject6_8k_180); + CResistor.m_mapImageObjects.set("6800_270", CResistor.m_ImageObject6_8k_270); + + CResistor.m_mapImageObjects.set("8200_0", CResistor.m_ImageObject8_2k_0); + CResistor.m_mapImageObjects.set("8200_90", CResistor.m_ImageObject8_2k_90); + CResistor.m_mapImageObjects.set("8200_180", CResistor.m_ImageObject8_2_k180); + CResistor.m_mapImageObjects.set("8200_270", CResistor.m_ImageObject8_2k_270); + + CResistor.m_mapImageObjects.set("10000_0", CResistor.m_ImageObject10k_0); + CResistor.m_mapImageObjects.set("10000_90", CResistor.m_ImageObject10k_90); + CResistor.m_mapImageObjects.set("10000_180", CResistor.m_ImageObject10k_180); + CResistor.m_mapImageObjects.set("10000_270", CResistor.m_ImageObject10k_270); + + CResistor.m_mapImageObjects.set("12000_0", CResistor.m_ImageObject12k_0); + CResistor.m_mapImageObjects.set("12000_90", CResistor.m_ImageObject12k_90); + CResistor.m_mapImageObjects.set("12000_180", CResistor.m_ImageObject12k_180); + CResistor.m_mapImageObjects.set("12000_270", CResistor.m_ImageObject12k_270); + + CResistor.m_mapImageObjects.set("15000_0", CResistor.m_ImageObject15k_0); + CResistor.m_mapImageObjects.set("15000_90", CResistor.m_ImageObject15k_90); + CResistor.m_mapImageObjects.set("15000_180", CResistor.m_ImageObject15k_180); + CResistor.m_mapImageObjects.set("15000_270", CResistor.m_ImageObject15k_270); + + CResistor.m_mapImageObjects.set("22000_0", CResistor.m_ImageObject22k_0); + CResistor.m_mapImageObjects.set("22000_90", CResistor.m_ImageObject22k_90); + CResistor.m_mapImageObjects.set("22000_180", CResistor.m_ImageObject22k_180); + CResistor.m_mapImageObjects.set("22000_270", CResistor.m_ImageObject22k_270); + + CResistor.m_mapImageObjects.set("27000_0", CResistor.m_ImageObject27k_0); + CResistor.m_mapImageObjects.set("27000_90", CResistor.m_ImageObject27k_90); + CResistor.m_mapImageObjects.set("27000_180", CResistor.m_ImageObject27k_180); + CResistor.m_mapImageObjects.set("27000_270", CResistor.m_ImageObject27k_270); + + CResistor.m_mapImageObjects.set("33000_0", CResistor.m_ImageObject33k_0); + CResistor.m_mapImageObjects.set("33000_90", CResistor.m_ImageObject33k_90); + CResistor.m_mapImageObjects.set("33000_180", CResistor.m_ImageObject33k_180); + CResistor.m_mapImageObjects.set("33000_270", CResistor.m_ImageObject33k_270); + + CResistor.m_mapImageObjects.set("39000_0", CResistor.m_ImageObject39k_0); + CResistor.m_mapImageObjects.set("39000_90", CResistor.m_ImageObject39k_90); + CResistor.m_mapImageObjects.set("39000_180", CResistor.m_ImageObject39k_180); + CResistor.m_mapImageObjects.set("39000_270", CResistor.m_ImageObject39k_270); + + CResistor.m_mapImageObjects.set("47000_0", CResistor.m_ImageObject47k_0); + CResistor.m_mapImageObjects.set("47000_90", CResistor.m_ImageObject47k_90); + CResistor.m_mapImageObjects.set("47000_180", CResistor.m_ImageObject47k_180); + CResistor.m_mapImageObjects.set("47000_270", CResistor.m_ImageObject47k_270); + + CResistor.m_mapImageObjects.set("56000_0", CResistor.m_ImageObject56k_0); + CResistor.m_mapImageObjects.set("56000_90", CResistor.m_ImageObject56k_90); + CResistor.m_mapImageObjects.set("56000_180", CResistor.m_ImageObject56k_180); + CResistor.m_mapImageObjects.set("56000_270", CResistor.m_ImageObject56k_270); + + CResistor.m_mapImageObjects.set("68000_0", CResistor.m_ImageObject68k_0); + CResistor.m_mapImageObjects.set("68000_90", CResistor.m_ImageObject68k_90); + CResistor.m_mapImageObjects.set("68000_180", CResistor.m_ImageObject68k_180); + CResistor.m_mapImageObjects.set("68000_270", CResistor.m_ImageObject68k_270); + + CResistor.m_mapImageObjects.set("82000_0", CResistor.m_ImageObject82k_0); + CResistor.m_mapImageObjects.set("82000_90", CResistor.m_ImageObject82k_90); + CResistor.m_mapImageObjects.set("82000_180", CResistor.m_ImageObject82k_180); + CResistor.m_mapImageObjects.set("82000_270", CResistor.m_ImageObject82k_270); + + CResistor.m_mapImageObjects.set("100000_0", CResistor.m_ImageObject100k_0); + CResistor.m_mapImageObjects.set("100000_90", CResistor.m_ImageObject100k_90); + CResistor.m_mapImageObjects.set("100000_180", CResistor.m_ImageObject100k_180); + CResistor.m_mapImageObjects.set("100000_270", CResistor.m_ImageObject100k_270); + + CResistor.m_mapImageObjects.set("120000_0", CResistor.m_ImageObject120k_0); + CResistor.m_mapImageObjects.set("120000_90", CResistor.m_ImageObject120k_90); + CResistor.m_mapImageObjects.set("120000_180", CResistor.m_ImageObject120k_180); + CResistor.m_mapImageObjects.set("120000_270", CResistor.m_ImageObject120k_270); + + CResistor.m_mapImageObjects.set("150000_0", CResistor.m_ImageObject150k_0); + CResistor.m_mapImageObjects.set("150000_90", CResistor.m_ImageObject150k_90); + CResistor.m_mapImageObjects.set("150000_180", CResistor.m_ImageObject150k_180); + CResistor.m_mapImageObjects.set("150000_270", CResistor.m_ImageObject150k_270); + + CResistor.m_mapImageObjects.set("180000_0", CResistor.m_ImageObject180k_0); + CResistor.m_mapImageObjects.set("180000_90", CResistor.m_ImageObject180k_90); + CResistor.m_mapImageObjects.set("180000_180", CResistor.m_ImageObject180k_180); + CResistor.m_mapImageObjects.set("180000_270", CResistor.m_ImageObject180k_270); + + CResistor.m_mapImageObjects.set("220000_0", CResistor.m_ImageObject220k_0); + CResistor.m_mapImageObjects.set("220000_90", CResistor.m_ImageObject220k_90); + CResistor.m_mapImageObjects.set("220000_180", CResistor.m_ImageObject220k_180); + CResistor.m_mapImageObjects.set("220000_270", CResistor.m_ImageObject220k_270); + + CResistor.m_mapImageObjects.set("330000_0", CResistor.m_ImageObject330k_0); + CResistor.m_mapImageObjects.set("330000_90", CResistor.m_ImageObject330k_90); + CResistor.m_mapImageObjects.set("330000_180", CResistor.m_ImageObject330k_180); + CResistor.m_mapImageObjects.set("330000_270", CResistor.m_ImageObject330k_270); + + CResistor.m_mapImageObjects.set("390000_0", CResistor.m_ImageObject390k_0); + CResistor.m_mapImageObjects.set("390000_90", CResistor.m_ImageObject3990); + CResistor.m_mapImageObjects.set("390000_180", CResistor.m_ImageObject390_180); + CResistor.m_mapImageObjects.set("390000_270", CResistor.m_ImageObject390_270); + + CResistor.m_mapImageObjects.set("470000_0", CResistor.m_ImageObject470k_0); + CResistor.m_mapImageObjects.set("470000_90", CResistor.m_ImageObject470k_90); + CResistor.m_mapImageObjects.set("470000_180", CResistor.m_ImageObject470k_180); + CResistor.m_mapImageObjects.set("470000_270", CResistor.m_ImageObject470k_270); + + CResistor.m_mapImageObjects.set("560000_0", CResistor.m_ImageObject560k_0); + CResistor.m_mapImageObjects.set("560000_90", CResistor.m_ImageObject560k_90); + CResistor.m_mapImageObjects.set("560000_180", CResistor.m_ImageObject560k_180); + CResistor.m_mapImageObjects.set("560000_270", CResistor.m_ImageObject560k_270); + + CResistor.m_mapImageObjects.set("680000_0", CResistor.m_ImageObject680k_0); + CResistor.m_mapImageObjects.set("680000_90", CResistor.m_ImageObject680k_90); + CResistor.m_mapImageObjects.set("680000_180", CResistor.m_ImageObject680k_180); + CResistor.m_mapImageObjects.set("680000_270", CResistor.m_ImageObject680k_270); + + CResistor.m_mapImageObjects.set("820000_0", CResistor.m_ImageObject820k_0); + CResistor.m_mapImageObjects.set("820000_90", CResistor.m_ImageObject820k_90); + CResistor.m_mapImageObjects.set("820000_180", CResistor.m_ImageObject820k_180); + CResistor.m_mapImageObjects.set("820000_270", CResistor.m_ImageObject820k_270); + + CResistor.m_mapImageObjects.set("1000000_0", CResistor.m_ImageObject1M_0); + CResistor.m_mapImageObjects.set("1000000_90", CResistor.m_ImageObject1M_90); + CResistor.m_mapImageObjects.set("1000000_180", CResistor.m_ImageObject1M_180); + CResistor.m_mapImageObjects.set("1000000_270", CResistor.m_ImageObject1M_270); + + CResistor.m_mapImageObjects.set("1200000_0", CResistor.m_ImageObject1_2M_0); + CResistor.m_mapImageObjects.set("1200000_90", CResistor.m_ImageObject1_2M_90); + CResistor.m_mapImageObjects.set("1200000_180", CResistor.m_ImageObject1_2M_180); + CResistor.m_mapImageObjects.set("1200000_270", CResistor.m_ImageObject1_2M_270); + + CResistor.m_mapImageObjects.set("1500000_0", CResistor.m_ImageObject1_5M_0); + CResistor.m_mapImageObjects.set("1500000_90", CResistor.m_ImageObject1_5M_90); + CResistor.m_mapImageObjects.set("1500000_180", CResistor.m_ImageObject1_5M_180); + CResistor.m_mapImageObjects.set("1500000_270", CResistor.m_ImageObject1_5M_270); + + CResistor.m_mapImageObjects.set("1800000_0", CResistor.m_ImageObject1_8M_0); + CResistor.m_mapImageObjects.set("1800000_90", CResistor.m_ImageObject1_8M_90); + CResistor.m_mapImageObjects.set("1800000_180", CResistor.m_ImageObject1_8M_180); + CResistor.m_mapImageObjects.set("1800000_270", CResistor.m_ImageObject1_8M_270); + + CResistor.m_mapImageObjects.set("2200000_0", CResistor.m_ImageObject2_2M_0); + CResistor.m_mapImageObjects.set("2200000_90", CResistor.m_ImageObject2_2M_90); + CResistor.m_mapImageObjects.set("2200000_180", CResistor.m_ImageObject2_2M_180); + CResistor.m_mapImageObjects.set("2200000_270", CResistor.m_ImageObject2_2M_270); + + CResistor.m_mapImageObjects.set("2700000_0", CResistor.m_ImageObject2_7M_0); + CResistor.m_mapImageObjects.set("2700000_90", CResistor.m_ImageObject2_7M_90); + CResistor.m_mapImageObjects.set("2700000_180", CResistor.m_ImageObject2_7M_180); + CResistor.m_mapImageObjects.set("2700000_270", CResistor.m_ImageObject2_7M_270); + + CResistor.m_mapImageObjects.set("3300000_0", CResistor.m_ImageObject3_3M_0); + CResistor.m_mapImageObjects.set("3300000_90", CResistor.m_ImageObject3_3M_90); + CResistor.m_mapImageObjects.set("3300000_180", CResistor.m_ImageObject3_3M_180); + CResistor.m_mapImageObjects.set("3300000_270", CResistor.m_ImageObject3_3M_270); + + CResistor.m_mapImageObjects.set("3900000_0", CResistor.m_ImageObject3_9M_0); + CResistor.m_mapImageObjects.set("3900000_90", CResistor.m_ImageObject3_9M_90); + CResistor.m_mapImageObjects.set("3900000_180", CResistor.m_ImageObject3_9M_180); + CResistor.m_mapImageObjects.set("3900000_270", CResistor.m_ImageObject3_9M_270); + + CResistor.m_mapImageObjects.set("4700000_0", CResistor.m_ImageObject4_7M_0); + CResistor.m_mapImageObjects.set("4700000_90", CResistor.m_ImageObject4_7M_90); + CResistor.m_mapImageObjects.set("4700000_180", CResistor.m_ImageObject4_7M_180); + CResistor.m_mapImageObjects.set("4700000_270", CResistor.m_ImageObject4_7M_270); + + CResistor.m_mapImageObjects.set("5600000_0", CResistor.m_ImageObject5_6M_0); + CResistor.m_mapImageObjects.set("5600000_90", CResistor.m_ImageObject5_6M_90); + CResistor.m_mapImageObjects.set("5600000_180", CResistor.m_ImageObject5_6M_180); + CResistor.m_mapImageObjects.set("5600000_270", CResistor.m_ImageObject5_6M_270); + + CResistor.m_mapImageObjects.set("6800000_0", CResistor.m_ImageObject6_8M_0); + CResistor.m_mapImageObjects.set("6800000_90", CResistor.m_ImageObject6_8M_90); + CResistor.m_mapImageObjects.set("6800000_180", CResistor.m_ImageObject6_8M_180); + CResistor.m_mapImageObjects.set("6800000_270", CResistor.m_ImageObject6_8M_270); + + CResistor.m_mapImageObjects.set("8200000_0", CResistor.m_ImageObject8_2M_0); + CResistor.m_mapImageObjects.set("8200000_90", CResistor.m_ImageObject8_2M_90); + CResistor.m_mapImageObjects.set("8200000_180", CResistor.m_ImageObject8_2M_180); + CResistor.m_mapImageObjects.set("8200000_270", CResistor.m_ImageObject8_2M_270); + + CResistor.m_mapImageObjects.set("10000000_0", CResistor.m_ImageObject10M_0); + CResistor.m_mapImageObjects.set("10000000_90", CResistor.m_ImageObject10M_90); + CResistor.m_mapImageObjects.set("10000000_180", CResistor.m_ImageObject10M_180); + CResistor.m_mapImageObjects.set("10000000_270", CResistor.m_ImageObject10M_270); + } + } + + constructor() + { + super("RESISTOR"); + CResistor.doCreateImageObjectMap(); + super.setDeviceName("RESISTOR1"); + this.m_fScale = this.m_fDefaultScale = 8.2; + this.m_bIsBlown = false; + this.m_fResistance = 0; + + this.doAddPin(new CPin(0, false, false, "pin 1", this.getDeviceName())); + this.doAddPin(new CPin(1, false, false, "pin 2", this.getDeviceName())); + this.doSetResistance(10000); + this.doRotate(0); + + this.m_strEditHTML += "  
  " + + " " + + " " + + "
"; + } + + doStopRun() + { + } + + doRun() + { + if (!this.m_bIsBlown) + { + var fPin1Voltage = this.m_arrayPins[0].getVoltage(); + var fPin2Voltage = this.m_arrayPins[1].getVoltage(); + var fTotalVoltage = Math.abs(fPin1Voltage - fPin2Voltage); + var fResistance = this.m_arrayPins[0].getResistance() + this.m_arrayPins[0].getResistance() + this.m_fResistance; + var fCurrent = fTotalVoltage / fResistance, fPower = 0; + + fCurrent = fTotalVoltage / fResistance; + fPower = fCurrent * fTotalVoltage; + + if (fPower > 0.5) + this.doBlown(); + } + } + + doRead(strFileContents) + { + strFileContents = super.doRead(strFileContents); + + var strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_fResistance = parseFloat(strTemp); + + return strFileContents; + } + + doWrite(strFileContents) + { + strFileContents = super.doWrite(strFileContents); + + strFileContents += this.m_fResistance + "\r\n"; + + return strFileContents; + } + + getResistance() + { + return this.m_fResistance; + } + + getVoltage(strDeviceNameIn, strPinIDIn) + { + var strDeviceNameOut = this.getDeviceName(), strPinIDOut = "", strWireName = ""; + var fVoltage = 0; + + if (this.m_arrayPins[0].getPinID() != strPinIDIn) + { + strWireName = this.m_arrayPins[0].getWire(); + strPinIDOut = this.m_arrayPins[0].getPinID(); + } + else if (this.m_arrayPins[1].getPinID() != strPinIDIn) + { + strWireName = this.m_arrayPins[1].getWire(); + strPinIDOut = this.m_arrayPins[1].getPinID(); + } + if ((strWireName != "") && g_mapPlacedComponents.get(strWireName)) + fVoltage = g_mapPlacedComponents.get(strWireName).getVoltage(strDeviceNameOut, strPinIDOut); + + return fVoltage; + } + + doSetResistance(fResistance) + { + var strKey = ""; + + if (fResistance == 1) + strKey = fResistance.toString() + ".0"; + else + strKey = fResistance.toString(); + + strKey = strKey.replace(".", "_"); + strKey += "_"; + + this.m_ImageObject0 = CResistor.m_mapImageObjects.get(strKey + "0"); + this.m_ImageObject90 = CResistor.m_mapImageObjects.get(strKey + "90"); + this.m_ImageObject180 = CResistor.m_mapImageObjects.get(strKey + "180"); + this.m_ImageObject270 = CResistor.m_mapImageObjects.get(strKey + "270"); + + this.m_fResistance = fResistance; + } + + doSetPinPositions() + { + if (this.m_nRotationAngle == 0) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(0, 4)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(48, 4)); + } + else if (this.m_nRotationAngle == 90) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(4, 0)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(4, 48)); + } + else if (this.m_nRotationAngle == 180) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(0, 4)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(48, 4)); + } + else if (this.m_nRotationAngle == 270) + { + this.m_arrayPins[0].set(this.m_rectangle.m_pointTL, new CSize(4, 0)); + this.m_arrayPins[1].set(this.m_rectangle.m_pointTL, new CSize(4, 48)); + } + } + + doSelect() + { + this.m_bSelected = true; + var strHTML = this.m_strEditHTML; + strHTML = strHTML.replace("XXXX", this.m_strDeviceName); + strHTML = strHTML.replace("YYYY", this.m_strDeviceName); + strHTML = strHTML.replace("ZZZZ", this.m_strDeviceName); + doShowEditFields(strHTML); + } + + doBlown() + { + this.m_ImageObject0 = CResistor.m_ImageObjectBlown_0; + this.m_ImageObject90 = CResistor.m_ImageObjectBlown_90; + this.m_ImageObject180 = CResistor.m_ImageObjectBlown_180; + this.m_ImageObject270 = CResistor.m_ImageObjectBlown_270; + this.m_bIsBlown = true; + } + + doUnblown() + { + this.doSetResistance(this.m_fResistance); + } + + doDisplay() + { + super.doDisplay(); + } + +} + diff --git a/ardublockly/PinDataStructures.js b/ardublockly/PinDataStructures.js new file mode 100644 index 0000000000..a2f96c5ed3 --- /dev/null +++ b/ardublockly/PinDataStructures.js @@ -0,0 +1,431 @@ +//************************************************************************* +//* +//* PIN WITH CONNECTED COMPONENT +//* +//************************************************************************* + +class CPin +{ + constructor(nPinNum, bIsPWM, bIsAnalog, strPinID, strParentDeviceName) + { + this.m_nPinNum = nPinNum; + this.m_nState = 0; + this.m_nPWM = 0; + this.m_strMode = INPUT; + this.m_bIsPWM = bIsPWM; + this.m_bIsAnalog = bIsAnalog; + this.m_sizeOffsetFromTL = new CSize(0, 0); + this.m_strParentDeviceName = strParentDeviceName; + this.m_strPinID = strPinID; + this.m_strWireName = ""; + + var point = new CPoint(0, 0); + var size = new CSize(4, 4); + this.m_rectangle = new CRectangle(point, size); + } + + doRead(strFileContents) + { + this.m_strPinID = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strPinID); + + this.m_strWireName = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strWireName); + + return strFileContents; + } + + doWrite(strFileContents) + { + strFileContents += this.m_strPinID + "\r\n"; + strFileContents += this.m_strWireName + "\r\n"; + + return strFileContents; + } + + canAcceptConection() + { + return this.m_strWireName == ""; + } + + doSetDeviceName(strParentDeviceName) + { + this.m_strParentDeviceName = strParentDeviceName; + } + + isDataPin() + { + return true; + } + + getPWM() + { + return this.m_nPWM; + } + + getState() + { + return this.m_nState; + } + + getType() + { + return "PIN"; + } + + getPinID() + { + return this.m_strPinID; + } + + getWire() + { + return this.m_strWireName; + } + + setWire(strWireName) + { + this.m_strWireName = strWireName; + } + + doDeleteWire(strWireName) + { + if (this.m_strWireName == strWireName) + this.m_strWireName = ""; + } + + set(pointParentTL, sizeOffsetFromTL) + { + this.m_sizeOffsetFromTL = new CSize(sizeOffsetFromTL.m_nWidth, sizeOffsetFromTL.m_nHeight); + this.doMove(pointParentTL); + } + + getPosition() + { + return this.m_rectangle.getCenter(); + } + + doConnectedMove(strParentDeviceName) + { + if ((this.m_strWireName != "") && (g_mapPlacedComponents.get(this.m_strWireName) != null)) + g_mapPlacedComponents.get(this.m_strWireName).doConnectedMove(this.m_rectangle.getCenter(), strParentDeviceName, this.m_strPinID); + } + + doMove(pointParentTL) + { + this.m_rectangle.setPosition(new CPoint(pointParentTL.m_nX + this.m_sizeOffsetFromTL.m_nWidth, pointParentTL.m_nY + this.m_sizeOffsetFromTL.m_nHeight)); + } + + doGetZoomFactor() + { + var nZoom = g_mapPlacedComponents.get(this.m_strParentDeviceName).getZoom(); + var nFudge = 1.06; + + if (nZoom == 0) + nZoom = 1; + else if (nZoom < 0) + nZoom = 1 / (Math.abs(nZoom) * nFudge); + else if (nZoom > 0) + nZoom *= nFudge; + + return nZoom; + } + + doDisplay(bFill) + { + var rect = this.m_rectangle; + var nZoomFactor = this.doGetZoomFactor(); + + g_CanvasContext.beginPath(); + g_CanvasContext.strokeStyle = "blue"; + g_CanvasContext.lineWidth = "1"; + if (bFill) + { + g_CanvasContext.fillStyle = "blue"; + g_CanvasContext.fillRect(rect.m_pointTL.m_nX * nZoomFactor, rect.m_pointTL.m_nY * nZoomFactor, rect.m_size.m_nWidth, rect.m_size.m_nHeight); + doDisplayHint("PIN ID", this.m_strPinID); + } + else + { + g_CanvasContext.rect(rect.m_pointTL.m_nX * nZoomFactor, rect.m_pointTL.m_nY * nZoomFactor, rect.m_size.m_nWidth, rect.m_size.m_nHeight); + } + g_CanvasContext.stroke(); + + if ((this.m_strWireName != "") && (g_mapPlacedComponents.get(this.m_strWireName) != null)) + g_mapPlacedComponents.get(this.m_strWireName).doDisplay(); + } + + isMouseIn(pointMousePos) + { + return this.m_rectangle.isMouseIn(pointMousePos); + } + + doMouseOver(pointMousePos) + { + var bResult = false; + var rect = new CRectangle(this.m_rectangle.m_pointTL, this.m_rectangle.m_size); + var pointCenter = rect.getCenter(); + + + if (rect.isMouseIn(pointMousePos)) + { + doDisplayAllComponents(); + + this.doDisplay(true); + this.m_bImageDrawn = true; + + bResult = true; + } + else + { + this.doDisplay(false); + doDisplayHint("", ""); + } + return bResult; + } + + pinMode(strMode) + { + if ((strMode != INPUT_HIGH) && (strMode != INPUT) && (strMode != OUTPUT)) + doErrorMessage(g_strErrorMessage + "unexpected pin mode '" + strMode + "' for pin '" + this.m_nPinNum + "'!"); + else + this.m_strMode = strMode; + } + + digitalRead() + { + var nState = 0; + + if ((this.m_strMode == INPUT) || (this.m_strMode == INPUT_HIGH)) + nState = this.m_nState; + else + doErrorMessage(g_strErrorMessage + "attempting to read from pin '" + this.m_nPinNum + "' which is in '" + this.m_strMode + "' mode!"); + + return nState; + } + + digitalWrite(strState) + { + if (this.m_strMode == OUTPUT) + { + this.m_nPWM = -1; + + if ((strState == "true") || (strState == "1") || (strState == HIGH)) + this.m_nState = 1; + else if ((strState == "false") || (strState == "0") || (strState == LOW)) + this.m_nState = 0; + else + { + let nState = parseInt(strState); + if (isNAN(nState)) + doErrorMessage(g_strErrorMessage + "attempting to write to pin '" + this.m_nPinNum + "' an invalid value '" + strState + "'!"); + else + this.m_nState = 1; + } +//console.log("Pin " + this.m_strPinID + ": " + this.m_nState); + } + else + doErrorMessage(g_strErrorMessage + "attempting to write to pin '" + this.m_nPinNum + "' which is in '" + this.m_strMode + "' mode!"); + } + + analogWrite(strPWMVal) + { + var nPWM = parseInt(strPWMVal); + + if (this.m_strMode != OUTPUT) + doErrorMessage(g_strErrorMessage + "attempting to analog write to pin '" + this.m_nPinNum + "' which is in '" + this.m_strMode + "' mode!"); + else if (!this.m_bIsPWM) + doErrorMessage(g_strErrorMessage + "attempting to analog write to pin '" + this.m_nPinNum + "' which is not a PWM pin!"); + else if (isNaN(nPWM)) + doErrorMessage(g_strErrorMessage + "attempting to analog write an invalid value '" + strPWMVal + "'!"); + else + { + this.m_nState = -1; + this.m_nPWM = nPWM; + } + } + + analogRead() + { + var nVal = 0; + + if (this.m_strMode == OUTPUT) + doErrorMessage(g_strErrorMessage + "attempting to analog read from pin '" + this.m_nPinNum + "' which is in '" + this.m_strMode + "' mode!"); + else + nVal = this.m_nState; + + return nVal; + } + + doUpdate() + { + var strName = ""; + var Wire = g_mapPlacedComponents.get(this.m_strWireName); + + if (Wire != null) + { + for (let nI = 0; nI < Wire.doGetNumConnections(); nI++) + { + strName = Wire.doGetConnectionName(nI); + if ((strName != "") && (g_mapPlacedComponents.get(strName) != null)) + { + g_mapPlacedComponents.get(strName).doUpdate(this.m_nState); + } + } + } + } + + doRun() + { + } + + doDeleteWire(strWireName) + { + if (this.m_strWireName == strWireName) + this.m_strWireName = ""; + } + + getVoltage() + { + var fVoltage = 0; + + fVoltage = g_mapPlacedComponents.get(this.m_strWireName).getVoltage(this.m_strParentDeviceName, this.m_strPinID); + + return fVoltage; + } + + getResistance() + { + var fResistance = 0; + + fResistance += g_mapPlacedComponents.get(this.m_strWireName).getResistance(this.m_strParentDeviceName, this.m_strPinID); + + return fResistance; + } + +} + + + + +//************************************************************************* +//* +//* 5V PIN WITH CONNECTED COMPONENTS +//* +//************************************************************************* + +class C5VPin extends CPin +{ + static m_nPinIDCounter = 1; + + constructor(nPinNum, strParentDeviceName) + { + super(nPinNum, false, false, "5V_" + C5VPin.m_nPinIDCounter, strParentDeviceName); + C5VPin.m_nPinIDCounter++; + this.m_nState = 1; + this.m_strMode = OUTPUT; + } + + isDataPin() + { + return false; + } + + getState() + { + return 1; + } + +} + + + + +//************************************************************************* +//* +//* 3.3V PIN WITH CONNECTED COMPONENTS +//* +//************************************************************************* + +class C3_3VPin extends CPin +{ + static m_nPinIDCounter = 1; + + constructor(nPinNum, strParentDeviceName) + { + super(nPinNum, false, false, "3.3V_" + C3_3VPin.m_nPinIDCounter, strParentDeviceName); + C3_3VPin.m_nPinIDCounter++; + this.m_nState = 1; + this.m_strMode = OUTPUT; + } + + isDataPin() + { + return false; + } + + getState() + { + return 1; + } + +} + + + + +//************************************************************************* +//* +//* GND PIN WITH CONNECTED COMPONENTS +//* +//************************************************************************* + +class CGNDPin extends CPin +{ + static m_nPinIDCounter = 1; + + constructor(nPinNum, strParentDeviceName) + { + super(nPinNum, false, false, "GND_" + CGNDPin.m_nPinIDCounter, strParentDeviceName); + CGNDPin.m_nPinIDCounter++; + this.m_nState = 0; + this.m_strMode = OUTPUT; + } + + isDataPin() + { + return false; + } + + getState() + { + return 0; + } + +} + + + + +//************************************************************************* +//* +//* RESET PIN WITH CONNECTED COMPONENT +//* +//************************************************************************* + +class CResetPin extends CPin +{ + constructor(nPinNum, strParentDeviceName) + { + super(nPinNum, false, false, "RESET", strParentDeviceName); + this.m_nState = 0; + this.m_strMode = INPUT; + } + + isDataPin() + { + return false; + } + +} + diff --git a/ardublockly/PortDataStructures.js b/ardublockly/PortDataStructures.js new file mode 100644 index 0000000000..4d19feaf94 --- /dev/null +++ b/ardublockly/PortDataStructures.js @@ -0,0 +1,267 @@ +//************************************************************************* +//* +//* BASE PORT +//* +//************************************************************************* + +class CBasePort +{ + constructor(strDeviceName) + { + this.m_mapConnectedDevices = new Map(); + this.m_strDeviceName = strDeviceName; + } + + addDevice(strHexAddress, strComponentName) + { + this.m_mapConnectedDevices.set(strHexAddress, strComponentName); + } + + removeDevice(strComponentName) + { + var mapDeviceNames = new Map(); + var strDeviceName = "", strSelectedDeviceName = ""; + + g_mapPlacedComponents.forEach(function(strValue, strKey, map){mapDeviceNames.set([strValue, strKey])}); + this.m_mapConnectedDevices.delete(mapDeviceNames.get(strComponentName)); + } + + doDeleteAllDevices() + { + this.m_mapConnectedDevices.clear(); + } + + setDeviceName(strNewDeviceName) + { + this.m_strDeviceName = strNewDeviceName; + } + + getDeviceName() + { + return this.m_strDeviceName; + } +} + + + + +//************************************************************************* +//* +//* I2C PORT +//* +//************************************************************************* + +class CI2CPort extends CBasePort +{ + constructor(nClockPin, nDataPin, strDeviceName) + { + super(strDeviceName); + this.m_nClockPin = nClockPin; + this.m_nDataPin = nDataPin; + } + + send(strHexAddress, Data) + { + var strComponentName = m_mapConnectedDevices.get(strHexAddress); + var Component = g_mapPlacedComponents[strComponentName]; + + if (Component == null) + Data = g_strErrorMessage + "I2C device with hex address '" + strHexAddress + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.send(Data); + + return Data; + } + + receive(strHexAddress) + { + var Data = null; + var strComponentName = m_mapConnectedDevices.get(strHexAddress); + var Component = g_mapPlacedComponents[strComponentName]; + + if (Component == null) + Data = g_strErrorMessage + "I2C device with hex address '" + strHexAddress + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.receive(); + + return Data; + } + + checkConnection(Component) + { + var bIsCorrect = false; + var strDeviceName = this.m_mapConnectedDevices[strHexAddress]; + var Component = g_mapPlacedComponents[strDeviceName]; + + if (Component.isI2CDevice()) + { + if (Component.getI2CDataPin() != this.m_nDataPin) + doErrorMessage(g_strErrorMessage + "I2C data pin mismatch, '" + strDeviceName + "': " + Component.getI2CDataPin() + ", '" + + this.m_strDeviceName + "', " + this.m_nDataPin + "!"); + else if (Component.getI2CDataPin() != this.m_nDataPin) + doErrorMessage(g_strErrorMessage + "I2C clock pin mismatch, '" + strDeviceName + "': " + Component.getI2CClockPin() + ", '" + + this.m_strDeviceName + "', " + this.m_nClockPin + "!"); + else + bIsCorrect = true; + } + else + doErrorMessage(g_strErrorMessage + "device '" + strDeviceName + "', is not an I2C device!"); + + return bIsCorrect; + } +} + + + + +//************************************************************************* +//* +//* SPI PORT +//* +//************************************************************************* + +class CSPIPort extends CBasePort +{ + constructor(nMOSIPin, nMISOPin, nCLKPin, strDeviceName) + { + super(strDeviceName); + this.m_nMOSIPin = nMOSIPin; + this.m_nMISOPin = nMISOPin; + this.m_nCLKPin = nCLKPin; + } + + send(nCSPin, Data) + { + var strComponentName = m_mapConnectedDevices.get(nCSPin); + var Component = g_mapPlacedComponents[strComponentName]; + + if (Component == null) + Data = g_strErrorMessage + "SPI device using CS pin '" + nCSPin + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.send(Data); + + return Data; + } + + receive(nCSPin) + { + var Data = null; + var strComponentName = m_mapConnectedDevices.get(nCSPin); + var Component = g_mapPlacedComponents[strComponentName]; + + if (Component == null) + Data = g_strErrorMessage + "SPI device using CS pin '" + nCSPin + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.receive(); + + return Data; + } + + checkConnection(Component) + { + var bIsCorrect = false; + var strDeviceName = this.m_mapConnectedDevices[Component.getCSPin()]; + var Component = g_mapPlacedComponents[strDeviceName]; + + if (Component.isSPIDevice()) + { + if (Component.getMOSIPin() != this.m_nMOSIPin) + doErrorMessage(g_strErrorMessage + "SPI MOSI mismatch, '" + strDeviceName + "': " + Component.getMOSIPin() + ", '" + + this.m_strDeviceName + "', " + this.m_nMOSIPin + "!"); + else if (Component.getMISOPin() != this.m_nMISOPin) + doErrorMessage(g_strErrorMessage + "SPI MISO mismatch, '" + strDeviceName + "': " + Component.getMISOPin() + ", '" + + this.m_strDeviceName + "', " + this.m_nMISOPin + "!"); + else if (Component.getCLKPin() != this.m_nCLKPin) + doErrorMessage(g_strErrorMessage + "SPI CLK mismatch, '" + strDeviceName + "': " + Component.getCLKPin() + ", '" + + this.m_strDeviceName + "', " + this.m_nCLKPin + "!"); + else + bIsCorrect = true; + } + else + doErrorMessage(g_strErrorMessage + "device '" + strDeviceName + "', is not an SPI device!"); + + return bIsCorrect; + } + +} + + + + +//************************************************************************* +//* +//* SERIAL PORT +//* +//************************************************************************* + +class CSerialPort extends CBasePort +{ + constructor(nTxPin, nRxPin, strDeviceName) + { + super(strDeviceName); + this.m_nTxPin = nTxPin; + this.m_nRxPin = nRxPin; + } + + send(Data) + { + var Component = g_mapPlacedComponents[this.m_strConnectedDeviceName]; + + if (Component == null) + Data = g_strErrorMessage + "serial device '" + this.m_strConnectedDeviceName + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.send(Data); + + return Data; + } + + receive() + { + var Data = null; + var Component = g_mapPlacedComponents[this.m_strConnectedDeviceName]; + + if (Component == null) + Data = g_strErrorMessage + "serial device with name '" + this.m_strConnectedDeviceName + "' not found!"; + else if (!checkConnection(Component)) + Data = this.m_strErrorMessage; + else + Data = Component.receive(); + + return Data; + } + + checkConnection(Component) + { + var bIsCorrect = false; + var Component = g_mapPlacedComponents[this.m_strConnectedDeviceName]; + + if (Component.isSerialDevice()) + { + if (Component.getSerialTxPin() == this.m_nTxPin) + doErrorMessage(g_strErrorMessage + "'" + strDeviceName + "' Tx pin should be connected to Rx pin of '" + this.m_strDeviceName + "'!"); + else if (Component.getSerialRxPin() == this.m_nRxPin) + doErrorMessage(g_strErrorMessage + "'" + strDeviceName + "' Rx pin should be connected to Tx pin of '" + this.m_strDeviceName + + "' (" + this.m_strTxPin + ")!"); + else + bIsCorrect = true; + } + else + doErrorMessage(g_strErrorMessage + "device '" + this.m_strConnectedDeviceName + "', is not an serial device!"); + + return bIsCorrect; + } +} + + + + diff --git a/ardublockly/SerialMonitorDataStructures.js b/ardublockly/SerialMonitorDataStructures.js new file mode 100644 index 0000000000..594463de1a --- /dev/null +++ b/ardublockly/SerialMonitorDataStructures.js @@ -0,0 +1,154 @@ +//************************************************************************* +//* +//* SERIAL MONITOR +//* +//************************************************************************* + +class CSerialMonitor +{ + constructor() + { + this.m_nSelectedBaudRate = 0; + this.m_nBeginBaudRate = 0; + this.m_strTextWaiting = ""; + this.m_bAutoScroll = true; + this.m_bIsOpen = false; + } + + begin(nBaudRate) + { + this.m_nBeginBaudRate = nBaudRate; + } + + setOpen() + { + this.m_bIsOpen = true; + } + + setClose() + { + this.m_bIsOpen = false; + } + + select(nBaudRate) + { + this.m_nSelectedBaudRate = nBaudRate; + } + + doBaudRatesMatch() + { + var bMatch = false; + + if (this.m_nSelectedBaudRate != this.m_nBeginBaudRate) + doErrorMessage("Selected baud rate (" + this.m_nSelectedBaudRate + ") and programatic baud rate (" + this.m_nBeginBaudRate + ") do not match!") + else + bMatch = true; + + return bMatch; + } + + setTextWaiting(strTextWaiting) + { + var bResult = false; + + if (this.doBaudRatesMatch()) + { + this.m_strTextWaiting = strTextWaiting; + bResult = true; + } + return bResult; + } + + printText(strText) + { + var bResult = false; + var SerialMonitorDiv = getElement("content_serial_monitor"); + + if ((SerialMonitorDiv != null) && this.m_bIsOpen) + { + if (this.doBaudRatesMatch()) + { + if ((strText[0] == "\"") || (strText[0] == "'")) + strText = strText.substring(1, strText.length - 1); + + if (SerialMonitorDiv.innerText.length > 10000) + SerialMonitorDiv.innerText = strText; + else + SerialMonitorDiv.innerText += strText; + + if (!this.m_bAutoScroll) + SerialMonitorDiv.scrollTop = 0; + else + SerialMonitorDiv.scrollTop = SerialMonitorDiv.scrollHeight; + + bResult = true; + } + } + return bResult; + } + + printlnText(strText) + { + var bResult = this.printText(strText); + + if (bResult) + this.printText("\n"); + + return bResult; + } + + printInt(nVal, strBase) + { + var strText = ""; + + if ((strBase == null) || (strBase == "DEC")) + strText = nVal.toString(10); + else if (strBase == "HEX") + strText = nVal.toString(16); + else if (strBase == "OCT") + strText = nVal.toString(8); + else if (strBase == "BIN") + strText = nVal.toString(2); + + return this.print(strText); + } + + printlnInt(nVal, strBase) + { + var bResult = printInt(nVal, strBase); + + if (bResult) + printText("\n"); + + return bResult; + } + + setAutoScroll(bAutoScroll) + { + this.m_bAutoScroll = bAutoScroll; + } + +} + +//************************************************************************* +//* +//* GLOBAL VARIBALES +//* +//************************************************************************* + +var g_SerialMonitor = new CSerialMonitor(); + +function setSerialMonitorBaudRate() +{ + var SelectBaudRate = document.getElementById("Baud"); + SelectBaudRate.selectedIndex = 12; + var nBaud = SelectBaudRate.options[SelectBaudRate.selectedIndex].value; + + g_SerialMonitor.select(nBaud); +} + +setSerialMonitorBaudRate(); + + + + diff --git a/ardublockly/Simulation.htm b/ardublockly/Simulation.htm new file mode 100644 index 0000000000..5233586229 --- /dev/null +++ b/ardublockly/Simulation.htm @@ -0,0 +1,1546 @@ + + + + + + + + + + Ardublockly Simulator + + + + + + + + + + + +
+ LOADING... +
+ + + + + + + diff --git a/ardublockly/WireDataStructures.js b/ardublockly/WireDataStructures.js new file mode 100644 index 0000000000..340ae98798 --- /dev/null +++ b/ardublockly/WireDataStructures.js @@ -0,0 +1,666 @@ +//************************************************************************* +//* +//* CONNECTED COMPONENT DETAILS +//* +//************************************************************************* + +class CConnectedDevice +{ + constructor(strDeviceName, strPinID, strType, nNodeIndex) + { + this.m_strDeviceName = strDeviceName; + this.m_strPinID = strPinID; + this.m_strType = strType; + this.m_nNodeIndex = nNodeIndex; + } + + doRead(strFileContents) + { + this.m_strDeviceName = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strDeviceName); + + this.m_strPinID = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strPinID); + + this.m_strType = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, this.m_strType); + + var strTemp = doReadNextToken(strFileContents); + strFileContents = doDeleteToken(strFileContents, strTemp); + this.m_nNodeIndex = parseInt(strTemp); + + return strFileContents; + } + + doWrite(strFileContents) + { + strFileContents += this.m_strDeviceName + "\r\n"; + strFileContents += this.m_strPinID + "\r\n"; + strFileContents += this.m_strType + "\r\n"; + strFileContents += this.m_nNodeIndex + "\r\n"; + + return strFileContents; + } + + getDeviceName() + { + return this.m_strDeviceName; + } + + getPinID() + { + return this.m_strPinID; + } + + getType() + { + return this.m_strType; + } + + getNodeIndex() + { + return this.m_nNodeIndex; + } + + setDeviceName(strDeviceName) + { + this.m_strDeviceName = strDeviceName; + } + + setPinID(strPinID) + { + this.m_strPinID = strPinID; + } + + setType(strType) + { + this.m_strType = strType; + } + + setNodeIndex(nNodeIndex) + { + this.m_nNodeIndex = nNodeIndex; + } + + isEmpty() + { + return (this.m_strDeviceName == "") && (this.m_strPinID == ""); + } + +} + + + + +//************************************************************************* +//* +//* WIRE +//* +//************************************************************************* + +function doChangeWireColor(strNewColor) +{ + var strName = doFindSelectedComponentNoMouse(); + + if ((strName != "") && (g_mapPlacedComponents.get(strName) != null) && (g_mapPlacedComponents.get(strName).getType() == "WIRE")) + { + g_mapPlacedComponents.get(strName).doSetColor(strNewColor); + doDisplayAllComponents(); + } +} + +class CWire +{ + static m_nWireCount = 1; + static m_nNodeRadius = 4; + + constructor(strColor) + { + CWire.m_nWireCount++; + this.m_arrayPoints = []; + this.m_strColor = strColor; + this.m_strType = "WIRE"; + this.m_strDeviceName = this.m_strType + CWire.m_nWireCount; + this.m_nWidth = 3; + this.m_bSelected = false; + this.m_pointTemp = new CPoint(0, 0); + this.m_nIndexGrabbedPoint = -1; + this.m_arrayConnectedDevices = []; + this.m_bHighlight = false; + this.m_pointLastMousePos = new CPoint(0, 0); + this.m_TempConnectedDevice = new CConnectedDevice("", "", "", -1); + this.m_nZoom = 0; + + this.m_strHTML = "  
WIRE COLORS:
" + + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + "
" + + + "
"; + } + + doWrite(strFileContents) + { + strFileContents += this.m_strDeviceName + "\r\n"; + for (let nI = 0; nI < this.m_arrayConnectedDevices.length; nI++) + strFileContents += this.m_arrayConnectedDevices.doWrite(strFileContents); + return strFileContents; + } + + doRun() + { + } + + doStopRun() + { + } + + getVoltage(strDeviceNameIn, strPinIDIn) + { + var strDeviceNameOut = "", strPinIDOut = ""; + var fVoltage = 0; + + if ((this.m_arrayConnectedDevices.length > 0) && (this.m_arrayConnectedDevices[0].getDeviceName() != strDeviceNameIn) && (this.m_arrayConnectedDevices[0].getPinID() != strPinIDIn)) + { + strDeviceNameOut = this.m_arrayConnectedDevices[0].getDeviceName(); + strPinIDOut = this.m_arrayConnectedDevices[0].getPinID(); + } + else if ((this.m_arrayConnectedDevices.length > 1) && (this.m_arrayConnectedDevices[1].getDeviceName() != strDeviceNameIn) && (this.m_arrayConnectedDevices[1].getPinID() != strPinIDIn)) + { + strDeviceNameOut = this.m_arrayConnectedDevices[1].getDeviceName(); + strPinIDOut = this.m_arrayConnectedDevices[1].getPinID(); + } + if ((strDeviceNameOut != "") && g_mapPlacedComponents.get(strDeviceNameOut)) + fVoltage = g_mapPlacedComponents.get(strDeviceNameOut).getVoltage(strDeviceNameOut, strPinIDOut); + + return fVoltage; + } + + getResistance(strDeviceNameIn, strPinIDIn) + { + var strDeviceNameOut = "", strPinIDOut = ""; + var fResistance = 0; + + if ((this.m_arrayConnectedDevices.length > 0) && (this.m_arrayConnectedDevices[0].getDeviceName() != strDeviceNameIn) && (this.m_arrayConnectedDevices[0].getPinID() != strPinIDIn)) + { + strDeviceNameOut = this.m_arrayConnectedDevices[0].getDeviceName(); + strPinIDOut = this.m_arrayConnectedDevices[0].getPinID(); + } + else if ((this.m_arrayConnectedDevices.length > 1) && (this.m_arrayConnectedDevices[1].getDeviceName() != strDeviceNameIn) && (this.m_arrayConnectedDevices[1].getPinID() != strPinIDIn)) + { + strDeviceNameOut = this.m_arrayConnectedDevices[1].getDeviceName(); + strPinIDOut = this.m_arrayConnectedDevices[1].getPinID(); + } + if ((strDeviceNameOut != "") && g_mapPlacedComponents.get(strDeviceNameOut)) + fResistance += g_mapPlacedComponents.get(strDeviceNameOut).getResistance(strDeviceNameOut, strPinIDOut); + + return fResistance; + } + + isConnected() + { + return this.m_arrayConnectedDevices.length > 0; + } + + getNumConnections() + { + return this.m_arrayConnectedDevices.length; + } + + getConnectionName(nIndex) + { + var strName = ""; + + if ((nIndex >= 0) && (nIndex < this.m_arrayConnectedDevices.length)) + strName = this.m_arrayConnectedDevices[nIndex].getDeviceName(); + + return strName; + } + + getType() + { + return "WIRE"; + } + + getColor() + { + return this.m_strColor; + } + + setColor(strNewColor) + { + this.m_strColor = strNewColor; + } + + getDeviceName() + { + return this.m_strDeviceName; + } + + doAppendNode(pointNew) + { + pointNew.m_nX -= (pointNew.m_nX % g_nGridSize); + pointNew.m_nY -= (pointNew.m_nY % g_nGridSize); + this.m_arrayPoints[this.m_arrayPoints.length] = pointNew; + this.m_arrayPoints[this.m_arrayPoints.length] = new CPoint(pointNew.m_nX + 10, pointNew.m_nY + 10); + this.m_nIndexGrabbedPoint = this.m_arrayPoints.length - 1; + } + + doDeleteNode(nIndex) + { + var arrayNew = []; + + for (let nI = 0; nI < nIndex; nI++) + arrayNew[arrayNew.length] = this.m_arrayPoints[nI]; + + for (let nI = nIndex + 1; nI < this.m_arrayPoints.length; nI++) + arrayNew[arrayNew.length] = this.m_arrayPoints[nI]; + + this.m_arrayPoints = arrayNew; + } + + doInsertNode(pointNew) + { + var arrayNew = []; + + pointNew.m_nX -= (pointNew.m_nX % g_nGridSize); + pointNew.m_nY -= (pointNew.m_nY % g_nGridSize); + + if (this.m_arrayPoints.length == 2) + { + if (this.doesLineContain(this.m_arrayPoints[0], this.m_arrayPoints[1], pointNew, this.m_nWidth)) + { + arrayNew[arrayNew.length] = this.m_arrayPoints[0]; + arrayNew[arrayNew.length] = pointNew; + arrayNew[arrayNew.length] = this.m_arrayPoints[1]; + this.m_arrayPoints = arrayNew; + this.doDisplay(); + } + } + else + { + for (var nI = 1; nI < this.m_arrayPoints.length; nI++) + { + if (this.doesLineContain(this.m_arrayPoints[nI - 1], this.m_arrayPoints[nI], pointNew, this.m_nWidth)) + { + for (let nJ = 0; nJ < nI; nJ++) + arrayNew[arrayNew.length] = this.m_arrayPoints[nJ]; + + arrayNew[arrayNew.length] = pointNew; + + for (let nJ = nI; nJ < this.m_arrayPoints.length; nJ++) + arrayNew[arrayNew.length] = this.m_arrayPoints[nJ]; + this.m_arrayPoints = arrayNew; + this.doDisplay(); + break; + } + } + } + } + + doesNodeContain(pointMouse, pointNode, nRadius) + { + var nDistancePoints = (pointMouse.m_nX - pointNode.m_nX) * (pointMouse.m_nX - pointNode.m_nX) + + (pointMouse.m_nY - pointNode.m_nY) * (pointMouse.m_nY - pointNode.m_nY); + var bContains = false; + + nRadius *= nRadius; + if (nDistancePoints < nRadius) + bContains = true; + + return bContains; + } + + doesLineContain(pointStart, pointEnd, pointMouse, nLineWidth) + { + var pointTemp = new CPoint(0, 0); + var bContains = false; + var nTolerance = nLineWidth * 2; + + // Normalize start/end to left right to make the nOffset calc simpler. + if (pointStart.m_nX > pointEnd.m_nX) + { + pointTemp = pointStart; + pointStart = pointEnd; + pointEnd = pointTemp; + } + + // If pointMouse is out of bounds, no need to do further checks. + if (pointMouse.m_nX + nLineWidth < pointStart.m_nX || pointEnd.m_nX < pointMouse.m_nX - nLineWidth) + bContains = false; + else if (pointMouse.m_nY + nLineWidth < Math.min(pointStart.m_nY, pointEnd.m_nY) || Math.max(pointStart.m_nY, pointEnd.m_nY) < pointMouse.m_nY - nLineWidth) + bContains = false; + else + { + var nDeltaX = pointEnd.m_nX - pointStart.m_nX; + var nDeltaY = pointEnd.m_nY - pointStart.m_nY; + + // If the line is straight, the earlier boundary check is enough to determine that the pointMouse is on the line. + // Also prevents division by zero exceptions. + if ((nDeltaX == 0) || (nDeltaY == 0)) + bContains = true; + else + { + var nSlope = nDeltaY / nDeltaX; + var nOffset = pointStart.m_nY - pointStart.m_nX * nSlope; + var nCalculatedY = pointMouse.m_nX * nSlope + nOffset; + + // Check calculated Y matches the points Y coord with some easing. + bContains = ((pointMouse.m_nY - nTolerance) <= nCalculatedY) && (nCalculatedY <= (pointMouse.m_nY + nTolerance)); + } + } + return bContains; + } + + isMouseInNode(pointMousePos) + { + for (var nI = 0; nI < this.m_arrayPoints.length; nI++) + { + if (this.doesNodeContain(pointMousePos, this.m_arrayPoints[nI], CWire.m_nNodeRadius)) + break; + } + if (nI >= this.m_arrayPoints.length) + nI = -1; + + return nI; + } + + isMouseIn(pointMousePos) + { + var bResult = false; + + if (this.m_arrayPoints.length == 2) + { + bResult = this.doesLineContain(this.m_arrayPoints[0], this.m_arrayPoints[1], pointMousePos, this.m_nWidth); + } + else + { + for (let nI = 1; nI < this.m_arrayPoints.length; nI++) + { + bResult = this.doesLineContain(this.m_arrayPoints[nI - 1], this.m_arrayPoints[nI], pointMousePos, this.m_nWidth); + if (bResult) + break; + } + } + return bResult; + } + + isMouseInPin(pointMousePos) + { + return false; + } + + isEmpty() + { + return this.m_arrayPoints.length < 2; + } + + isSelected() + { + return this.m_bSelected; + } + + doSelect() + { + this.m_bSelected = true; + doDisplayInfo("Click the right mouse button on the wire to add or remove nodes & hold the left mouse button on a node or the wire to drag them..."); + doShowEditFields(this.m_strHTML); + } + + doUnselect() + { + this.m_bSelected = false; + } + + doConnectedMove(pointMousePos, strConnectedDeviceName, strPinID) + { + for (let nI = 0; nI < this.m_arrayConnectedDevices.length; nI++) + { + if (this.m_arrayConnectedDevices[nI].getDeviceName() == strConnectedDeviceName) + { + this.m_arrayPoints[this.m_arrayConnectedDevices[nI].getNodeIndex()] = new CPoint(pointMousePos.m_nX, pointMousePos.m_nY); + } + } + } + + findConnectedDevice(strDeviceName) + { + var nIndex = -1; + + for (let nI = 0; nI < this.m_arrayConnectedDevices.length; nI++) + { + if (this.m_arrayConnectedDevices[nI].getDeviceName() == strDeviceName) + { + nIndex = nI; + break; + } + } + return nIndex; + } + + doDrop(pointMousePos) + { + if (this.m_arrayPoints.length < 1) + this.m_pointTemp = new CPoint(pointMousePos.m_nX - (pointMousePos.m_nX % 10), pointMousePos.m_nY - (pointMousePos.m_nY % 10)); + else if (this.m_nIndexGrabbedPoint > -1) + this.m_arrayPoints[this.m_nIndexGrabbedPoint] = new CPoint(pointMousePos.m_nX - (pointMousePos.m_nX % 10), pointMousePos.m_nY - (pointMousePos.m_nY % 10)); + + if (!this.m_TempConnectedDevice.isEmpty()) + { + var nI = this.findConnectedDevice(this.m_TempConnectedDevice.getDeviceName()); + if (nI == -1) + this.m_arrayConnectedDevices[this.m_arrayConnectedDevices.length] = + new CConnectedDevice(this.m_TempConnectedDevice.getDeviceName(), this.m_TempConnectedDevice.getPinID(), this.m_TempConnectedDevice.getType(), this.m_TempConnectedDevice.getNodeIndex()); + else + this.m_arrayConnectedDevices[nI] = + new CConnectedDevice(this.m_TempConnectedDevice.getDeviceName(), this.m_TempConnectedDevice.getPinID(), this.m_TempConnectedDevice.getType(), this.m_TempConnectedDevice.getNodeIndex()); + + let point = g_mapPlacedComponents.get(this.m_TempConnectedDevice.m_strDeviceName).getPinPos(this.m_TempConnectedDevice.m_strPinID); + g_mapPlacedComponents.get(this.m_TempConnectedDevice.m_strDeviceName).setWire(this.m_TempConnectedDevice.m_strPinID, this.m_strDeviceName); + if ((this.m_nIndexGrabbedPoint >= 0) && (this.m_nIndexGrabbedPoint < this.m_arrayPoints.length)) + this.m_arrayPoints[this.m_TempConnectedDevice.getNodeIndex()] = new CPoint(point.m_nX, point.m_nY); + + } + this.m_nIndexGrabbedPoint = -1; + } + + doGrab(pointMousePos) + { + this.doSelect(); + this.m_nIndexGrabbedPoint = this.isMouseInNode(pointMousePos); + + if (!this.isConnected() || (this.m_nIndexGrabbedPoint > -1)) + g_Canvas.style.cursor = "grabbing"; + else + g_Canvas.style.cursor = "pointer"; + } + + doMove(pointMousePos) + { + if ((this.m_nIndexGrabbedPoint != -1) || (this.m_arrayPoints.length == 0)) + { + if (this.m_arrayPoints.length < 1) + this.m_pointTemp = new CPoint(pointMousePos.m_nX, pointMousePos.m_nY); + else if (this.m_nIndexGrabbedPoint > -1) + this.m_arrayPoints[this.m_nIndexGrabbedPoint] = new CPoint(pointMousePos.m_nX, pointMousePos.m_nY); + + var strDeviceName = doFindSelectedComponent(pointMousePos), strPinID = ""; + var Component = g_mapPlacedComponents.get(strDeviceName); + var nPinNum = 0; + + this.m_bHighlight = false; + this.m_TempConnectedDevice.setDeviceName(""); + this.m_TempConnectedDevice.setPinID(""); + this.m_TempConnectedDevice.setType(""); + this.m_TempConnectedDevice.setNodeIndex(-1); + if (Component != null) + { + nPinNum = g_mapPlacedComponents.get(strDeviceName).isMouseInPin(pointMousePos); + if (nPinNum > -1) + { + if (g_mapPlacedComponents.get(strDeviceName).getType() != "WIRE") + { + if (this.isFirstOrLastPoint(this.m_nIndexGrabbedPoint)) + { + strPinID = g_mapPlacedComponents.get(strDeviceName).getPinID(nPinNum); + this.m_bHighlight = true; + this.m_TempConnectedDevice.setDeviceName(strDeviceName); + this.m_TempConnectedDevice.setPinID(strPinID); + this.m_TempConnectedDevice.setType(g_mapPlacedComponents.get(strDeviceName).getType()); + this.m_TempConnectedDevice.setNodeIndex(this.m_nIndexGrabbedPoint); + } + } + } + } + } + else if (!this.isConnected()) + { + if (!this.m_pointLastMousePos.isEmpty()) + { + let nDeltaX = pointMousePos.m_nX - this.m_pointLastMousePos.m_nX, + nDeltaY = pointMousePos.m_nY - this.m_pointLastMousePos.m_nY, + pointCurrent = null; + + for (let nI = 0; nI < this.m_arrayPoints.length; nI++) + { + pointCurrent = this.m_arrayPoints[nI]; + pointCurrent.m_nX += nDeltaX; + pointCurrent.m_nY += nDeltaY; + this.m_arrayPoints[nI] = pointCurrent; + } + } + this.m_pointLastMousePos = pointMousePos; + } + this.doDisplay(); + } + + doMouseOver(pointMousePos) + { + var OldCursor = g_Canvas.style.cursor; + + if (this.isMouseInNode(pointMousePos) > -1) + g_Canvas.style.cursor = "grab"; + else if (this.isMouseIn(pointMousePos)) + { + if (!this.isConnected()) + g_Canvas.style.cursor = "grab"; + else + g_Canvas.style.cursor = "pointer"; + } + else + g_Canvas.style.cursor = "default"; + + return g_Canvas.style.cursor != OldCursor; + } + + doDefaultZoom() + { + this.m_nZoom = 0; + } + + doZoomIn() + { + if (this.m_nZoom < 10) + { + this.m_nZoom++; + } + } + + doZoomOut() + { + if (this.m_nZoom > -10) + { + this.m_nZoom--; + } + } + + getZoomedValue(nValue) + { + var nValueNew = nValue; + var nFudge = 0.2; + + nValueNew += nFudge * this.m_nZoom; + + return nValueNew; + } + + doRotate(nAngleAdd) + { + } + + doDelete() + { + var strName = ""; + + for (let nI = 0; nI < this.m_arrayConnectedDevices.length; nI++) + { + strName = this.m_arrayConnectedDevices[nI].getDeviceName(); + g_mapPlacedComponents.get(strName).doDeleteWire(this.m_strDeviceName); + } + } + + doDisplayNode(pointMouse, strColor, bHighlight) + { + if (bHighlight) + { + g_CanvasContext.arc(pointMouse.m_nX, pointMouse.m_nY, this.getZoomedValue(CWire.m_nNodeRadius) * 2, 0, 2 * Math.PI); + doDisplayHint("PIN ID", this.m_TempConnectedDevice.getPinID()); + } + else + g_CanvasContext.arc(pointMouse.m_nX, pointMouse.m_nY, this.getZoomedValue(CWire.m_nNodeRadius), 0, 2 * Math.PI); + } + + isFirstOrLastPoint(nIndex) + { + return (nIndex == 0) || (nIndex == (this.m_arrayPoints.length - 1)); + } + + doDisplay() + { + var nX = 0, nY = 0; + + g_CanvasContext.strokeStyle = this.m_strColor; + g_CanvasContext.lineWidth = this.getZoomedValue(this.m_nWidth); + g_CanvasContext.fillStyle = this.m_strColor; + + if (this.m_arrayPoints.length < 1) + { + g_CanvasContext.beginPath(); + this.doDisplayNode(this.m_pointTemp, this.m_strColor, this.m_bHighlight); + g_CanvasContext.stroke(); + g_CanvasContext.fill(); + } + else + { + g_CanvasContext.beginPath(); + g_CanvasContext.moveTo(this.m_arrayPoints[0].m_nX, this.m_arrayPoints[0].m_nY); + for (let nI = 1; nI < this.m_arrayPoints.length; nI++) + { + nX = this.m_arrayPoints[nI].m_nX; + nY = this.m_arrayPoints[nI].m_nY; + g_CanvasContext.lineTo(nX, nY); + } + g_CanvasContext.stroke(); + + if (this.m_bSelected) + { + for (let nI = 0; nI < this.m_arrayPoints.length; nI++) + { + g_CanvasContext.beginPath(); + this.doDisplayNode(this.m_arrayPoints[nI], this.m_strColor, + this.m_bHighlight && (nI == this.m_nIndexGrabbedPoint) && this.isFirstOrLastPoint(this.m_nIndexGrabbedPoint)); + g_CanvasContext.stroke(); + g_CanvasContext.fill(); + } + } + } + } + +} diff --git a/ardublockly/img/Components/LEDs/LED_BLOWN.png b/ardublockly/img/Components/LEDs/LED_BLOWN.png new file mode 100644 index 0000000000..29f6b223b1 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_BLOWN.png differ diff --git a/ardublockly/img/Components/LEDs/LED_BLOWN180.png b/ardublockly/img/Components/LEDs/LED_BLOWN180.png new file mode 100644 index 0000000000..0d1bdd84ff Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_BLOWN180.png differ diff --git a/ardublockly/img/Components/LEDs/LED_BLOWN270.png b/ardublockly/img/Components/LEDs/LED_BLOWN270.png new file mode 100644 index 0000000000..efc403a40e Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_BLOWN270.png differ diff --git a/ardublockly/img/Components/LEDs/LED_BLOWN90.png b/ardublockly/img/Components/LEDs/LED_BLOWN90.png new file mode 100644 index 0000000000..96adda066d Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_BLOWN90.png differ diff --git a/ardublockly/img/Components/LEDs/LED_OFF.png b/ardublockly/img/Components/LEDs/LED_OFF.png new file mode 100644 index 0000000000..59b20e3372 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_OFF.png differ diff --git a/ardublockly/img/Components/LEDs/LED_OFF180.png b/ardublockly/img/Components/LEDs/LED_OFF180.png new file mode 100644 index 0000000000..acf674ec8a Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_OFF180.png differ diff --git a/ardublockly/img/Components/LEDs/LED_OFF270.png b/ardublockly/img/Components/LEDs/LED_OFF270.png new file mode 100644 index 0000000000..75b647fb8e Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_OFF270.png differ diff --git a/ardublockly/img/Components/LEDs/LED_OFF90.png b/ardublockly/img/Components/LEDs/LED_OFF90.png new file mode 100644 index 0000000000..3b514412a4 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_OFF90.png differ diff --git a/ardublockly/img/Components/LEDs/LED_ON.png b/ardublockly/img/Components/LEDs/LED_ON.png new file mode 100644 index 0000000000..d3b5117a9a Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_ON.png differ diff --git a/ardublockly/img/Components/LEDs/LED_ON180.png b/ardublockly/img/Components/LEDs/LED_ON180.png new file mode 100644 index 0000000000..9c248465d4 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_ON180.png differ diff --git a/ardublockly/img/Components/LEDs/LED_ON270.png b/ardublockly/img/Components/LEDs/LED_ON270.png new file mode 100644 index 0000000000..179444c687 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_ON270.png differ diff --git a/ardublockly/img/Components/LEDs/LED_ON90.png b/ardublockly/img/Components/LEDs/LED_ON90.png new file mode 100644 index 0000000000..07e945ee57 Binary files /dev/null and b/ardublockly/img/Components/LEDs/LED_ON90.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoMega.png b/ardublockly/img/Components/MCUs/ArduinoMega.png new file mode 100644 index 0000000000..6f872c0601 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoMega.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoMega180.png b/ardublockly/img/Components/MCUs/ArduinoMega180.png new file mode 100644 index 0000000000..f901c0b877 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoMega180.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoMega270.png b/ardublockly/img/Components/MCUs/ArduinoMega270.png new file mode 100644 index 0000000000..b22661d901 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoMega270.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoMega90.png b/ardublockly/img/Components/MCUs/ArduinoMega90.png new file mode 100644 index 0000000000..614137df14 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoMega90.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoUno.png b/ardublockly/img/Components/MCUs/ArduinoUno.png new file mode 100644 index 0000000000..7d3f0b253a Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoUno.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoUno180.png b/ardublockly/img/Components/MCUs/ArduinoUno180.png new file mode 100644 index 0000000000..3a45a7b301 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoUno180.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoUno270.png b/ardublockly/img/Components/MCUs/ArduinoUno270.png new file mode 100644 index 0000000000..cacd2a1e57 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoUno270.png differ diff --git a/ardublockly/img/Components/MCUs/ArduinoUno90.png b/ardublockly/img/Components/MCUs/ArduinoUno90.png new file mode 100644 index 0000000000..9028e62d41 Binary files /dev/null and b/ardublockly/img/Components/MCUs/ArduinoUno90.png differ diff --git a/ardublockly/img/Components/MCUs/Microbit.png b/ardublockly/img/Components/MCUs/Microbit.png new file mode 100644 index 0000000000..23ec8d1639 Binary files /dev/null and b/ardublockly/img/Components/MCUs/Microbit.png differ diff --git a/ardublockly/img/Components/MCUs/Microbit180.png b/ardublockly/img/Components/MCUs/Microbit180.png new file mode 100644 index 0000000000..f3ecd23a11 Binary files /dev/null and b/ardublockly/img/Components/MCUs/Microbit180.png differ diff --git a/ardublockly/img/Components/MCUs/Microbit270.png b/ardublockly/img/Components/MCUs/Microbit270.png new file mode 100644 index 0000000000..2301dba775 Binary files /dev/null and b/ardublockly/img/Components/MCUs/Microbit270.png differ diff --git a/ardublockly/img/Components/MCUs/Microbit90.png b/ardublockly/img/Components/MCUs/Microbit90.png new file mode 100644 index 0000000000..25536d09ff Binary files /dev/null and b/ardublockly/img/Components/MCUs/Microbit90.png differ diff --git a/ardublockly/img/Components/MCUs/MicrobitBreakout.png b/ardublockly/img/Components/MCUs/MicrobitBreakout.png new file mode 100644 index 0000000000..e59678429e Binary files /dev/null and b/ardublockly/img/Components/MCUs/MicrobitBreakout.png differ diff --git a/ardublockly/img/Components/MCUs/MicrobitBreakout180.png b/ardublockly/img/Components/MCUs/MicrobitBreakout180.png new file mode 100644 index 0000000000..ceb341424c Binary files /dev/null and b/ardublockly/img/Components/MCUs/MicrobitBreakout180.png differ diff --git a/ardublockly/img/Components/MCUs/MicrobitBreakout270.png b/ardublockly/img/Components/MCUs/MicrobitBreakout270.png new file mode 100644 index 0000000000..a955404662 Binary files /dev/null and b/ardublockly/img/Components/MCUs/MicrobitBreakout270.png differ diff --git a/ardublockly/img/Components/MCUs/MicrobitBreakout90.png b/ardublockly/img/Components/MCUs/MicrobitBreakout90.png new file mode 100644 index 0000000000..136ec8bbf8 Binary files /dev/null and b/ardublockly/img/Components/MCUs/MicrobitBreakout90.png differ diff --git a/ardublockly/img/Components/Resistors/LDR.png b/ardublockly/img/Components/Resistors/LDR.png new file mode 100644 index 0000000000..82c8c766d1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/LDR.png differ diff --git a/ardublockly/img/Components/Resistors/LDR180.png b/ardublockly/img/Components/Resistors/LDR180.png new file mode 100644 index 0000000000..b9436c7113 Binary files /dev/null and b/ardublockly/img/Components/Resistors/LDR180.png differ diff --git a/ardublockly/img/Components/Resistors/LDR270.png b/ardublockly/img/Components/Resistors/LDR270.png new file mode 100644 index 0000000000..2bf06f1b11 Binary files /dev/null and b/ardublockly/img/Components/Resistors/LDR270.png differ diff --git a/ardublockly/img/Components/Resistors/LDR90.png b/ardublockly/img/Components/Resistors/LDR90.png new file mode 100644 index 0000000000..c8d3f11ad1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/LDR90.png differ diff --git a/ardublockly/img/Components/Resistors/Potentiometer.png b/ardublockly/img/Components/Resistors/Potentiometer.png new file mode 100644 index 0000000000..44ed56264b Binary files /dev/null and b/ardublockly/img/Components/Resistors/Potentiometer.png differ diff --git a/ardublockly/img/Components/Resistors/Potentiometer180.png b/ardublockly/img/Components/Resistors/Potentiometer180.png new file mode 100644 index 0000000000..ab66f4f591 Binary files /dev/null and b/ardublockly/img/Components/Resistors/Potentiometer180.png differ diff --git a/ardublockly/img/Components/Resistors/Potentiometer270.png b/ardublockly/img/Components/Resistors/Potentiometer270.png new file mode 100644 index 0000000000..dee7cbdc1a Binary files /dev/null and b/ardublockly/img/Components/Resistors/Potentiometer270.png differ diff --git a/ardublockly/img/Components/Resistors/Potentiometer90.png b/ardublockly/img/Components/Resistors/Potentiometer90.png new file mode 100644 index 0000000000..fa91d0c95a Binary files /dev/null and b/ardublockly/img/Components/Resistors/Potentiometer90.png differ diff --git a/ardublockly/img/Components/Resistors/R10.png b/ardublockly/img/Components/Resistors/R10.png new file mode 100644 index 0000000000..2dc3d6e407 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10.png differ diff --git a/ardublockly/img/Components/Resistors/R100.png b/ardublockly/img/Components/Resistors/R100.png new file mode 100644 index 0000000000..68afd33512 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100.png differ diff --git a/ardublockly/img/Components/Resistors/R100_180.png b/ardublockly/img/Components/Resistors/R100_180.png new file mode 100644 index 0000000000..5e3b5073ce Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100_180.png differ diff --git a/ardublockly/img/Components/Resistors/R100_270.png b/ardublockly/img/Components/Resistors/R100_270.png new file mode 100644 index 0000000000..b19f400066 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100_270.png differ diff --git a/ardublockly/img/Components/Resistors/R100_90.png b/ardublockly/img/Components/Resistors/R100_90.png new file mode 100644 index 0000000000..7f3adf3e7a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100_90.png differ diff --git a/ardublockly/img/Components/Resistors/R100k.png b/ardublockly/img/Components/Resistors/R100k.png new file mode 100644 index 0000000000..cc912fae3a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100k.png differ diff --git a/ardublockly/img/Components/Resistors/R100k_180.png b/ardublockly/img/Components/Resistors/R100k_180.png new file mode 100644 index 0000000000..c3992736c8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R100k_270.png b/ardublockly/img/Components/Resistors/R100k_270.png new file mode 100644 index 0000000000..6f0668feb1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R100k_90.png b/ardublockly/img/Components/Resistors/R100k_90.png new file mode 100644 index 0000000000..9f8eebcc9c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R100k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R10M.png b/ardublockly/img/Components/Resistors/R10M.png new file mode 100644 index 0000000000..8156d60e9a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10M.png differ diff --git a/ardublockly/img/Components/Resistors/R10M_180.png b/ardublockly/img/Components/Resistors/R10M_180.png new file mode 100644 index 0000000000..0e17e5e8d6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R10M_270.png b/ardublockly/img/Components/Resistors/R10M_270.png new file mode 100644 index 0000000000..661e5ae0fd Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R10M_90.png b/ardublockly/img/Components/Resistors/R10M_90.png new file mode 100644 index 0000000000..b98ccea9d3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R10_180.png b/ardublockly/img/Components/Resistors/R10_180.png new file mode 100644 index 0000000000..3ca40d126a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10_180.png differ diff --git a/ardublockly/img/Components/Resistors/R10_270.png b/ardublockly/img/Components/Resistors/R10_270.png new file mode 100644 index 0000000000..de23343b98 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10_270.png differ diff --git a/ardublockly/img/Components/Resistors/R10_90.png b/ardublockly/img/Components/Resistors/R10_90.png new file mode 100644 index 0000000000..bebf6f74da Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10_90.png differ diff --git a/ardublockly/img/Components/Resistors/R10k.png b/ardublockly/img/Components/Resistors/R10k.png new file mode 100644 index 0000000000..1f7594ea18 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10k.png differ diff --git a/ardublockly/img/Components/Resistors/R10k_180.png b/ardublockly/img/Components/Resistors/R10k_180.png new file mode 100644 index 0000000000..24093682c5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R10k_270.png b/ardublockly/img/Components/Resistors/R10k_270.png new file mode 100644 index 0000000000..3ceac0c407 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R10k_90.png b/ardublockly/img/Components/Resistors/R10k_90.png new file mode 100644 index 0000000000..31cec87f60 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R10k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R12.png b/ardublockly/img/Components/Resistors/R12.png new file mode 100644 index 0000000000..95827799be Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12.png differ diff --git a/ardublockly/img/Components/Resistors/R120.png b/ardublockly/img/Components/Resistors/R120.png new file mode 100644 index 0000000000..a93013df1a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120.png differ diff --git a/ardublockly/img/Components/Resistors/R120_180.png b/ardublockly/img/Components/Resistors/R120_180.png new file mode 100644 index 0000000000..1bc15029f1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120_180.png differ diff --git a/ardublockly/img/Components/Resistors/R120_270.png b/ardublockly/img/Components/Resistors/R120_270.png new file mode 100644 index 0000000000..cdde102513 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120_270.png differ diff --git a/ardublockly/img/Components/Resistors/R120_90.png b/ardublockly/img/Components/Resistors/R120_90.png new file mode 100644 index 0000000000..3144be917f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120_90.png differ diff --git a/ardublockly/img/Components/Resistors/R120k.png b/ardublockly/img/Components/Resistors/R120k.png new file mode 100644 index 0000000000..2779dc8191 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120k.png differ diff --git a/ardublockly/img/Components/Resistors/R120k_180.png b/ardublockly/img/Components/Resistors/R120k_180.png new file mode 100644 index 0000000000..139a190bb4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R120k_270.png b/ardublockly/img/Components/Resistors/R120k_270.png new file mode 100644 index 0000000000..dbdf10085d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R120k_90.png b/ardublockly/img/Components/Resistors/R120k_90.png new file mode 100644 index 0000000000..cf1861ac49 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R120k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R12_180.png b/ardublockly/img/Components/Resistors/R12_180.png new file mode 100644 index 0000000000..9b143b428c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12_180.png differ diff --git a/ardublockly/img/Components/Resistors/R12_270.png b/ardublockly/img/Components/Resistors/R12_270.png new file mode 100644 index 0000000000..d169073941 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12_270.png differ diff --git a/ardublockly/img/Components/Resistors/R12_90.png b/ardublockly/img/Components/Resistors/R12_90.png new file mode 100644 index 0000000000..0a64c81678 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12_90.png differ diff --git a/ardublockly/img/Components/Resistors/R12k.png b/ardublockly/img/Components/Resistors/R12k.png new file mode 100644 index 0000000000..65864e0867 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12k.png differ diff --git a/ardublockly/img/Components/Resistors/R12k_180.png b/ardublockly/img/Components/Resistors/R12k_180.png new file mode 100644 index 0000000000..97a42cc10e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R12k_270.png b/ardublockly/img/Components/Resistors/R12k_270.png new file mode 100644 index 0000000000..b3c15c819f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R12k_90.png b/ardublockly/img/Components/Resistors/R12k_90.png new file mode 100644 index 0000000000..e713035092 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R12k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R15.png b/ardublockly/img/Components/Resistors/R15.png new file mode 100644 index 0000000000..cd22f4530f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15.png differ diff --git a/ardublockly/img/Components/Resistors/R150.png b/ardublockly/img/Components/Resistors/R150.png new file mode 100644 index 0000000000..d0d64cb60b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150.png differ diff --git a/ardublockly/img/Components/Resistors/R150_180.png b/ardublockly/img/Components/Resistors/R150_180.png new file mode 100644 index 0000000000..82be28b986 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150_180.png differ diff --git a/ardublockly/img/Components/Resistors/R150_270.png b/ardublockly/img/Components/Resistors/R150_270.png new file mode 100644 index 0000000000..d834e11cad Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150_270.png differ diff --git a/ardublockly/img/Components/Resistors/R150_90.png b/ardublockly/img/Components/Resistors/R150_90.png new file mode 100644 index 0000000000..01e391537d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150_90.png differ diff --git a/ardublockly/img/Components/Resistors/R150k.png b/ardublockly/img/Components/Resistors/R150k.png new file mode 100644 index 0000000000..9ec72c1cb6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150k.png differ diff --git a/ardublockly/img/Components/Resistors/R150k_180.png b/ardublockly/img/Components/Resistors/R150k_180.png new file mode 100644 index 0000000000..67584f2c91 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R150k_270.png b/ardublockly/img/Components/Resistors/R150k_270.png new file mode 100644 index 0000000000..70b1b68a8e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R150k_90.png b/ardublockly/img/Components/Resistors/R150k_90.png new file mode 100644 index 0000000000..6e43a5474b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R150k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R15_180.png b/ardublockly/img/Components/Resistors/R15_180.png new file mode 100644 index 0000000000..6414d7b55d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15_180.png differ diff --git a/ardublockly/img/Components/Resistors/R15_270.png b/ardublockly/img/Components/Resistors/R15_270.png new file mode 100644 index 0000000000..6f20983b5e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15_270.png differ diff --git a/ardublockly/img/Components/Resistors/R15_90.png b/ardublockly/img/Components/Resistors/R15_90.png new file mode 100644 index 0000000000..cd5b8c024e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15_90.png differ diff --git a/ardublockly/img/Components/Resistors/R15k.png b/ardublockly/img/Components/Resistors/R15k.png new file mode 100644 index 0000000000..8b2b10a117 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15k.png differ diff --git a/ardublockly/img/Components/Resistors/R15k_180.png b/ardublockly/img/Components/Resistors/R15k_180.png new file mode 100644 index 0000000000..8130bca446 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R15k_270.png b/ardublockly/img/Components/Resistors/R15k_270.png new file mode 100644 index 0000000000..561d9f9c61 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R15k_90.png b/ardublockly/img/Components/Resistors/R15k_90.png new file mode 100644 index 0000000000..4a4b7a2a5f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R15k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R18.png b/ardublockly/img/Components/Resistors/R18.png new file mode 100644 index 0000000000..65ad5d80bb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18.png differ diff --git a/ardublockly/img/Components/Resistors/R180.png b/ardublockly/img/Components/Resistors/R180.png new file mode 100644 index 0000000000..90629859ed Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180.png differ diff --git a/ardublockly/img/Components/Resistors/R180_180.png b/ardublockly/img/Components/Resistors/R180_180.png new file mode 100644 index 0000000000..c3111f5cc6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180_180.png differ diff --git a/ardublockly/img/Components/Resistors/R180_270.png b/ardublockly/img/Components/Resistors/R180_270.png new file mode 100644 index 0000000000..3761837b1e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180_270.png differ diff --git a/ardublockly/img/Components/Resistors/R180_90.png b/ardublockly/img/Components/Resistors/R180_90.png new file mode 100644 index 0000000000..1e5cdb2c56 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180_90.png differ diff --git a/ardublockly/img/Components/Resistors/R180k.png b/ardublockly/img/Components/Resistors/R180k.png new file mode 100644 index 0000000000..16fa5d08f1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180k.png differ diff --git a/ardublockly/img/Components/Resistors/R180k_180.png b/ardublockly/img/Components/Resistors/R180k_180.png new file mode 100644 index 0000000000..b785963912 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R180k_270.png b/ardublockly/img/Components/Resistors/R180k_270.png new file mode 100644 index 0000000000..3c77c9edc9 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R180k_90.png b/ardublockly/img/Components/Resistors/R180k_90.png new file mode 100644 index 0000000000..76a9ddef9f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R180k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R18_180.png b/ardublockly/img/Components/Resistors/R18_180.png new file mode 100644 index 0000000000..b465792919 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18_180.png differ diff --git a/ardublockly/img/Components/Resistors/R18_270.png b/ardublockly/img/Components/Resistors/R18_270.png new file mode 100644 index 0000000000..deb3933010 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18_270.png differ diff --git a/ardublockly/img/Components/Resistors/R18_90.png b/ardublockly/img/Components/Resistors/R18_90.png new file mode 100644 index 0000000000..80b6cb1101 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18_90.png differ diff --git a/ardublockly/img/Components/Resistors/R18k.png b/ardublockly/img/Components/Resistors/R18k.png new file mode 100644 index 0000000000..578d8a7083 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18k.png differ diff --git a/ardublockly/img/Components/Resistors/R18k_180.png b/ardublockly/img/Components/Resistors/R18k_180.png new file mode 100644 index 0000000000..e4713edae6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R18k_270.png b/ardublockly/img/Components/Resistors/R18k_270.png new file mode 100644 index 0000000000..929c7cb19a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R18k_90.png b/ardublockly/img/Components/Resistors/R18k_90.png new file mode 100644 index 0000000000..ca38ef6b75 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R18k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1M.png b/ardublockly/img/Components/Resistors/R1M.png new file mode 100644 index 0000000000..6a377f0bc3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1M.png differ diff --git a/ardublockly/img/Components/Resistors/R1M_180.png b/ardublockly/img/Components/Resistors/R1M_180.png new file mode 100644 index 0000000000..1bf6e7971e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1M_270.png b/ardublockly/img/Components/Resistors/R1M_270.png new file mode 100644 index 0000000000..0f139be728 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1M_90.png b/ardublockly/img/Components/Resistors/R1M_90.png new file mode 100644 index 0000000000..d73613fccb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_0.png b/ardublockly/img/Components/Resistors/R1_0.png new file mode 100644 index 0000000000..49f96c4f73 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_0.png differ diff --git a/ardublockly/img/Components/Resistors/R1_0_180.png b/ardublockly/img/Components/Resistors/R1_0_180.png new file mode 100644 index 0000000000..96736be8c6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_0_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_0_270.png b/ardublockly/img/Components/Resistors/R1_0_270.png new file mode 100644 index 0000000000..6f8e60fd37 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_0_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_0_90.png b/ardublockly/img/Components/Resistors/R1_0_90.png new file mode 100644 index 0000000000..ee59ed1077 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_0_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2.png b/ardublockly/img/Components/Resistors/R1_2.png new file mode 100644 index 0000000000..f81282389e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2M.png b/ardublockly/img/Components/Resistors/R1_2M.png new file mode 100644 index 0000000000..bfc88d1147 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2M.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2M_180.png b/ardublockly/img/Components/Resistors/R1_2M_180.png new file mode 100644 index 0000000000..d80c6c1431 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2M_270.png b/ardublockly/img/Components/Resistors/R1_2M_270.png new file mode 100644 index 0000000000..251548c3a9 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2M_90.png b/ardublockly/img/Components/Resistors/R1_2M_90.png new file mode 100644 index 0000000000..d5eabe7249 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2_180.png b/ardublockly/img/Components/Resistors/R1_2_180.png new file mode 100644 index 0000000000..d2fe0713e4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2_270.png b/ardublockly/img/Components/Resistors/R1_2_270.png new file mode 100644 index 0000000000..3f13e87e43 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2_90.png b/ardublockly/img/Components/Resistors/R1_2_90.png new file mode 100644 index 0000000000..62e438004c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2k.png b/ardublockly/img/Components/Resistors/R1_2k.png new file mode 100644 index 0000000000..e9f9fe5ad5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2k.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2k_180.png b/ardublockly/img/Components/Resistors/R1_2k_180.png new file mode 100644 index 0000000000..dba7875c99 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2k_270.png b/ardublockly/img/Components/Resistors/R1_2k_270.png new file mode 100644 index 0000000000..c4fdeec4d3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_2k_90.png b/ardublockly/img/Components/Resistors/R1_2k_90.png new file mode 100644 index 0000000000..a48e60039e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_2k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5.png b/ardublockly/img/Components/Resistors/R1_5.png new file mode 100644 index 0000000000..d6b0a862de Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5M.png b/ardublockly/img/Components/Resistors/R1_5M.png new file mode 100644 index 0000000000..ba8b680f41 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5M.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5M_180.png b/ardublockly/img/Components/Resistors/R1_5M_180.png new file mode 100644 index 0000000000..2fdbd4a45e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5M_270.png b/ardublockly/img/Components/Resistors/R1_5M_270.png new file mode 100644 index 0000000000..fa3e0bf2a6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5M_90.png b/ardublockly/img/Components/Resistors/R1_5M_90.png new file mode 100644 index 0000000000..d928c6320f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5_180.png b/ardublockly/img/Components/Resistors/R1_5_180.png new file mode 100644 index 0000000000..d0eb9da69d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5_270.png b/ardublockly/img/Components/Resistors/R1_5_270.png new file mode 100644 index 0000000000..62ca8143c4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5_90.png b/ardublockly/img/Components/Resistors/R1_5_90.png new file mode 100644 index 0000000000..bcc49300eb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5k.png b/ardublockly/img/Components/Resistors/R1_5k.png new file mode 100644 index 0000000000..0ec12c4560 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5k.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5k_180.png b/ardublockly/img/Components/Resistors/R1_5k_180.png new file mode 100644 index 0000000000..cdd537bd34 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5k_270.png b/ardublockly/img/Components/Resistors/R1_5k_270.png new file mode 100644 index 0000000000..426ed8d891 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_5k_90.png b/ardublockly/img/Components/Resistors/R1_5k_90.png new file mode 100644 index 0000000000..61dd20914c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_5k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8.png b/ardublockly/img/Components/Resistors/R1_8.png new file mode 100644 index 0000000000..65b797c1f1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8M.png b/ardublockly/img/Components/Resistors/R1_8M.png new file mode 100644 index 0000000000..1e58114a1e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8M.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8M_180.png b/ardublockly/img/Components/Resistors/R1_8M_180.png new file mode 100644 index 0000000000..6ea21d00d0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8M_270.png b/ardublockly/img/Components/Resistors/R1_8M_270.png new file mode 100644 index 0000000000..0090eed1cb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8M_90.png b/ardublockly/img/Components/Resistors/R1_8M_90.png new file mode 100644 index 0000000000..83c4b61e84 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8_180.png b/ardublockly/img/Components/Resistors/R1_8_180.png new file mode 100644 index 0000000000..4414a27f84 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8_270.png b/ardublockly/img/Components/Resistors/R1_8_270.png new file mode 100644 index 0000000000..5f0b502206 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8_90.png b/ardublockly/img/Components/Resistors/R1_8_90.png new file mode 100644 index 0000000000..8086de2a27 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8k.png b/ardublockly/img/Components/Resistors/R1_8k.png new file mode 100644 index 0000000000..2e48fc0dd1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8k.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8k_180.png b/ardublockly/img/Components/Resistors/R1_8k_180.png new file mode 100644 index 0000000000..0b16899413 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8k_270.png b/ardublockly/img/Components/Resistors/R1_8k_270.png new file mode 100644 index 0000000000..4d9f833184 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1_8k_90.png b/ardublockly/img/Components/Resistors/R1_8k_90.png new file mode 100644 index 0000000000..20d9073915 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1_8k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R1k.png b/ardublockly/img/Components/Resistors/R1k.png new file mode 100644 index 0000000000..10c512b8cb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1k.png differ diff --git a/ardublockly/img/Components/Resistors/R1k_180.png b/ardublockly/img/Components/Resistors/R1k_180.png new file mode 100644 index 0000000000..ef2c849448 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R1k_270.png b/ardublockly/img/Components/Resistors/R1k_270.png new file mode 100644 index 0000000000..9ea374d897 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R1k_90.png b/ardublockly/img/Components/Resistors/R1k_90.png new file mode 100644 index 0000000000..92941717e5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R1k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R22.png b/ardublockly/img/Components/Resistors/R22.png new file mode 100644 index 0000000000..7bdc4a6cb8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22.png differ diff --git a/ardublockly/img/Components/Resistors/R220.png b/ardublockly/img/Components/Resistors/R220.png new file mode 100644 index 0000000000..ab9f7877af Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220.png differ diff --git a/ardublockly/img/Components/Resistors/R220_180.png b/ardublockly/img/Components/Resistors/R220_180.png new file mode 100644 index 0000000000..ba67f1f186 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220_180.png differ diff --git a/ardublockly/img/Components/Resistors/R220_270.png b/ardublockly/img/Components/Resistors/R220_270.png new file mode 100644 index 0000000000..cc54c09f86 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220_270.png differ diff --git a/ardublockly/img/Components/Resistors/R220_90.png b/ardublockly/img/Components/Resistors/R220_90.png new file mode 100644 index 0000000000..b43ff8114c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220_90.png differ diff --git a/ardublockly/img/Components/Resistors/R220k.png b/ardublockly/img/Components/Resistors/R220k.png new file mode 100644 index 0000000000..5cee9a7276 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220k.png differ diff --git a/ardublockly/img/Components/Resistors/R220k_180.png b/ardublockly/img/Components/Resistors/R220k_180.png new file mode 100644 index 0000000000..725a5c8b57 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R220k_270.png b/ardublockly/img/Components/Resistors/R220k_270.png new file mode 100644 index 0000000000..d974dc6a06 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R220k_90.png b/ardublockly/img/Components/Resistors/R220k_90.png new file mode 100644 index 0000000000..07b284f320 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R220k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R22_180.png b/ardublockly/img/Components/Resistors/R22_180.png new file mode 100644 index 0000000000..5fa3f12025 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22_180.png differ diff --git a/ardublockly/img/Components/Resistors/R22_270.png b/ardublockly/img/Components/Resistors/R22_270.png new file mode 100644 index 0000000000..8e2be57601 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22_270.png differ diff --git a/ardublockly/img/Components/Resistors/R22_90.png b/ardublockly/img/Components/Resistors/R22_90.png new file mode 100644 index 0000000000..3666e9694e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22_90.png differ diff --git a/ardublockly/img/Components/Resistors/R22k.png b/ardublockly/img/Components/Resistors/R22k.png new file mode 100644 index 0000000000..1402890df2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22k.png differ diff --git a/ardublockly/img/Components/Resistors/R22k_180.png b/ardublockly/img/Components/Resistors/R22k_180.png new file mode 100644 index 0000000000..a885c000eb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R22k_270.png b/ardublockly/img/Components/Resistors/R22k_270.png new file mode 100644 index 0000000000..7c35e8a586 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R22k_90.png b/ardublockly/img/Components/Resistors/R22k_90.png new file mode 100644 index 0000000000..dc51c1a93c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R22k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R27.png b/ardublockly/img/Components/Resistors/R27.png new file mode 100644 index 0000000000..f9aa1193cc Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27.png differ diff --git a/ardublockly/img/Components/Resistors/R270k.png b/ardublockly/img/Components/Resistors/R270k.png new file mode 100644 index 0000000000..b284a8a1fc Binary files /dev/null and b/ardublockly/img/Components/Resistors/R270k.png differ diff --git a/ardublockly/img/Components/Resistors/R270k_180.png b/ardublockly/img/Components/Resistors/R270k_180.png new file mode 100644 index 0000000000..2b77ebb21d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R270k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R270k_270.png b/ardublockly/img/Components/Resistors/R270k_270.png new file mode 100644 index 0000000000..3ffe50141d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R270k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R270k_90.png b/ardublockly/img/Components/Resistors/R270k_90.png new file mode 100644 index 0000000000..5b1d615dc1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R270k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R27_180.png b/ardublockly/img/Components/Resistors/R27_180.png new file mode 100644 index 0000000000..a218c13b7d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27_180.png differ diff --git a/ardublockly/img/Components/Resistors/R27_270.png b/ardublockly/img/Components/Resistors/R27_270.png new file mode 100644 index 0000000000..e44b2a065c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27_270.png differ diff --git a/ardublockly/img/Components/Resistors/R27_90.png b/ardublockly/img/Components/Resistors/R27_90.png new file mode 100644 index 0000000000..97e2af214d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27_90.png differ diff --git a/ardublockly/img/Components/Resistors/R27k.png b/ardublockly/img/Components/Resistors/R27k.png new file mode 100644 index 0000000000..d7e0054cee Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27k.png differ diff --git a/ardublockly/img/Components/Resistors/R27k_180.png b/ardublockly/img/Components/Resistors/R27k_180.png new file mode 100644 index 0000000000..0db83cd2ff Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R27k_270.png b/ardublockly/img/Components/Resistors/R27k_270.png new file mode 100644 index 0000000000..a02f641da1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R27k_90.png b/ardublockly/img/Components/Resistors/R27k_90.png new file mode 100644 index 0000000000..b9b1840e6e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R27k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2.png b/ardublockly/img/Components/Resistors/R2_2.png new file mode 100644 index 0000000000..a0c253eff8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2M.png b/ardublockly/img/Components/Resistors/R2_2M.png new file mode 100644 index 0000000000..8a462ce564 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2M.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2M_180.png b/ardublockly/img/Components/Resistors/R2_2M_180.png new file mode 100644 index 0000000000..e007eeaf79 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2M_270.png b/ardublockly/img/Components/Resistors/R2_2M_270.png new file mode 100644 index 0000000000..ea330021b2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2M_90.png b/ardublockly/img/Components/Resistors/R2_2M_90.png new file mode 100644 index 0000000000..76fb8bb303 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2_180.png b/ardublockly/img/Components/Resistors/R2_2_180.png new file mode 100644 index 0000000000..a414c2512e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2_180.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2_270.png b/ardublockly/img/Components/Resistors/R2_2_270.png new file mode 100644 index 0000000000..27b45fda68 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2_270.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2_90.png b/ardublockly/img/Components/Resistors/R2_2_90.png new file mode 100644 index 0000000000..6f807bd1ba Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2_90.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2k.png b/ardublockly/img/Components/Resistors/R2_2k.png new file mode 100644 index 0000000000..97b3dc4168 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2k.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2k_180.png b/ardublockly/img/Components/Resistors/R2_2k_180.png new file mode 100644 index 0000000000..8c5ed908b4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2k_270.png b/ardublockly/img/Components/Resistors/R2_2k_270.png new file mode 100644 index 0000000000..c3c6217761 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R2_2k_90.png b/ardublockly/img/Components/Resistors/R2_2k_90.png new file mode 100644 index 0000000000..b9b5f76aac Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_2k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R2_7M.png b/ardublockly/img/Components/Resistors/R2_7M.png new file mode 100644 index 0000000000..885df25d22 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_7M.png differ diff --git a/ardublockly/img/Components/Resistors/R2_7M_180.png b/ardublockly/img/Components/Resistors/R2_7M_180.png new file mode 100644 index 0000000000..5bd726b461 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_7M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R2_7M_270.png b/ardublockly/img/Components/Resistors/R2_7M_270.png new file mode 100644 index 0000000000..6f0a4d2c40 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_7M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R2_7M_90.png b/ardublockly/img/Components/Resistors/R2_7M_90.png new file mode 100644 index 0000000000..c6abf74695 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R2_7M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R33.png b/ardublockly/img/Components/Resistors/R33.png new file mode 100644 index 0000000000..f0f20f0e07 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33.png differ diff --git a/ardublockly/img/Components/Resistors/R330.png b/ardublockly/img/Components/Resistors/R330.png new file mode 100644 index 0000000000..aa32e42d64 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330.png differ diff --git a/ardublockly/img/Components/Resistors/R330_180.png b/ardublockly/img/Components/Resistors/R330_180.png new file mode 100644 index 0000000000..e09244fca4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330_180.png differ diff --git a/ardublockly/img/Components/Resistors/R330_270.png b/ardublockly/img/Components/Resistors/R330_270.png new file mode 100644 index 0000000000..7a9f370dd3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330_270.png differ diff --git a/ardublockly/img/Components/Resistors/R330_90.png b/ardublockly/img/Components/Resistors/R330_90.png new file mode 100644 index 0000000000..86f6826563 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330_90.png differ diff --git a/ardublockly/img/Components/Resistors/R330k.png b/ardublockly/img/Components/Resistors/R330k.png new file mode 100644 index 0000000000..b47c4204d4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330k.png differ diff --git a/ardublockly/img/Components/Resistors/R330k_180.png b/ardublockly/img/Components/Resistors/R330k_180.png new file mode 100644 index 0000000000..679c24c8ef Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R330k_270.png b/ardublockly/img/Components/Resistors/R330k_270.png new file mode 100644 index 0000000000..050e15d28b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R330k_90.png b/ardublockly/img/Components/Resistors/R330k_90.png new file mode 100644 index 0000000000..e329419ed3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R330k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R33_180.png b/ardublockly/img/Components/Resistors/R33_180.png new file mode 100644 index 0000000000..470834a96c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33_180.png differ diff --git a/ardublockly/img/Components/Resistors/R33_270.png b/ardublockly/img/Components/Resistors/R33_270.png new file mode 100644 index 0000000000..45ee82a4b5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33_270.png differ diff --git a/ardublockly/img/Components/Resistors/R33_90.png b/ardublockly/img/Components/Resistors/R33_90.png new file mode 100644 index 0000000000..6c43eccf46 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33_90.png differ diff --git a/ardublockly/img/Components/Resistors/R33k.png b/ardublockly/img/Components/Resistors/R33k.png new file mode 100644 index 0000000000..aca14f5027 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33k.png differ diff --git a/ardublockly/img/Components/Resistors/R33k_180.png b/ardublockly/img/Components/Resistors/R33k_180.png new file mode 100644 index 0000000000..e0201b81b1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R33k_270.png b/ardublockly/img/Components/Resistors/R33k_270.png new file mode 100644 index 0000000000..7499c2024a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R33k_90.png b/ardublockly/img/Components/Resistors/R33k_90.png new file mode 100644 index 0000000000..d78759d305 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R33k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R39.png b/ardublockly/img/Components/Resistors/R39.png new file mode 100644 index 0000000000..a3dd6161ab Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39.png differ diff --git a/ardublockly/img/Components/Resistors/R390k._180png.png b/ardublockly/img/Components/Resistors/R390k._180png.png new file mode 100644 index 0000000000..aca3602394 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R390k._180png.png differ diff --git a/ardublockly/img/Components/Resistors/R390k._270png.png b/ardublockly/img/Components/Resistors/R390k._270png.png new file mode 100644 index 0000000000..9f77f59f81 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R390k._270png.png differ diff --git a/ardublockly/img/Components/Resistors/R390k._90png.png b/ardublockly/img/Components/Resistors/R390k._90png.png new file mode 100644 index 0000000000..33983a826b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R390k._90png.png differ diff --git a/ardublockly/img/Components/Resistors/R390k.png b/ardublockly/img/Components/Resistors/R390k.png new file mode 100644 index 0000000000..266dd6b7c9 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R390k.png differ diff --git a/ardublockly/img/Components/Resistors/R39_180.png b/ardublockly/img/Components/Resistors/R39_180.png new file mode 100644 index 0000000000..555f306387 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39_180.png differ diff --git a/ardublockly/img/Components/Resistors/R39_270.png b/ardublockly/img/Components/Resistors/R39_270.png new file mode 100644 index 0000000000..d908aa6db3 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39_270.png differ diff --git a/ardublockly/img/Components/Resistors/R39_90.png b/ardublockly/img/Components/Resistors/R39_90.png new file mode 100644 index 0000000000..5d5abaa6a4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39_90.png differ diff --git a/ardublockly/img/Components/Resistors/R39k.png b/ardublockly/img/Components/Resistors/R39k.png new file mode 100644 index 0000000000..15358ca9b0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39k.png differ diff --git a/ardublockly/img/Components/Resistors/R39k_180.png b/ardublockly/img/Components/Resistors/R39k_180.png new file mode 100644 index 0000000000..76771ef797 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R39k_270.png b/ardublockly/img/Components/Resistors/R39k_270.png new file mode 100644 index 0000000000..87ac79e3c0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R39k_90.png b/ardublockly/img/Components/Resistors/R39k_90.png new file mode 100644 index 0000000000..2d38244c73 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R39k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3.png b/ardublockly/img/Components/Resistors/R3_3.png new file mode 100644 index 0000000000..ead2716a4b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3M.png b/ardublockly/img/Components/Resistors/R3_3M.png new file mode 100644 index 0000000000..fce68444f8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3M.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3M_180.png b/ardublockly/img/Components/Resistors/R3_3M_180.png new file mode 100644 index 0000000000..577192447c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3M_270.png b/ardublockly/img/Components/Resistors/R3_3M_270.png new file mode 100644 index 0000000000..add00271c2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3M_90.png b/ardublockly/img/Components/Resistors/R3_3M_90.png new file mode 100644 index 0000000000..c8edbac56e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3_180.png b/ardublockly/img/Components/Resistors/R3_3_180.png new file mode 100644 index 0000000000..7671f134ac Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3_270.png b/ardublockly/img/Components/Resistors/R3_3_270.png new file mode 100644 index 0000000000..1095be2537 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3_90.png b/ardublockly/img/Components/Resistors/R3_3_90.png new file mode 100644 index 0000000000..cb6c217247 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3k.png b/ardublockly/img/Components/Resistors/R3_3k.png new file mode 100644 index 0000000000..d476c7d6b0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3k.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3k_180.png b/ardublockly/img/Components/Resistors/R3_3k_180.png new file mode 100644 index 0000000000..b6e18ff431 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3k_270.png b/ardublockly/img/Components/Resistors/R3_3k_270.png new file mode 100644 index 0000000000..fd887b8cf6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_3k_90.png b/ardublockly/img/Components/Resistors/R3_3k_90.png new file mode 100644 index 0000000000..29d59f9934 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_3k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9.png b/ardublockly/img/Components/Resistors/R3_9.png new file mode 100644 index 0000000000..7a4aee2222 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9M.png b/ardublockly/img/Components/Resistors/R3_9M.png new file mode 100644 index 0000000000..24f714dbaf Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9M.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9M_180.png b/ardublockly/img/Components/Resistors/R3_9M_180.png new file mode 100644 index 0000000000..2b96178fa1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9M_270.png b/ardublockly/img/Components/Resistors/R3_9M_270.png new file mode 100644 index 0000000000..2806b175ca Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9M_90.png b/ardublockly/img/Components/Resistors/R3_9M_90.png new file mode 100644 index 0000000000..13d222c972 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9_180.png b/ardublockly/img/Components/Resistors/R3_9_180.png new file mode 100644 index 0000000000..89d5bb201f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9_270.png b/ardublockly/img/Components/Resistors/R3_9_270.png new file mode 100644 index 0000000000..b0786c7339 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9_90.png b/ardublockly/img/Components/Resistors/R3_9_90.png new file mode 100644 index 0000000000..e5353e9e8a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9_90.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9k.png b/ardublockly/img/Components/Resistors/R3_9k.png new file mode 100644 index 0000000000..97d5ca9918 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9k.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9k_180.png b/ardublockly/img/Components/Resistors/R3_9k_180.png new file mode 100644 index 0000000000..925810b843 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9k_270.png b/ardublockly/img/Components/Resistors/R3_9k_270.png new file mode 100644 index 0000000000..d8728e7109 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R3_9k_90.png b/ardublockly/img/Components/Resistors/R3_9k_90.png new file mode 100644 index 0000000000..48b4cfc0d2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R3_9k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R47.png b/ardublockly/img/Components/Resistors/R47.png new file mode 100644 index 0000000000..b7b5e47735 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47.png differ diff --git a/ardublockly/img/Components/Resistors/R470.png b/ardublockly/img/Components/Resistors/R470.png new file mode 100644 index 0000000000..abbac7be6c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470.png differ diff --git a/ardublockly/img/Components/Resistors/R470_180.png b/ardublockly/img/Components/Resistors/R470_180.png new file mode 100644 index 0000000000..de0c25b922 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470_180.png differ diff --git a/ardublockly/img/Components/Resistors/R470_270.png b/ardublockly/img/Components/Resistors/R470_270.png new file mode 100644 index 0000000000..54b0227dc4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470_270.png differ diff --git a/ardublockly/img/Components/Resistors/R470_90.png b/ardublockly/img/Components/Resistors/R470_90.png new file mode 100644 index 0000000000..47bb660708 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470_90.png differ diff --git a/ardublockly/img/Components/Resistors/R470k.png b/ardublockly/img/Components/Resistors/R470k.png new file mode 100644 index 0000000000..d16d855a10 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470k.png differ diff --git a/ardublockly/img/Components/Resistors/R470k_180.png b/ardublockly/img/Components/Resistors/R470k_180.png new file mode 100644 index 0000000000..5b55139455 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R470k_270.png b/ardublockly/img/Components/Resistors/R470k_270.png new file mode 100644 index 0000000000..8ca998ac2a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R470k_90.png b/ardublockly/img/Components/Resistors/R470k_90.png new file mode 100644 index 0000000000..a90ae12c1b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R470k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R47_180.png b/ardublockly/img/Components/Resistors/R47_180.png new file mode 100644 index 0000000000..7a32f0bdd6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47_180.png differ diff --git a/ardublockly/img/Components/Resistors/R47_270.png b/ardublockly/img/Components/Resistors/R47_270.png new file mode 100644 index 0000000000..0ba97f52dd Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47_270.png differ diff --git a/ardublockly/img/Components/Resistors/R47_90.png b/ardublockly/img/Components/Resistors/R47_90.png new file mode 100644 index 0000000000..6fcd613d5a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47_90.png differ diff --git a/ardublockly/img/Components/Resistors/R47k.png b/ardublockly/img/Components/Resistors/R47k.png new file mode 100644 index 0000000000..766526577b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47k.png differ diff --git a/ardublockly/img/Components/Resistors/R47k_180.png b/ardublockly/img/Components/Resistors/R47k_180.png new file mode 100644 index 0000000000..f10f82f2e8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R47k_270.png b/ardublockly/img/Components/Resistors/R47k_270.png new file mode 100644 index 0000000000..c57ef74265 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R47k_90.png b/ardublockly/img/Components/Resistors/R47k_90.png new file mode 100644 index 0000000000..1c6d05d446 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R47k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7.png b/ardublockly/img/Components/Resistors/R4_7.png new file mode 100644 index 0000000000..9927b86cc9 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7M.png b/ardublockly/img/Components/Resistors/R4_7M.png new file mode 100644 index 0000000000..b401d4af6d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7M.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7M_180.png b/ardublockly/img/Components/Resistors/R4_7M_180.png new file mode 100644 index 0000000000..79148376bf Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7M_270.png b/ardublockly/img/Components/Resistors/R4_7M_270.png new file mode 100644 index 0000000000..70d3216b47 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7M_90.png b/ardublockly/img/Components/Resistors/R4_7M_90.png new file mode 100644 index 0000000000..038b4f9c19 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7_180.png b/ardublockly/img/Components/Resistors/R4_7_180.png new file mode 100644 index 0000000000..5bd16f3b56 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7_180.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7_270.png b/ardublockly/img/Components/Resistors/R4_7_270.png new file mode 100644 index 0000000000..1d1cbd561f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7_270.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7_90.png b/ardublockly/img/Components/Resistors/R4_7_90.png new file mode 100644 index 0000000000..13f01600c5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7_90.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7k.png b/ardublockly/img/Components/Resistors/R4_7k.png new file mode 100644 index 0000000000..1ddfb87f40 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7k.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7k_180.png b/ardublockly/img/Components/Resistors/R4_7k_180.png new file mode 100644 index 0000000000..b158400e3a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7k_270.png b/ardublockly/img/Components/Resistors/R4_7k_270.png new file mode 100644 index 0000000000..457e4f6a19 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R4_7k_90.png b/ardublockly/img/Components/Resistors/R4_7k_90.png new file mode 100644 index 0000000000..5d05e969ca Binary files /dev/null and b/ardublockly/img/Components/Resistors/R4_7k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R56.png b/ardublockly/img/Components/Resistors/R56.png new file mode 100644 index 0000000000..acbb8b562d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56.png differ diff --git a/ardublockly/img/Components/Resistors/R560.png b/ardublockly/img/Components/Resistors/R560.png new file mode 100644 index 0000000000..a23cce4e4e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560.png differ diff --git a/ardublockly/img/Components/Resistors/R560_180.png b/ardublockly/img/Components/Resistors/R560_180.png new file mode 100644 index 0000000000..80f5d6ef51 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560_180.png differ diff --git a/ardublockly/img/Components/Resistors/R560_270.png b/ardublockly/img/Components/Resistors/R560_270.png new file mode 100644 index 0000000000..c080929b2e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560_270.png differ diff --git a/ardublockly/img/Components/Resistors/R560_90.png b/ardublockly/img/Components/Resistors/R560_90.png new file mode 100644 index 0000000000..013ccc3150 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560_90.png differ diff --git a/ardublockly/img/Components/Resistors/R560k.png b/ardublockly/img/Components/Resistors/R560k.png new file mode 100644 index 0000000000..7c1c4d96a1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560k.png differ diff --git a/ardublockly/img/Components/Resistors/R560k_180.png b/ardublockly/img/Components/Resistors/R560k_180.png new file mode 100644 index 0000000000..e13e3b7b90 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R560k_270.png b/ardublockly/img/Components/Resistors/R560k_270.png new file mode 100644 index 0000000000..42f27f0f26 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R560k_90.png b/ardublockly/img/Components/Resistors/R560k_90.png new file mode 100644 index 0000000000..74f801811d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R560k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R56_180.png b/ardublockly/img/Components/Resistors/R56_180.png new file mode 100644 index 0000000000..ffb6d2b041 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56_180.png differ diff --git a/ardublockly/img/Components/Resistors/R56_270.png b/ardublockly/img/Components/Resistors/R56_270.png new file mode 100644 index 0000000000..fc164db95e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56_270.png differ diff --git a/ardublockly/img/Components/Resistors/R56_90.png b/ardublockly/img/Components/Resistors/R56_90.png new file mode 100644 index 0000000000..f44735a10b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56_90.png differ diff --git a/ardublockly/img/Components/Resistors/R56k.png b/ardublockly/img/Components/Resistors/R56k.png new file mode 100644 index 0000000000..035ff52dd7 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56k.png differ diff --git a/ardublockly/img/Components/Resistors/R56k_180.png b/ardublockly/img/Components/Resistors/R56k_180.png new file mode 100644 index 0000000000..05d33cc878 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R56k_270.png b/ardublockly/img/Components/Resistors/R56k_270.png new file mode 100644 index 0000000000..4d1d3a050c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R56k_90.png b/ardublockly/img/Components/Resistors/R56k_90.png new file mode 100644 index 0000000000..1512368d1c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R56k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6.png b/ardublockly/img/Components/Resistors/R5_6.png new file mode 100644 index 0000000000..d08519a313 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6M.png b/ardublockly/img/Components/Resistors/R5_6M.png new file mode 100644 index 0000000000..c07fe90d78 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6M.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6M_180.png b/ardublockly/img/Components/Resistors/R5_6M_180.png new file mode 100644 index 0000000000..67158a1e4c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6M_270.png b/ardublockly/img/Components/Resistors/R5_6M_270.png new file mode 100644 index 0000000000..1dc48fd006 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6M_90.png b/ardublockly/img/Components/Resistors/R5_6M_90.png new file mode 100644 index 0000000000..8da3a81d24 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6_180.png b/ardublockly/img/Components/Resistors/R5_6_180.png new file mode 100644 index 0000000000..9428bf785d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6_180.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6_270.png b/ardublockly/img/Components/Resistors/R5_6_270.png new file mode 100644 index 0000000000..6ce22ccffa Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6_270.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6_90.png b/ardublockly/img/Components/Resistors/R5_6_90.png new file mode 100644 index 0000000000..c0bd329ef4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6_90.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6k.png b/ardublockly/img/Components/Resistors/R5_6k.png new file mode 100644 index 0000000000..09afae70b4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6k.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6k_180.png b/ardublockly/img/Components/Resistors/R5_6k_180.png new file mode 100644 index 0000000000..9bbed2b10e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6k_270.png b/ardublockly/img/Components/Resistors/R5_6k_270.png new file mode 100644 index 0000000000..20d93d34ef Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R5_6k_90.png b/ardublockly/img/Components/Resistors/R5_6k_90.png new file mode 100644 index 0000000000..fe61fe72a6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R5_6k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R68.png b/ardublockly/img/Components/Resistors/R68.png new file mode 100644 index 0000000000..059637701e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68.png differ diff --git a/ardublockly/img/Components/Resistors/R680.png b/ardublockly/img/Components/Resistors/R680.png new file mode 100644 index 0000000000..c41bbe7975 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680.png differ diff --git a/ardublockly/img/Components/Resistors/R680_180.png b/ardublockly/img/Components/Resistors/R680_180.png new file mode 100644 index 0000000000..79f729f582 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680_180.png differ diff --git a/ardublockly/img/Components/Resistors/R680_270.png b/ardublockly/img/Components/Resistors/R680_270.png new file mode 100644 index 0000000000..6511f5c0c5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680_270.png differ diff --git a/ardublockly/img/Components/Resistors/R680_90.png b/ardublockly/img/Components/Resistors/R680_90.png new file mode 100644 index 0000000000..51b25c89a1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680_90.png differ diff --git a/ardublockly/img/Components/Resistors/R680k.png b/ardublockly/img/Components/Resistors/R680k.png new file mode 100644 index 0000000000..89df096f02 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680k.png differ diff --git a/ardublockly/img/Components/Resistors/R680k_180.png b/ardublockly/img/Components/Resistors/R680k_180.png new file mode 100644 index 0000000000..b1e5ca991e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R680k_270.png b/ardublockly/img/Components/Resistors/R680k_270.png new file mode 100644 index 0000000000..e9391df092 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R680k_90.png b/ardublockly/img/Components/Resistors/R680k_90.png new file mode 100644 index 0000000000..be82d79b73 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R680k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R68_180.png b/ardublockly/img/Components/Resistors/R68_180.png new file mode 100644 index 0000000000..cec8d15eb0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68_180.png differ diff --git a/ardublockly/img/Components/Resistors/R68_270.png b/ardublockly/img/Components/Resistors/R68_270.png new file mode 100644 index 0000000000..7f552967da Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68_270.png differ diff --git a/ardublockly/img/Components/Resistors/R68_90.png b/ardublockly/img/Components/Resistors/R68_90.png new file mode 100644 index 0000000000..1dd723e6fa Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68_90.png differ diff --git a/ardublockly/img/Components/Resistors/R68k.png b/ardublockly/img/Components/Resistors/R68k.png new file mode 100644 index 0000000000..2f0da36cd7 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68k.png differ diff --git a/ardublockly/img/Components/Resistors/R68k_180.png b/ardublockly/img/Components/Resistors/R68k_180.png new file mode 100644 index 0000000000..55bc7e3eef Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R68k_270.png b/ardublockly/img/Components/Resistors/R68k_270.png new file mode 100644 index 0000000000..3bc9f180af Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R68k_90.png b/ardublockly/img/Components/Resistors/R68k_90.png new file mode 100644 index 0000000000..5719f4905c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R68k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8.png b/ardublockly/img/Components/Resistors/R6_8.png new file mode 100644 index 0000000000..b2486928b6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8M.png b/ardublockly/img/Components/Resistors/R6_8M.png new file mode 100644 index 0000000000..76d67091a0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8M.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8M_180.png b/ardublockly/img/Components/Resistors/R6_8M_180.png new file mode 100644 index 0000000000..6ed50cffac Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8M_270.png b/ardublockly/img/Components/Resistors/R6_8M_270.png new file mode 100644 index 0000000000..6d29d2b0d0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8M_90.png b/ardublockly/img/Components/Resistors/R6_8M_90.png new file mode 100644 index 0000000000..8f17ddd27d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8_180.png b/ardublockly/img/Components/Resistors/R6_8_180.png new file mode 100644 index 0000000000..13b9ec218c Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8_180.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8_270.png b/ardublockly/img/Components/Resistors/R6_8_270.png new file mode 100644 index 0000000000..505d25e9e9 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8_270.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8_90.png b/ardublockly/img/Components/Resistors/R6_8_90.png new file mode 100644 index 0000000000..1e6ffa8bb6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8_90.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8k.png b/ardublockly/img/Components/Resistors/R6_8k.png new file mode 100644 index 0000000000..82e2660a38 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8k.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8k_180.png b/ardublockly/img/Components/Resistors/R6_8k_180.png new file mode 100644 index 0000000000..a56836e3b0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8k_270.png b/ardublockly/img/Components/Resistors/R6_8k_270.png new file mode 100644 index 0000000000..1f5f87c4ea Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R6_8k_90.png b/ardublockly/img/Components/Resistors/R6_8k_90.png new file mode 100644 index 0000000000..559482b0eb Binary files /dev/null and b/ardublockly/img/Components/Resistors/R6_8k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R82.png b/ardublockly/img/Components/Resistors/R82.png new file mode 100644 index 0000000000..07b4a58c6f Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82.png differ diff --git a/ardublockly/img/Components/Resistors/R820.png b/ardublockly/img/Components/Resistors/R820.png new file mode 100644 index 0000000000..38c33d1a6b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820.png differ diff --git a/ardublockly/img/Components/Resistors/R820_180.png b/ardublockly/img/Components/Resistors/R820_180.png new file mode 100644 index 0000000000..e26c8fa290 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820_180.png differ diff --git a/ardublockly/img/Components/Resistors/R820_270.png b/ardublockly/img/Components/Resistors/R820_270.png new file mode 100644 index 0000000000..ca3749a365 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820_270.png differ diff --git a/ardublockly/img/Components/Resistors/R820_90.png b/ardublockly/img/Components/Resistors/R820_90.png new file mode 100644 index 0000000000..1fb42cdade Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820_90.png differ diff --git a/ardublockly/img/Components/Resistors/R820k.png b/ardublockly/img/Components/Resistors/R820k.png new file mode 100644 index 0000000000..74c11d353b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820k.png differ diff --git a/ardublockly/img/Components/Resistors/R820k_180.png b/ardublockly/img/Components/Resistors/R820k_180.png new file mode 100644 index 0000000000..87f821c2fd Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R820k_270.png b/ardublockly/img/Components/Resistors/R820k_270.png new file mode 100644 index 0000000000..3713a0ecc2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R820k_90.png b/ardublockly/img/Components/Resistors/R820k_90.png new file mode 100644 index 0000000000..2157b302b6 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R820k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R82_180.png b/ardublockly/img/Components/Resistors/R82_180.png new file mode 100644 index 0000000000..f816947655 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82_180.png differ diff --git a/ardublockly/img/Components/Resistors/R82_270.png b/ardublockly/img/Components/Resistors/R82_270.png new file mode 100644 index 0000000000..1c1454b5e4 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82_270.png differ diff --git a/ardublockly/img/Components/Resistors/R82_90.png b/ardublockly/img/Components/Resistors/R82_90.png new file mode 100644 index 0000000000..c77fdcd490 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82_90.png differ diff --git a/ardublockly/img/Components/Resistors/R82k.png b/ardublockly/img/Components/Resistors/R82k.png new file mode 100644 index 0000000000..d97df4bcbc Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82k.png differ diff --git a/ardublockly/img/Components/Resistors/R82k_180.png b/ardublockly/img/Components/Resistors/R82k_180.png new file mode 100644 index 0000000000..c8cdf3358b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R82k_270.png b/ardublockly/img/Components/Resistors/R82k_270.png new file mode 100644 index 0000000000..54310f7413 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R82k_90.png b/ardublockly/img/Components/Resistors/R82k_90.png new file mode 100644 index 0000000000..d9a7aa7423 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R82k_90.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2.png b/ardublockly/img/Components/Resistors/R8_2.png new file mode 100644 index 0000000000..8e56b57dc0 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2M.png b/ardublockly/img/Components/Resistors/R8_2M.png new file mode 100644 index 0000000000..0218848cc8 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2M.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2M_180.png b/ardublockly/img/Components/Resistors/R8_2M_180.png new file mode 100644 index 0000000000..c0ffdac2c2 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2M_180.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2M_270.png b/ardublockly/img/Components/Resistors/R8_2M_270.png new file mode 100644 index 0000000000..6f76ac473d Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2M_270.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2M_90.png b/ardublockly/img/Components/Resistors/R8_2M_90.png new file mode 100644 index 0000000000..0617ddd159 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2M_90.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2_180.png b/ardublockly/img/Components/Resistors/R8_2_180.png new file mode 100644 index 0000000000..55c7e8c4ef Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2_180.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2_270.png b/ardublockly/img/Components/Resistors/R8_2_270.png new file mode 100644 index 0000000000..045dbbf71e Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2_270.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2_90.png b/ardublockly/img/Components/Resistors/R8_2_90.png new file mode 100644 index 0000000000..7ed10106d1 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2_90.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2k.png b/ardublockly/img/Components/Resistors/R8_2k.png new file mode 100644 index 0000000000..8febde960a Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2k.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2k_180.png b/ardublockly/img/Components/Resistors/R8_2k_180.png new file mode 100644 index 0000000000..aa8f82fd47 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2k_180.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2k_270.png b/ardublockly/img/Components/Resistors/R8_2k_270.png new file mode 100644 index 0000000000..1aff9f3c9b Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2k_270.png differ diff --git a/ardublockly/img/Components/Resistors/R8_2k_90.png b/ardublockly/img/Components/Resistors/R8_2k_90.png new file mode 100644 index 0000000000..f327eee856 Binary files /dev/null and b/ardublockly/img/Components/Resistors/R8_2k_90.png differ diff --git a/ardublockly/img/Components/Resistors/RBlown.png b/ardublockly/img/Components/Resistors/RBlown.png new file mode 100644 index 0000000000..f3f41ea467 Binary files /dev/null and b/ardublockly/img/Components/Resistors/RBlown.png differ diff --git a/ardublockly/img/Components/Resistors/RBlown_180.png b/ardublockly/img/Components/Resistors/RBlown_180.png new file mode 100644 index 0000000000..e1efab17d5 Binary files /dev/null and b/ardublockly/img/Components/Resistors/RBlown_180.png differ diff --git a/ardublockly/img/Components/Resistors/RBlown_270.png b/ardublockly/img/Components/Resistors/RBlown_270.png new file mode 100644 index 0000000000..3c5e2013eb Binary files /dev/null and b/ardublockly/img/Components/Resistors/RBlown_270.png differ diff --git a/ardublockly/img/Components/Resistors/RBlown_90.png b/ardublockly/img/Components/Resistors/RBlown_90.png new file mode 100644 index 0000000000..55b92d7fea Binary files /dev/null and b/ardublockly/img/Components/Resistors/RBlown_90.png differ diff --git a/ardublockly/index.html b/ardublockly/index.html index 75fa9a3538..dadc09e4e3 100644 --- a/ardublockly/index.html +++ b/ardublockly/index.html @@ -16,6 +16,7 @@ + - + + + @@ -74,6 +89,15 @@
- - - + Oka @@ -330,5 +350,9 @@

Ardublockly ap Ardublockly.init(); }); +y + + +