title: Sending the text from Arduino to iphone using bluetooth, i can not take a character.value
body: <p>Purpose : Arduino sends a sensor value to iphone application.</p>
  
  <p>Problem:
  I made a BlueTooth application which could connect with Arduino. 
  I successed very sometimes like [Fig 4].
  But I could not take a string from arduino. 
  I could get just “&lt;00>” or clear space.</p>
  
  <p>What I have to revise my application?
  I have to change Arduino first? Or my ios source code?</p>
  
  <p>[Fig 1] is Arduino Bluetooth source code => (Bluetooth is bluetooth 4.0)</p>
  
  <pre><code>#include &lt;SoftwareSerial.h&gt;
  
  int blueTx = 6; 
  int blueRx = 7; 
  
  SoftwareSerial BTSerial(blueRx,blueTx); //connect HC-10 TX, RX
  
  void setup() {
    Serial.begin(9600);
    Serial.println("hello world");      
    BTSerial.begin(9600);
    Serial.println("BTSerial begin");
  }
  
  void loop() {
    while(BTSerial.available())
    {
  
      BTSerial.println("hello world");
      BTSerial.write("BTSerial is open!");
    }
  }
  </code></pre>
  
  <p>[Fig 2] is Xcode Log</p>
  
  <pre><code>2015-09-24 15:58:52.822 Arduino_BLE test1[1727:734383] STATE - Power On
  2015-09-24 15:58:52.822 Arduino_BLE test1[1727:734383] SCAN - Scanning
  2015-09-24 15:58:52.873 Arduino_BLE test1[1727:734383] DISCOVER - Discover : &lt;CBPeripheral: 0x135537f00, identifier = B4A88537-AF01-B403-AA32-F2C84464CFE6, name = HMSoft, state = disconnected&gt;
  2015-09-24 15:58:52.873 Arduino_BLE test1[1727:734383] DISCOVER - Connecting to peripheral &lt;CBPeripheral: 0x135537f00, identifier = B4A88537-AF01-B403-AA32-F2C84464CFE6, name = HMSoft, state = connecting&gt;
  2015-09-24 15:58:53.015 Arduino_BLE test1[1727:734383] CONNECT - To HMSoft
  2015-09-24 15:58:53.016 Arduino_BLE test1[1727:734383] CONNECT - Scanning stoped
  2015-09-24 15:58:53.301 Arduino_BLE test1[1727:734383] DISCOVER_SERVICE - Service : &lt;CBService: 0x13556ae90, isPrimary = YES, UUID = FFE0&gt;
  2015-09-24 15:58:53.421 Arduino_BLE test1[1727:734383] DISCOVER_CHAR - Characteristic : &lt;CBCharacteristic: 0x135673ce0, UUID = FFE1, properties = 0x16, value = (null), notifying = NO&gt;
  2015-09-24 15:58:53.481 Arduino_BLE test1[1727:734383] UPDATE_VALUE - start
  2015-09-24 15:58:53.481 Arduino_BLE test1[1727:734383] UPDATA_VALUE - stringFromData : 
  2015-09-24 15:58:53.481 Arduino_BLE test1[1727:734383] UPDATA_VALUE - data : &lt;00&gt;
  2015-09-24 15:58:53.691 Arduino_BLE test1[1727:734383] NOTIFY - Notification start
  2015-09-24 15:58:53.691 Arduino_BLE test1[1727:734383] NOTIFY - Notification began on &lt;CBCharacteristic: 0x135673ce0, UUID = FFE1, properties = 0x16, value = &lt;00&gt;, notifying = YES&gt;
  2015-09-24 15:58:53.691 Arduino_BLE test1[1727:734383] NOTIFY - stringFromData : 
  </code></pre>
  
  <p>[Fig 3] is what I wrote source code for Bluetooth network.</p>
  
  <pre><code>//DISCOVER CHAR
  -(void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
  {
      if (error) {NSLog(@"DISCOVER_CHAR - Error");return;}
  
      for (CBCharacteristic * characteristic in service.characteristics) {
          NSLog(@"DISCOVER_CHAR - Characteristic : %@",characteristic);
          [peripheral readValueForCharacteristic:characteristic];
          [peripheral setNotifyValue:YES forCharacteristic:characteristic];
      }
  }
  
  //INTERACT
  //READ
  -(void)peripheral:(CBPeripheral *)peripheral
  didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic
              error:(NSError *)error
  {
      NSLog(@"UPDATE_VALUE - start");
      NSString *stringFromData = [[NSString alloc]initWithData:characteristic.value encoding:NSUTF8StringEncoding];
      NSLog(@"UPDATA_VALUE - stringFromData : %@", stringFromData);
  
      [_data appendData:characteristic.value];
      NSLog(@"UPDATA_VALUE - data : %@",_data);
  }
  </code></pre>
  
  <p>[Fig 4] is what I Succeed before. But ….. I can not do it again</p>
  
  <pre><code>UPDATA_VALUE - start
  UPDATA_VALUE - stringFromData :
  UPDATA_VALUE - stringFromData :&lt;00&gt;
  UPDATA_VALUE - start    
  UPDATA_VALUE - stringFromData :hello world
  
  BTSeria
  UPDATA_VALUE - stringFromData:&lt;0068656c 6c6f2077 6f726c64 0d0a4254 53657269 61&gt;
  UPDATA_VALUE - start
  UPDATA_VALUE - stringFromData :l begin
  
  UPDATA_VALUE - stringFromData :&lt;0068656c 6c6f2077 6f726c64 0d0a4254 53657269 616c2062 6567696e 0d0a&gt;
  </code></pre>