123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /**
- * @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)
- }
- }
|