'use strict';

goog.provide('Blockly.Blocks.Lizard');

goog.require('Blockly.Blocks');


Blockly.Blocks.Lizard.HUE = "#00A6AD"; 
Blockly.Blocks.Lizard.Sensor = "#00A6AD";

var DF_MS=[["M1", "1"],["M2", "2"]];

var BUZZER_PORT =[["1", "1"],["2", "2"],["3", "3"],["4", "4"]];

//舵机



Blockly.Blocks.Lizard_duoji = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
        .appendTitle(Blockly.MIXLY_Lizard_SERVO_TEST)
.appendField(new Blockly.FieldImage("../../media/Lizard/lizard_duoji.png", 37, 32));
   this.appendValueInput("PIN", Number)
          .appendTitle(Blockly.MIXLY_Lizard_PIN)
       .setCheck(Number);
      this.appendDummyInput("")
      this.setPreviousStatement(true, null);
       this.setNextStatement(true, null);
      
}
};


Blockly.Blocks.Lizard_dj = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
  this.appendValueInput("PIN", Number)
        .appendField(Blockly.MIXLY_Lizard_SERVO_TEST)
        .appendField(Blockly.MIXLY_Lizard_PIN)
    this.appendValueInput("DEGREE", Number)
        .setCheck(Number)
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField(Blockly.MIXLY_Lizard_JIAODU);
    this.appendValueInput("DELAY_TIME", Number)
        .setCheck(Number)
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField(Blockly.MIXLY_DELAY+'('+Blockly.MIXLY_DELAY_MS+')');
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    //this.setTooltip(Blockly.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_MOVE);
  }
};






Blockly.Blocks.Lizard_Xiyi_jiaozhun = {
      init: function() {
      this.setColour(Blockly.Blocks.Lizard.Sensor);
       this.appendDummyInput("")
       .appendTitle(Blockly.MIXLY_Lizard_SERVO_ADJUST)
    
   this.appendDummyInput("")
      this.setPreviousStatement(true, null);
       this.setNextStatement(true, null);
      }
      };

Blockly.Blocks.Lizard_Xiyi_go={
init:function(){
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_FORWARD)
 
  this.appendValueInput("X", 'Number')
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendTitle(Blockly.MIXLY_Lizard_VEL);
      this.setPreviousStatement(true);
       this.setNextStatement(true);
     }
     };

Blockly.Blocks.Lizard_ir = {
      init: function() {
      this.setColour(Blockly.Blocks.Lizard.HUE);
       this.appendDummyInput("")
       .appendTitle(Blockly.MIXLY_Lizard_IRREV)
      this.appendValueInput("PIN", Number)
          .appendTitle(Blockly.MIXLY_Lizard_PIN)
       .setCheck(Number);
      this.appendDummyInput("")
      this.setPreviousStatement(true, null);
       this.setNextStatement(true, null);
      }
      };
      

Blockly.Blocks.Lizard_Xiyi_gg = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_FORWARD)
     
      .appendTitle(Blockly.MIXLY_Lizard_VEL)
      .appendTitle(new Blockly.FieldDropdown(BUZZER_PORT), "PIN");
 
   // this.setInputsInline(true);
   this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};

       Blockly.Blocks.Lizard_Xiyi_bb = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_BACKWARD)
   
      .appendTitle(Blockly.MIXLY_Lizard_TBVEL)
      .appendTitle(new Blockly.FieldDropdown(BUZZER_PORT), "PIN");
 
   // this.setInputsInline(true);
   this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};

   Blockly.Blocks.Lizard_Xiyi_cc = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_TURNINGLEFT)
 
      .appendTitle(Blockly.MIXLY_Lizard_TLVEL)
      .appendTitle(new Blockly.FieldDropdown(BUZZER_PORT), "PIN");
 
   // this.setInputsInline(true);
   this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};



  Blockly.Blocks.Lizard_Xiyi_dd = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.HUE);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_TURNINGRIGHT)
     
      .appendTitle(Blockly.MIXLY_Lizard_TRVEL)
      .appendTitle(new Blockly.FieldDropdown(BUZZER_PORT), "PIN");
 
   // this.setInputsInline(true);
   this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};


      
      Blockly.Blocks.Lizard_Xiyi_add = {
      init: function() {
      this.setColour(Blockly.Blocks.Lizard.Sensor);
       this.appendDummyInput("")
       .appendTitle(Blockly.MIXLY_Lizard_SERVO_ADD)
      .appendField(new Blockly.FieldImage("../../media/Lizard/Lizard_IRrev.png", 43, 32));
      this.appendDummyInput("")
      this.setPreviousStatement(true, null);
       this.setNextStatement(true, null);
      }
      };

      Blockly.Blocks.Lizard_Xiyi_sub = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.Sensor);
    this.appendDummyInput("")
      .appendTitle(Blockly.MIXLY_Lizard_SERVO_SUB)
      .appendField(new Blockly.FieldImage("../../media/Lizard/Lizard_IRrev.png", 50.5, 32))
      this.appendDummyInput("")
      this.setPreviousStatement(true, null);
      this.setNextStatement(true, null);
    }
     };

    Blockly.Blocks.lizard_move = {
  init: function() {
    this.setColour(Blockly.Blocks.Lizard.Sensor);
  this.appendValueInput("PIN", Number)
        .appendField(Blockly.MIXLY_Lizard_SERVO_TEST)
        .appendField(Blockly.MIXLY_Lizard_PIN)
        .setCheck(Number);
    
    this.setPreviousStatement(true, null);
    this.setNextStatement(true, null);
    this.setTooltip(Blockly.MIXLY_TOOLTIP_BLOCKGROUP_SERVO_MOVE);
  }
};



