/** * @license * Visual Blocks Editor * * Copyright 2012 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Colour blocks for Blockly. * @author fraser@google.com (Neil Fraser) */ 'use strict'; goog.provide('Blockly.Blocks.AIYBoard'); goog.require('Blockly.Blocks'); /** * Common HSV hue for all blocks in this category. */ Blockly.Blocks.AIYBoard.HUE = "#6844d1"; Blockly.Blocks['AIYBoard_from'] = { /** * Block for log setup. * @this Blockly.Block */ init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendValueInput("INPUT") .appendField(Blockly.Msg.AIYBOARD_FROM) // this.setInputsInline(false); // this.setOutput(true); this.setPreviousStatement(true); this.setNextStatement(true); }, }; Blockly.Blocks['AIYBoard_import'] = { /** * Block for log setup. * @this Blockly.Block */ init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendDummyInput() .appendField(Blockly.Msg.AIYBOARD_IMPORT) .appendField(new Blockly.FieldDropdown([ ["Board","Board"], ["Led","Led"], ]),"BOARD") // this.setInputsInline(false); this.setOutput(true); // this.setPreviousStatement(true); // this.setNextStatement(true); }, }; Blockly.Blocks['AIYBoard_Board'] = { /** * Block for log setup. * @this Blockly.Block */ init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendDummyInput() .appendField(Blockly.Msg.AIYBOARD_AIY_BOARD); // this.setInputsInline(false); this.setOutput(true); // this.setPreviousStatement(true); // this.setNextStatement(true); }, }; Blockly.Blocks['AIYBoard_LED_state'] = { /** * Block for log setup. * @this Blockly.Block */ init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendValueInput("INPUT") .appendField(Blockly.Msg.AIYBOARD_LED_STATE); this.setInputsInline(true); this.setOutput(true); // this.setPreviousStatement(true); // this.setNextStatement(true); }, }; Blockly.Blocks['AIYBoard_LED_status'] = { /** * Block for log setup. * @this Blockly.Block */ init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendValueInput("INPUT") .appendField(Blockly.Msg.AIYBOARD_LED_STATUS); this.setInputsInline(true); this.setOutput(true); // this.setPreviousStatement(true); // this.setNextStatement(true); }, }; Blockly.Blocks['AIYBoard_LED_setting'] = { init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE); this.appendDummyInput() .appendField("LED") .appendField(new Blockly.FieldDropdown([ ["BEACON_DARK","BEACON_DARK"], ["ON","ON"], ["PULSE_QUICK","PULSE_QUICK"] ]),"SETTING") this.setOutput(true); } } Blockly.Blocks['AIYBoard_board'] = { init:function() { this.setColour(Blockly.Blocks.AIYBoard.HUE) this.appendDummyInput() .appendField("Board") this.setOutput(true) }, } Blockly.Blocks['AIYBoard_button'] = { init:function() { this.setColour(Blockly.Blocks.AIYBoard.HUE) this.appendDummyInput() .appendField("Button") this.setOutput(true) }, } /** * board kit * press button function */ Blockly.Blocks['AIYBoard_button_press'] = { init: function() { this.setColour(Blockly.Blocks.AIYBoard.HUE) this.appendDummyInput() .appendField("On Button Press") this.appendStatementInput("STACK") this.setPreviousStatement(true); this.setNextStatement(true); } } Blockly.Blocks['AIYBoard_board_led_status'] = { init:function() { this.setColour(Blockly.Blocks.AIYBoard.HUE) this.appendValueInput("INPUT") .appendField("Board led status") this.setPreviousStatement(true); this.setNextStatement(true) } } Blockly.Blocks['AIYBoard_board_led_state'] = { init:function() { this.setColour(Blockly.Blocks.AIYBoard.HUE) this.appendValueInput("INPUT") .appendField("Board led state") this.setPreviousStatement(true); this.setNextStatement(true) } }