Package com.ardublock.translator.block

Examples of com.ardublock.translator.block.TranslatorBlock


  }

  //@Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    TranslatorBlock tb = this.getRequiredTranslatorBlockAtSocket(1);
    String lineNo = tb.toCode();
    tb = this.getRequiredTranslatorBlockAtSocket(2);
    String charNo = tb.toCode();
    tb = this.getRequiredTranslatorBlockAtSocket(3);
    String parallel_addr = tb.toCode(); //Usually resolves to "Parallel" but could be something else.
   
    String ret = "";
    if ( !(charNo.equals("0") && lineNo.equals("0")) ){
      // Retain the apparently daft 'lcd_I2C' part of the name so LCD_COMMAND block will work on this display too.
      ret = "lcd_I2C_" + parallel_addr + ".setCursor( (" + charNo + ") - 1, (" + lineNo + ") - 1 );";
    }
   
    tb = this.getRequiredTranslatorBlockAtSocket(0, "lcd_I2C_"+ parallel_addr + ".print( ", " );\n");
    ret += tb.toCode();
    //Deal with line and character positioning
    translator.addHeaderFile("Wire.h");
    translator.addHeaderFile("LCD.h");
    translator.addHeaderFile("LiquidCrystal.h");
    translator.addDefinitionCommand(             "// For these LCD controls to work you MUST replace the standard LCD library with 'New LCD' from...");
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 + ".noCursor();\n";
    return ret;
  }
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 + ".home();\n";
    return ret;
  }
View Full Code Here

 
  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret = "analogRead(";
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    if (translatorBlock instanceof NumberBlock)
    {
      ret = ret + "A";
      ret = ret + translatorBlock.toCode();
      ret = ret + ")";
      return codePrefix + ret + codeSuffix;
    }
    else
    {
      if (translatorBlock instanceof TinkerInputPortBlock)
      {
        ret = ret + translatorBlock.toCode();
        ret = ret + ")";
        return codePrefix + ret + codeSuffix;
      }
      else
      {
View Full Code Here

  }

  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    String ret = "";
   
    if (translatorBlock instanceof NumberBlock || translatorBlock instanceof TinkerOutputPortBlock)
    {
      String number = translatorBlock.toCode();
      String setupCode = "pinMode( " + number + " , OUTPUT);";
      translator.addSetupCommand(setupCode);
     
      ret = "digitalWrite( ";
      ret = ret + number;
    }
    else
    {
      translator.addDefinitionCommand(DigitalOutputBlock.ARDUBLOCK_DIGITAL_WRITE_DEFINE);
      ret = "__ardublockDigitalWrite(";
     
      ret = ret + translatorBlock.toCode();
    }
   
    ret = ret + " , ";
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    ret = ret + translatorBlock.toCode();
    ret = ret + " );\n";
    return ret;
  }
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 + ".clear();\n";
    return ret;
  }
View Full Code Here

 
  @Override
  public String toCode() throws SocketNullException, SubroutineNotDeclaredException
  {
    String ret = "analogWrite(";
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    String outputPin = translatorBlock.toCode();
    ret = ret + outputPin;
    ret = ret + ", ";
   
    translator.addSetupCommand("pinMode(" + outputPin +  ", OUTPUT);");
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    ret = ret + translatorBlock.toCode();
    ret = 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+".effacerTout()\n";
     
      return codePrefix + ret + codeSuffix;
View Full Code Here

 
  //@Override
    public String toCode() throws SocketNullException, SubroutineNotDeclaredException
    {
      String Nb_Dial;
      TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
      Nb_Dial = translatorBlock.toCode();
     
     
      translator.addHeaderFile("SerialOSCILLO.h");
     
      translator.addDefinitionCommand("//libraries at http://www.duinoedu.com/");
View Full Code Here

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

    String Code;
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    Code = translatorBlock.toCode();

    translator.addHeaderFile("RFID125.h");
    translator.addHeaderFile("SoftwareSerial.h");
    translator.addDefinitionCommand("//libraries at http://www.duinoedu.com/\nRFID125 monRFID;");
    String ret = "monRFID.testerCode("+Code+")";
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.