text: 
  
  Blockly.Arduino['io_highlow'] = function () {
      // Boolean values HIGH and LOW.
      var code = (this.getFieldValue('BOOL') == 'HIGH') ? 'HIGH' : 'LOW';
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_pinMode'] = function () 
  {
      //var dropdown_pin = Blockly.Arduino.valueToCode(this, "PIN", Blockly.Arduino.ORDER_ATOMIC);
  	var dropdown_pin = this.getFieldValue('PIN');
      var dropdown_mode = this.getFieldValue('STAT');
      var code = 'pinMode(' + dropdown_pin + ', ' + dropdown_mode + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_pinMode2'] = function () 
  {
      //var dropdown_pin = Blockly.Arduino.valueToCode(this, "PIN", Blockly.Arduino.ORDER_ATOMIC);
  	var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_mode = this.getFieldValue('STAT');
      var code = 'pinMode(' + dropdown_pin + ', ' + dropdown_mode + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_digital_write'] = function () 
  {
      var dropdown_pin = this.getFieldValue('PIN');
      var dropdown_stat = this.getFieldValue('STAT');
      Blockly.Arduino.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);';
      var code = 'digitalWrite(' + dropdown_pin + ',' + dropdown_stat + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_digital_write2'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_stat = Blockly.Arduino.valueToCode(this, 'STAT', Blockly.Arduino.ORDER_ATOMIC);
      var code = "";
  	
      if (window.isNaN(dropdown_pin)) 
  	{
          code = code + 'pinMode(' + dropdown_pin + ', OUTPUT);\n';
      } 
  	else 
  	{
          if (Blockly.Arduino.setups_['setup_input_' + dropdown_pin])
              delete Blockly.Arduino.setups_['setup_input_' + dropdown_pin];
          Blockly.Arduino.setups_['setup_output_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', OUTPUT);';
  
      }
  	
      code += 'digitalWrite(' + dropdown_pin + ',' + dropdown_stat + ');\n'
  	
      return code;
  };
  
  Blockly.Arduino['io_digital_write3'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_stat = Blockly.Arduino.valueToCode(this, 'STAT', Blockly.Arduino.ORDER_ATOMIC);
      var code = "";
  	
      code += 'digitalWrite(' + dropdown_pin + ',' + dropdown_stat + ');\n'
  	
      return code;
  };
  
  Blockly.Arduino['io_digital_read2'] = function () 
  {
      /*var dropdown_pin = this.getFieldValue('PIN');
  	
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
  	
      var code = 'digitalRead(' + dropdown_pin + ')';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];*/
  	
  	var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_input_'+dropdown_pin] = 'pinMode('+dropdown_pin+', INPUT);';
      var code = 'digitalRead(' + dropdown_pin + ')';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_analog_write'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //var dropdown_stat = this.getFieldValue('STAT');
      var value_num = Blockly.Arduino.valueToCode(this, 'NUM', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_output'+dropdown_pin] = 'pinMode('+dropdown_pin+', OUTPUT);';
      var code = 'analogWrite(' + dropdown_pin + ',' + value_num + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_analog_write2'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //var dropdown_stat = this.getFieldValue('STAT');
      var value_num = Blockly.Arduino.valueToCode(this, 'NUM', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_output'+dropdown_pin] = 'pinMode('+dropdown_pin+', OUTPUT);';
      var code = 'analogWrite(' + dropdown_pin + ',' + value_num + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_pwm_write'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //var dropdown_stat = this.getFieldValue('STAT');
      var value_num = Blockly.Arduino.valueToCode(this, 'NUM', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_output'+dropdown_pin] = 'pinMode('+dropdown_pin+', OUTPUT);';
      var code = 'analogWrite(' + dropdown_pin + ',' + value_num + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_pwm_write2'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //var dropdown_stat = this.getFieldValue('STAT');
      var value_num = Blockly.Arduino.valueToCode(this, 'NUM', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_output'+dropdown_pin] = 'pinMode('+dropdown_pin+', OUTPUT);';
      var code = 'analogWrite(' + dropdown_pin + ',' + value_num + ');\n';
  	
      return code;
  };
  
  Blockly.Arduino['io_analog_read'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      //Blockly.Arduino.setups_['setup_input_'+dropdown_pin] = 'pinMode('+dropdown_pin+', INPUT);';
      var code = 'analogRead(' + dropdown_pin + ')';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_cap_read'] = function () 
  {
  
  	var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var code = 'touch.readCapacitivePin(' + dropdown_pin + ')';
  	
  	Blockly.Arduino.definitions_['cap'] = '#include <BD_Touch.h>\n\nBD_Touch touch;\n';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_buildin_led'] = function () 
  {
      var dropdown_stat = this.getFieldValue('STAT');
      Blockly.Arduino.setups_['setup_output_13'] = 'pinMode(13, OUTPUT);';
      var code = 'digitalWrite(13,' + dropdown_stat + ');\n';
  	
      return code;
  };
  
  
  Blockly.Arduino['io_attachInterrupt'] = function (block) 
  {
      var dropdown_pin = block.getFieldValue('PIN');
      var dropdown_mode = this.getFieldValue('mode');
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString();
      var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')';
      var code = 'attachInterrupt' + '(' + interrupt_pin + ',' + 'attachInterrupt_fun_' + dropdown_pin + ',' + dropdown_mode + ');\n'
      var funcName = 'attachInterrupt_fun_' + dropdown_pin;
      var branch = Blockly.Arduino.statementToCode(this, 'do');
      var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n';
      Blockly.Arduino.definitions_[funcName] = code2;
  	
      return code;
  };
  
  
  Blockly.Arduino['io_detachInterrupt'] = function(block) 
  {
  	var dropdown_pin = this.getFieldValue("PIN");
  	var code = 'detachInterrupt(digitalPinToInterrupt(' + dropdown_pin +'));\n'
    
  	return code;
  };
  
  /*
  Blockly.Arduino['io_attachInterrupt'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_mode = this.getFieldValue('mode');
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString();
      var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')';
      var code = 'attachInterrupt' + '(' + interrupt_pin + ',' + 'attachInterrupt_fun_' + dropdown_pin + ',' + dropdown_mode + ');\n'
      var funcName = 'attachInterrupt_fun_' + dropdown_pin;
      var branch = Blockly.Arduino.statementToCode(this, 'DO');
      var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n';
      Blockly.Arduino.definitions_[funcName] = code2;
  	
      return code;
  };
  */
  
  /*
  Blockly.Arduino['io_detachInterrupt'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString();
      var interrupt_pin = 'digitalPinToInterrupt(' + dropdown_pin + ')';
      var code = 'detachInterrupt' + '(' + interrupt_pin + ');\n';
  	
      return code;
  };
  */
  
  Blockly.Arduino['io_attachPinInterrupt'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_mode = this.getFieldValue('mode');
      Blockly.Arduino.definitions_['pin_interrupt'] = '#include <PinChangeInt.h>';
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString();
      var code = 'PCintPort::attachInterrupt' + '(' + dropdown_pin + ',' + 'attachPinInterrupt_fun_' + dropdown_pin + ',' + dropdown_mode + ');\n'
      var funcName = 'attachPinInterrupt_fun_' + dropdown_pin;
      var branch = Blockly.Arduino.statementToCode(this, 'DO');
      var code2 = 'void' + ' ' + funcName + '() {\n' + branch + '}\n';
      Blockly.Arduino.definitions_[funcName] = code2;
  	
      return code;
  };
  
  Blockly.Arduino['io_detachPinInterrupt'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      //var interrupt_pin=digitalPinToInterrupt(dropdown_pin).toString();
      var code = 'PCintPort::detachInterrupt' + '(' + dropdown_pin + ');\n';
  	
      return code;
  };
  
  
  Blockly.Arduino['io_pulseIn'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_stat = this.getFieldValue('STAT');
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      var code = 'pulseIn(' + dropdown_pin + ', ' + dropdown_stat + ')';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_pulseIn2'] = function () 
  {
      var dropdown_pin = Blockly.Arduino.valueToCode(this, 'PIN', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_stat = this.getFieldValue('STAT');
      var timeout = Blockly.Arduino.valueToCode(this, 'TIMEOUT', Blockly.Arduino.ORDER_ATOMIC) || '0';
      Blockly.Arduino.setups_['setup_input_' + dropdown_pin] = 'pinMode(' + dropdown_pin + ', INPUT);';
      var code = 'pulseIn(' + dropdown_pin + ', ' + dropdown_stat + ', ' + timeout + ')';
  	
      return [code, Blockly.Arduino.ORDER_ATOMIC];
  };
  
  Blockly.Arduino['io_shiftout'] = function () 
  {
      var dropdown_pin1 = Blockly.Arduino.valueToCode(this, 'PIN1', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_pin2 = Blockly.Arduino.valueToCode(this, 'PIN2', Blockly.Arduino.ORDER_ATOMIC);
      var dropdown_order = this.getFieldValue('ORDER');
      var value = Blockly.Arduino.valueToCode(this, 'DATA', Blockly.Arduino.ORDER_ATOMIC) || '0';
      Blockly.Arduino.setups_['setup_output_' + dropdown_pin1] = 'pinMode(' + dropdown_pin1 + ', OUTPUT);';
      Blockly.Arduino.setups_['setup_output_' + dropdown_pin2] = 'pinMode(' + dropdown_pin2 + ', OUTPUT);';
      var code = 'shiftOut(' + dropdown_pin1 + ',' + dropdown_pin2 + ',' + dropdown_order + ',' + value + ');\n';
  	
      return code;
  };