Skip to content

Commit

Permalink
fixes ElectroBlocks#129 motor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vasu737et committed May 30, 2024
1 parent d0b93ee commit de7bd62
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/core/blockly/generators/arduino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ Blockly["Arduino"].init = function (workspace) {

const colourVariables = workspace.getVariablesOfType("Colour");
if(colourVariables.length>0){
variableCode +=
"struct RGB {\n" +
" int red;\n" +
" int green;\n" +
" int blue;\n" +
     "};\n";
variableCode +="";
  }
for (i = 0; i < colourVariables.length; i += 1) {
variableCode +=
Expand All @@ -154,7 +149,7 @@ Blockly["Arduino"].init = function (workspace) {
Blockly["Arduino"].finish = function (code) {
let libraryCode = "";
let functionsCode = "";
let devVariables = "int simple_loop_variable = 0; \n";
let devVariables = "";

for (const key in Blockly["Arduino"].libraries_) {
libraryCode += Blockly["Arduino"].libraries_[key] + "\n";
Expand Down Expand Up @@ -200,11 +195,7 @@ Blockly["Arduino"].finish = function (code) {
// Convert the definitions dictionary into a list.
code =
devVariables +
"struct RGB { \n" +
"\tint red;\n" +
"\tint green;\n" +
"\tint blue;\n" +
"};\n" +

libraryCode +
"\n" +
Blockly["Arduino"].variablesInitCode_ +
Expand Down

0 comments on commit de7bd62

Please sign in to comment.