Package com.ardublock.translator.block

Examples of com.ardublock.translator.block.TranslatorBlock


  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    translator.addDefinitionCommand(ARDUBLOCK_MOTOR_DEFINITION);
   
    String ret = "__ardublock_xinchejian_ms( ";
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0);
    ret = ret + tb.toCode();
    ret = ret + " , true, ";
    tb = this.getRequiredTranslatorBlockAtSocket(1);
    ret = ret + tb.toCode();
    ret = ret + " );\n";
   
    return ret;
  }
View Full Code Here


  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    translator.addDefinitionCommand(XinchejianMotorForwardBlock.ARDUBLOCK_MOTOR_DEFINITION);
   
    String ret = "__ardublock_xinchejian_ms( ";
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0);
    ret = ret + tb.toCode();
    ret = ret + " , false, ";
    tb = this.getRequiredTranslatorBlockAtSocket(1);
    ret = ret + tb.toCode();
    ret = ret + " );\n";
   
    return ret;
  }
View Full Code Here

  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    translator.addDefinitionCommand(XinchejianDigitalReadBlock.XINCHEJIAN_DIGITAL_IO_DEFINITION);
   
    String ret = "__ardublock_xinchejian_ms_digitalWrite( ";
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0);
    ret = ret + tb.toCode();
    ret = ret + " , ";
    tb = this.getRequiredTranslatorBlockAtSocket(1);
    ret = ret + tb.toCode();
    ret = ret + " );\n";
    return ret;
  }
View Full Code Here

  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    translator.addDefinitionCommand(XINCHEJIAN_DIGITAL_IO_DEFINITION);
   
    String ret = "__ardublock_xinchejian_ms_digitalRead( ";
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0);
    ret = ret + tb.toCode();
    ret = ret +  " )";
    return codePrefix + ret + codeSuffix;
  }
View Full Code Here

  }
 
  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    if (translatorBlock instanceof TinkerInputPortBlock)
    {
      String tkButtonName = "tkButton_" + translatorBlock.toCode();
      translator.addDefinitionCommand("TKButton "+  tkButtonName + "(" + translatorBlock.toCode() + ");");
      return tkButtonName + ".get()";
    }
    else
    {
      if (translatorBlock instanceof NumberBlock)
      {
        String number;
        number = translatorBlock.toCode();
        String setupCode = "pinMode( " + number + " , INPUT);";
        translator.addSetupCommand(setupCode);
        String ret = "digitalRead( ";
        ret = ret + number;
        ret = ret + ")";
        return codePrefix + ret + codeSuffix;
      }
      else
      {
        translator.addDefinitionCommand(DigitalInputBlock.ARDUBLOCK_DIGITAL_READ_DEFINE);
        String ret = "__ardublockDigitalRead(";
       
        ret = ret + translatorBlock.toCode();
        ret = ret + ")";
        return codePrefix + ret + codeSuffix;
      }
    }
  }
View Full Code Here

  }

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    if (translatorBlock instanceof TinkerInputPortBlock)
    {
      String number = translatorBlock.toCode();
      return codePrefix + "( analogRead(" + number + ")>512?true:false)" + codeSuffix;
    }
    else
    {
      if (translatorBlock instanceof NumberBlock)
      {
        String number;
        number = translatorBlock.toCode();
        String setupCode = "pinMode( " + number + " , INPUT);";
        translator.addSetupCommand(setupCode);
        String ret = "digitalRead( ";
        ret = ret + number;
        ret = ret + ")";
        return codePrefix + ret + codeSuffix;
      }
      else
      {
        translator.addDefinitionCommand(DigitalInputBlock.ARDUBLOCK_DIGITAL_READ_DEFINE);
        String ret = "__ardublockDigitalRead(";
       
        ret = ret + translatorBlock.toCode();
        ret = ret + ")";
        return codePrefix + ret + codeSuffix;
      }
    }
  }
View Full Code Here

  //@Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
   
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(0);
    String I2C_addr = tb.toCode();
    String ret = "lcd_I2C_" + I2C_addr + ".setBacklight(LOW);\n";
    return ret;
  }
View Full Code Here

    public String toCode() throws SocketNullException, SubroutineNotDeclaredException
    {
      String Code;
      String Dial;
      String Value;
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Code = translatorBlock.toCode();
      TranslatorBlock translatorBlock1 = this.getRequiredTranslatorBlockAtSocket(1);
      Dial = translatorBlock1.toCode();
      TranslatorBlock translatorBlock2 = this.getRequiredTranslatorBlockAtSocket(2);
      Value = translatorBlock2.toCode();
     
     
     
     
      String ret =  "SerialOscillo.analogWrite("+ Code +",SUR_CADRAN"+Dial +","+Value +");";
View Full Code Here

   
    translator.addHeaderFile("keenlon.h");   
    translator.addDefinitionCommand("Motor motor;");
    translator.addSetupCommand("motor.init();");
   
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    String leftspeed = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    String rightspeed = translatorBlock.toCode();
   
    String ret = "motor.run(" + leftspeed + " , " + rightspeed + ");\n";
    return  ret;   
   
   
View Full Code Here

      String Pin ;
      String Pixel_Nb;
      String Red;
      String Blue;
      String Green;
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Pin = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
      Pixel_Nb = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
      Red = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
      Green = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(4);
      Blue = translatorBlock.toCode();
     
     
      String ret = "monRuban_pin"+Pin+".preparerPixel("+Pixel_Nb+","+Green+" ,"+Red+" ,"+Blue+" );\n";
     
      return codePrefix + ret + codeSuffix;
View Full Code Here

TOP

Related Classes of com.ardublock.translator.block.TranslatorBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.