Package com.ardublock.translator.block

Examples of com.ardublock.translator.block.TranslatorBlock


  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


      String Din ;
      String Cs ;
      String Clk ;
      String Brightness;
     
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Din = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
      Cs = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
      Clk = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
      Brightness = translatorBlock.toCode();
     
      String ret = "mesLeds"+Din+Cs+Clk+".setBrightness("+Brightness+");";
     
      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 + ".noBlink();\n";
    return ret;
  }
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_DIGITAL},";


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

      String Pin2 ;
      String Pin3 ;
      String Pin4 ;
      String Stepperround;
           
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Pin1 = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
      Pin2 = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
      Pin3 = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
      Pin4 = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(4);
      Stepperround = translatorBlock.toCode();
     
     
      translator.addHeaderFile("Stepper.h");
      translator.addDefinitionCommand("int nbrDePasParTour"+Pin1+" = "+Stepperround+";\n"+
      "Stepper monMoteur"+Pin1+Pin2+Pin3+Pin4+"(nbrDePasParTour"+Pin1+","+Pin1+","+Pin2+","+Pin3+","+Pin4+");");
View Full Code Here

    Util.setupEnv(translator);

    String ret;
    String strVar;

    TranslatorBlock childBlock;

    ret = "DBG_BEGIN(9600);\n\n";

    childBlock = getTranslatorBlockAtSocket(0);

    if (childBlock != null)
    {
      ret += "Drawing.setWakeCondition(" + childBlock.toCode() + ");\n";
    }

    childBlock = getTranslatorBlockAtSocket(1);
    if (childBlock != null)
    {
      ret += "Drawing.setDuration(" + childBlock.toCode() + ");\n";
    }

   
    ret += "\n" + "PaletteRuleConfigRec_stru ruleTbl[]={";

    childBlock = getTranslatorBlockAtSocket(2);
    while (childBlock != null)
    {
      strVar = childBlock.toCode();

      if ( strVar.length() > 5 )
      {
        ret += "{" + strVar + "},";
      }
     
      childBlock = childBlock.nextTranslatorBlock();
    }
   
    ret += "};\n";

    ret += "\n";
View Full Code Here

 
  //@Override
    public String toCode() throws SocketNullException, SubroutineNotDeclaredException
    {
      String speed;
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      speed = translatorBlock.toCode();
     
     
      translator.addHeaderFile("Wire.h");
      translator.addHeaderFile("MotorI2C.h");
      translator.addDefinitionCommand("//libraries at http://www.duinoedu.com/\nMotorI2C mesMoteurs;");
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

  @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 = "UART";
    }

    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_INDEX(" + childBlock.toCode() + ")";
    }

    actuatorParaDef += "};";

   
View Full Code Here

    {
      String Pin ;
      String NbLed;
      String NEO_KHZ800;
      String NEO_RGB;
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Pin = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
      NbLed = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
      NEO_KHZ800 = translatorBlock.toCode();
      translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
      NEO_RGB = translatorBlock.toCode();
     
      translator.addHeaderFile("Adafruit_NeoPixel.h");
      translator.addDefinitionCommand("Adafruit_NeoPixel monRuban_pin"+Pin+" = Adafruit_NeoPixel("+NbLed+","+ Pin +", " +NEO_RGB+ " + "+NEO_KHZ800 +");");
      translator.addSetupCommand("monRuban_pin"+Pin+".brancher();\n" +
      "monRuban_pin"+Pin+".afficher();");
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.