title: Bluetooth Low Energy: Read/Write to sensors attached to RedBearLab Shield
body: <p>I have the RedBearLab BLE shield connected to Arduino UNO R3. I can connect to it using gatttool from a Rasp-Pi (attached CSR4.0 dongle). I have some sensors (FSR) connected to the analog pin and LED connected to digital pin in Arduino. My goal is to read/write to anything that is connected to the Arduino through BLE. </p>
  
  <p>As a sample, I was looking into this <a href="http://joost.damad.be/2013/08/experiments-with-bluetooth-low-energy.html" rel="nofollow">link</a>. It seems I need to know the handle of the sensor, config register # etc. to read/write.But I am not sure how to find the handle/uuid related to the sensor that is attached to the shield. </p>
  
  <p>For example I see below.</p>
  
  <pre><code>[xx:xx:xx:xx:xx:xx][LE]&gt; char-desc
  handle: 0x0001, uuid: 2800
  handle: 0x0002, uuid: 2803
  handle: 0x0003, uuid: 2a00
  handle: 0x0004, uuid: 2803
  handle: 0x0005, uuid: 2a01
  handle: 0x0006, uuid: 2803
  handle: 0x0007, uuid: 2a04
  handle: 0x0008, uuid: 2800
  handle: 0x0009, uuid: 2800
  handle: 0x000a, uuid: 2803
  handle: 0x000b, uuid: 713d0003-503e-4c75-ba94-3148f18d941e
  handle: 0x000c, uuid: 2803
  handle: 0x000d, uuid: 713d0002-503e-4c75-ba94-3148f18d941e
  handle: 0x000e, uuid: 2902
  handle: 0x000f, uuid: 2800
  handle: 0x0010, uuid: 2803
  handle: 0x0011, uuid: 2a27    
  Discover descriptors finished: No attribute found within the given range
  [xx:xx:xx:xx:xx:xx][LE]&gt; char-read-hnd 0x0001
  Characteristic value/descriptor: 00 18
  [xx:xx:xx:xx:xx:xx][LE]&gt; char-read-hnd 0x000b
  Error: Characteristic value/descriptor read failed: Attribute can't be read
  </code></pre>
  
  <p>How do I know which of them is the FSR I have attached to the shield?</p>
  
  <h2>update</h2>
  
  <p>I am using RedBearLab example - <a href="https://github.com/RedBearLab/BLEShield/tree/master/Arduino/libraries/RBL_BLEShield/examples/SimpleControls" rel="nofollow">simplecontrol</a></p>
  
  <p>So Arduino and iOS/Android code both are there. My goal is to understand from gatttool's perspective so I can develop something similar (of iOS/Android) in Java running at Raspberry Pi.</p>
  
  <p>From the code, I can figure out which address to write. For example - to turn on the LED attached to the digital out pin, below works</p>
  
  <p>char-write-cmd 0x000b 010100</p>
  
  <p>Similarly, to turn on the sensor reading capability, I need to write below</p>
  
  <p>char-write-cmd 0x000b A00100</p>
  
  <p>I know this works. I see expected output in the Arduino serial monitor. I am pretty sure it is reading the sensor but I can't see that in the RaspPi prompt. I think I need to enable broadcast reading capability at RaspPi end.</p>
  
  <p>Any suggestion?</p>