Package com.ardublock.translator.block

Examples of com.ardublock.translator.block.TranslatorBlock


  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    setupRomeoMotorPin(translator);
   
    String ret = "setRomeoMotor(1, ";
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    ret += translatorBlock.toCode();
    ret += ");\n";
   
    ret += "setRomeoMotor(2, ";
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    ret += translatorBlock.toCode();
    ret += ");\n";

    return ret;
  }
View Full Code Here


  //@Override
    public String toCode() throws SocketNullException, SubroutineNotDeclaredException
    {
      String Pin ;

      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Pin = translatorBlock.toCode();
     
     
      String ret = "monRuban_pin"+Pin+".afficher();\n";
     
      return codePrefix + ret + codeSuffix;
View Full Code Here

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret, pin, varName, actuatorParaDef;
    TranslatorBlock childBlock; 


    childBlock = getRequiredTranslatorBlockAtSocket(0);
    if (childBlock != null)
    {
      pin = childBlock.toCode();
    }
    else
    {
      pin = "?";
    }

    varName = "aPara" + pin;

    varName = translator.buildVariableName(varName);
 
    actuatorParaDef = "byte " + varName + "[]={";

    childBlock = getTranslatorBlockAtSocket(1);
    if (childBlock != null)
    {
      actuatorParaDef += "PARATYPE_RUNMETHOD(" + childBlock.toCode() + ")";
    }

    actuatorParaDef += "};";

   
View Full Code Here

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret;
    TranslatorBlock childBlock; 

    ret = "{";

    childBlock = getRequiredTranslatorBlockAtSocket(0);
    if (childBlock != null)
    {
      ret += childBlock.toCode();
    }
    else
    {
      ret += "?";
    }

    ret += ",FUNCTION_SENSOR_ANALOG},";

    childBlock = getTranslatorBlockAtSocket(2);
    if (childBlock != null)
    {
      ret += childBlock.toCode() + ",";
    }
    else
    {
      ret += "?,";
    }


    childBlock = getTranslatorBlockAtSocket(1);
    if (childBlock != null)
    {
      ret += childBlock.toCode();
    }
    else
    {
      ret += "?";
    }
View Full Code Here

  }

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    if (!(translatorBlock instanceof NumberBlock))
    {
      throw new BlockException(this.blockId, "the Pin# of dht11 must a number");
    }
   
View Full Code Here

  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String Pin1;
    String Pin2;
    String Code;
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    Pin1 = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    Pin2 = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
    Code = translatorBlock.toCode();


    translator.addHeaderFile("RFID125.h");
    translator.addHeaderFile("SoftwareSerial.h");
    translator.addDefinitionCommand("//libraries at http://www.duinoedu.com/\nRFID125 monRFID;");
View Full Code Here

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret = "";
    TranslatorBlock childBlock; 

    childBlock = getTranslatorBlockAtSocket(0);
    if (childBlock != null)
    {
      ret += childBlock.toCode() + ",";

      if ( label.equalsIgnoreCase("Sleep") )
      {
        ret += "ACTION_SYS_SLEEP";
      }
      else
      {

        if ( label.equalsIgnoreCase("Start") )
        {
          ret += "ACTION_RUN,";
        }
        else  //Stop
        {
          ret += "ACTION_STOP,";
        }
       
        childBlock = getTranslatorBlockAtSocket(1);
        if (childBlock != null)
        {
          ret += "{" + childBlock.toCode() + "}";
        }
        else
        {
          ret ="";
        }
View Full Code Here

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    translator.addDefinitionCommand(AB_SOUND_FUN_DEFINE);
    String ret = "getSoundValue(";
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    ret = ret + translatorBlock.toCode();
    ret = ret + ")";
    return codePrefix + ret + codeSuffix;
  }
View Full Code Here

  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    RomeoMotorsBlock.setupRomeoMotorPin(translator);
   
    String ret = "setRomeoMotor(";
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    ret += translatorBlock.toCode();
    ret += ", ";
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    ret += translatorBlock.toCode();
    ret += ");\n";

    return ret;
  }
View Full Code Here

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret, pin, varName, actuatorParaDef;
    TranslatorBlock childBlock; 


    childBlock = getRequiredTranslatorBlockAtSocket(0);
    if (childBlock != null)
    {
      pin = childBlock.toCode();
    }
    else
    {
      pin = "?";
    }

    varName = "aPara" + pin;
   
    varName = translator.buildVariableName(varName);
 
    actuatorParaDef = "byte " + varName + "[]={";

    childBlock = getTranslatorBlockAtSocket(1);
    if (childBlock != null)
    {
      actuatorParaDef += "PARATYPE_RUNMETHOD(" + childBlock.toCode() + "),";
    }

    childBlock = getTranslatorBlockAtSocket(2);
    if (childBlock != null)
    {
      actuatorParaDef += "PARATYPE_PERIOD(" + childBlock.toCode() + ")";
    }

    actuatorParaDef += "};";

   
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.