/** * @license Licensed under the Apache License, Version 2.0 (the "License"): * http://www.apache.org/licenses/LICENSE-2.0 */ /** * @fileoverview Ardublockly JavaScript for the Blockly resources and bindings. */ 'use strict'; goog.provide('Blockly.Blocks.motor'); goog.require('Blockly.Blocks'); Blockly.Blocks.motor.HUE = 345; // Blockly.Blocks['ultrasonicavoidingrobot'] = { // init: function() { // this.appendDummyInput() // .appendField(new Blockly.FieldImage("https://puu.sh/xLg12/c83265b10a.png", 160, 80, "*")); // this.appendDummyInput() // .appendField("Set Echo to Pin") // .appendField(new Blockly.FieldTextInput("2"), "uarEchoPin") // .appendField("Set Trig to Pin") // .appendField(new Blockly.FieldTextInput("3"), "uarTrigPin"); // this.appendDummyInput() // .appendField("Set Speed to") // .appendField(new Blockly.FieldNumber(20, 0, 255), "uarSpeed"); // this.appendDummyInput() // .appendField("Set Detecting Distance") // .appendField(new Blockly.FieldNumber(20), "uarDistance") // .appendField("cm"); // this.appendDummyInput() // .appendField(new Blockly.FieldImage("https://puu.sh/xLgsO/bc6b467578.png", 24, 24, "*")) // .appendField("Set your movement below:"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['uardirectionforward'] = { // init: function() { // this.appendDummyInput() // .appendField("Go Forward for") // .appendField(new Blockly.FieldNumber(10, 0, 300), "uarDirDuration") // .appendField("seconds"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['uardirectionbackward'] = { // init: function() { // this.appendDummyInput() // .appendField("Go Backward for") // .appendField(new Blockly.FieldNumber(10, 0, 300), "uarDirDuration") // .appendField("seconds"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['uardirectionleft'] = { // init: function() { // this.appendDummyInput() // .appendField("Rotate Left for") // .appendField(new Blockly.FieldNumber(10, 0, 300), "uarDirDuration") // .appendField("seconds"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['uardirectionright'] = { // init: function() { // this.appendDummyInput() // .appendField("Rotatel Right for") // .appendField(new Blockly.FieldNumber(10, 0, 300), "uarDirDuration") // .appendField("seconds"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['uarfinishsetup'] = { // init: function() { // this.appendDummyInput() // .appendField("Setup Complete"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(200); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['motor_setup'] = { // init: function() { // this.appendDummyInput() // .appendField(new Blockly.FieldImage("https://puu.sh/wtu4O/c2deb70d42.png", 140, 40, "15")); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_SETUP); // //this.setPreviousStatement(true, null); // //this.setNextStatement(true, ['motor_remote_setup', 'motor_path_planning', 'motor_line_tracking', 'motor_ultrasonic_pin', 'motor_ultrasonic_custom_pin']); // this.setNextStatement(true, 'motor_type'); // this.setColour(30); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; Blockly.Blocks['motor_setup'] = { init: function() { this.appendDummyInput() // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_motorDriver.png", 140, 40, "15")); .appendField(new Blockly.FieldImage("./../blockly/media/main-motor.png", 50, 40, "15")); this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_SETUP); // this.setPreviousStatement(true, null); // this.setNextStatement(true, ['motor_remote_setup', 'motor_path_planning', 'motor_line_tracking', 'motor_ultrasonic_pin', 'motor_ultrasonic_custom_pin']); // this.setNextStatement(true, 'motor_type'); // this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); } }; // Blockly.Blocks['motor_remote_setup'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_REMOTE_SETUP); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "run") // .appendField(" -- " + Blockly.Msg.MOTOR_GO); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "reverse") // .appendField(" -- " + Blockly.Msg.MOTOR_REVERSE); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "turn_left") // .appendField(" -- " + Blockly.Msg.MOTOR_TURN_LEFT); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "turn_right") // .appendField(" -- " + Blockly.Msg.MOTOR_TURN_RIGHT); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "stop") // .appendField(" -- " + Blockly.Msg.MOTOR_STOP); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "speed_0") // .appendField(" -- "+ Blockly.Msg.MOTOR_SPEED+" 0"); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "speed_80") // .appendField(" -- "+Blockly.Msg.MOTOR_SPEED+" 80"); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "speed_100") // .appendField(" -- "+Blockly.Msg.MOTOR_SPEED+" 100"); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_BUTTON) // .appendField(new Blockly.FieldDropdown([["0","0xFF9867"], ["1","0xFFA25D"], ["2","0xFF629D"], ["3","0xFFE21D"], ["4","0xFF22DD"], ["5","0xFF02FD"], ["6","0xFFC23D"], ["7","0xFFE01F"], ["8","0xFFA857"], ["9","0xFF906F"], ["RIGHT","0xFF5AA5"], ["UP","0xFF18E7"], ["DOWN","0xFF4AB5"], ["LEFT","0xFF10EF"], ["OK", "0xFF38C7"], ["*", "0xFF6897"], ["#", "0xFFB04F"]]), "speed_120") // .appendField(" -- "+Blockly.Msg.MOTOR_SPEED+" 120"); // this.setPreviousStatement(true, 'motor_type'); // this.setColour(30); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_path_planning'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_PATH_PLANNING); // this.appendStatementInput("motor_motion") // //.setCheck(['motor_turn_left', 'motor_turn_right', 'motor_go_forward', 'motor_go_backward']); // .setCheck('motor_option'); // this.setPreviousStatement(true, 'motor_type'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_turn_left'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_TURN_LEFT + "- ") // .appendField(new Blockly.FieldTextInput("1000"), "delay") // .appendField(Blockly.Msg.MOTOR_MILLISEC); // this.setPreviousStatement(true, 'motor_option'); // this.setNextStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_turn_right'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_TURN_RIGHT + "- ") // .appendField(new Blockly.FieldTextInput("1000"), "delay") // .appendField(Blockly.Msg.MOTOR_MILLISEC); // this.setPreviousStatement(true, 'motor_option'); // this.setNextStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_go_forward'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_GO + "- ") // .appendField(new Blockly.FieldTextInput("1000"), "delay") // .appendField(Blockly.Msg.MOTOR_MILLISEC); // this.setPreviousStatement(true, 'motor_option'); // this.setNextStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_go_backward'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_REVERSE + "- ") // .appendField(new Blockly.FieldTextInput("1000"), "delay") // .appendField(Blockly.Msg.MOTOR_MILLISEC); // this.setPreviousStatement(true, 'motor_option'); // this.setNextStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; Blockly.Blocks['motor_speed'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_SPEED) .appendField(new Blockly.FieldNumber(150, 0, 255), "SPEED"); this.setOutput(true, Blockly.Types.NUMBER.output); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(""); this.setHelpUrl(""); }, getBlockType: function() { return Blockly.Types.NUMBER; } }; Blockly.Blocks['motorA_move_clockwise'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MOTOR) .appendField(new Blockly.FieldDropdown([ ["A", "1"], ["B", "0"] ]), "MOTOR"); this.appendValueInput("SPEED") .setCheck("Number"); this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MSG) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.MOTOR_MOVE_DIRECTION1, "0"], [Blockly.Msg.MOTOR_MOVE_DIRECTION2, "1"] ]), "DIRECTION"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); } }; Blockly.Blocks['motorA_move_anticlockwise'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MOTOR) .appendField(new Blockly.FieldDropdown([ ["A", "1"], ["B", "0"] ]), "MOTOR"); this.appendValueInput("SPEED") .setCheck("Number"); this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MSG) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.MOTOR_MOVE_DIRECTION2, "1"], [Blockly.Msg.MOTOR_MOVE_DIRECTION1, "0"] ]), "DIRECTION"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); } }; Blockly.Blocks['motorB_move_clockwise'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MOTOR) .appendField(new Blockly.FieldDropdown([ ["B", "0"], ["A", "1"] ]), "MOTOR"); this.appendValueInput("SPEED") .setCheck("Number"); this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MSG) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.MOTOR_MOVE_DIRECTION1, "0"], [Blockly.Msg.MOTOR_MOVE_DIRECTION2, "1"] ]), "DIRECTION"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); } }; Blockly.Blocks['motorB_move_anticlockwise'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MOTOR) .appendField(new Blockly.FieldDropdown([ ["B", "0"], ["A", "1"] ]), "MOTOR"); this.appendValueInput("SPEED") .setCheck("Number"); this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_MOVE_MSG) .appendField(new Blockly.FieldDropdown([ [Blockly.Msg.MOTOR_MOVE_DIRECTION2, "1"], [Blockly.Msg.MOTOR_MOVE_DIRECTION1, "0"] ]), "DIRECTION"); this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); } }; Blockly.Blocks['motor_stop'] = { init: function() { this.appendDummyInput() .appendField(Blockly.Msg.MOTOR_STOP); this.setPreviousStatement(true, null); this.setNextStatement(true, null); this.setColour(Blockly.Blocks.motor.HUE); this.setTooltip(''); this.setHelpUrl(''); }, }; // Blockly.Blocks['motor_line_tracking'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_LINE_TRACKING); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A4"), "pin_0"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A0"), "pin_1"); // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_SPEED) // .appendField(new Blockly.FieldTextInput("150"), "speed"); // this.setPreviousStatement(true, null); // this.setColour(255); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_ultrasonic_pin'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_ULTRASONIC); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("stA"), "pin_var0") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A1"), "pin_0"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("seA"), "pin_var1") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A0"), "pin_1"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("stB"), "pin_var2") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("0"), "pin_2"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("seB"), "pin_var3") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("1"), "pin_3"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("stC"), "pin_var4") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("3"), "pin_4"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("seC"), "pin_var5") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("2"), "pin_5"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("MAX_DISTANCE"), "max_distance_var") // .appendField(Blockly.Msg.MOTOR_AS) // .appendField(new Blockly.FieldTextInput("10"), "max_distance"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("REAL_TIME_DISTANCE"), "real_time_distance_var") // .appendField(Blockly.Msg.MOTOR_AS) // .appendField(new Blockly.FieldTextInput("6"), "real_time_distance"); // this.setPreviousStatement(true, 'motor_type'); // this.setColour(90); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_ultrasonic_custom_pin'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_ULTRASONIC_CUST); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("stA"), "custom_pin_var0") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A1"), "custom_pin_0"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("seA"), "custom_pin_var1") // .appendField(Blockly.Msg.MOTOR_AS + " "+ Blockly.Msg.LED_PIN) // .appendField(new Blockly.FieldTextInput("A0"), "custom_pin_1"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("MAX_DISTANCE"), "custom_max_distance_var") // .appendField(Blockly.Msg.MOTOR_AS) // .appendField(new Blockly.FieldTextInput("100"), "custom_max_distance"); // this.appendDummyInput() // .appendField(Blockly.Msg.LED_SET_WORD) // .appendField(new Blockly.FieldTextInput("REAL_TIME_DISTANCE"), "custom_real_time_distance_var") // .appendField(Blockly.Msg.MOTOR_AS) // .appendField(new Blockly.FieldTextInput("6"), "custom_real_time_distance"); // this.setPreviousStatement(true, 'motor_type'); // this.setNextStatement(true, 'motor_type'); // this.setColour(90); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_controller'] = { // init: function() { // this.appendDummyInput() // .appendField("Motor") // .appendField(new Blockly.FieldTextInput("1"), "motor_name") // .appendField("speed") // .appendField(new Blockly.FieldNumber(0), "motor_speed"); // this.appendDummyInput() // .appendField("direction") // // right --> clockwise --> 1, left --> counter clockwise--> 2 // .appendField(new Blockly.FieldDropdown([["Clockwise","1"], ["Counter Clockwise","2"]]), "motor_direction"); // this.setPreviousStatement(true, null); // this.setNextStatement(true, null); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // }; // Blockly.Blocks['motor_stop'] = { // init: function() { // this.appendDummyInput() // .appendField(Blockly.Msg.MOTOR_STOP); // this.setPreviousStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['motor_pause'] = { // init: function() { // this.appendDummyInput() // .appendField("Stop" + "- ") // .appendField(new Blockly.FieldTextInput("1000"), "delay") // .appendField(Blockly.Msg.MOTOR_MILLISEC); // this.setPreviousStatement(true, 'motor_option'); // this.setNextStatement(true, 'motor_option'); // this.setColour(330); // this.setTooltip(''); // this.setHelpUrl(''); // } // }; // Blockly.Blocks['robotcar3in1'] = { // init: function() { // this.appendDummyInput() // .appendField("3-in-1 Robot Car"); // this.setColour(230); // this.setTooltip(""); // this.setHelpUrl(""); // } // };