title: Sending few values at the same time over bluetooth
body: <p>I am working on a Bluetooth based application and I am having problems when I try to send data from the iPhone to the other device.</p>
  
  <p>I have no problem when I have to send just one value, using something like this:</p>
  
  <pre><code>- (void)sendData:(NSInteger)mel {
      NSData *myData = [NSData dataWithBytes:&amp;mel length:sizeof(mel)];
      [self.myDevice writeValue:myData forCharacteristic:self.myCharacteristic type:CBCharacteristicWriteWithoutResponse];
  }
  </code></pre>
  
  <p>But, for some characteristics I need send 2 or more values at the same time (for example in this case, variable mel and another one) but I haven’t been able yet to do it.</p>
  
  <p>Does somebody know how to do this? Thanks in advance.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>What I tried to send two values is</p>
  
  <pre><code>unsigned char bytes[] = {mel, interval};
  NSMutableData *myData = [NSMutableData new];
  [myData appendBytes:&amp;bytes length:sizeof(bytes)];
  [self.myDevice writeValue:myData forCharacteristic:self.myCharacteristic type:CBCharacteristicWriteWithoutResponse];
  </code></pre>
  
  <p>But this works like if the second value didn't exist</p>