{"componentChunkName":"component---src-templates-blog-post-js","path":"/posts/stm32discovery_5/","result":{"data":{"markdownRemark":{"html":"<p>I had quite a few struggles getting BLE to work, until I finally decided to test out an Arduino (shudder) example of the BLE implemention on the B-L475E. Hopefully, insights gleaed from this will point me in the right direction for the manual implementation of the BLE library. The working example is located here: <a href=\"https://github.com/stm32duino/STM32Examples/blob/master/examples/Boards/STM32L475VG-DISCOVERY-IOT/BTLE_sensors_TimeOfFlight_demo/BTLE_sensors_TimeOfFlight_demo.ino\">https://github.com/stm32duino/STM32Examples/blob/master/examples/Boards/STM32L475VG-DISCOVERY-IOT/BTLE_sensors_TimeOfFlight_demo/BTLE_sensors_TimeOfFlight_demo.ino</a></p>\n<p>There are a few dependencies to get this working. In <code>main.cpp</code>, there is a set of comments on the top pointing you to the driver libraries, and of course, you need the SPBTLE-RF library, which depends upon Arduino.h.</p>\n<p><img src=\"https://raw.githubusercontent.com/simjxu/simjxu.github.io/gh-pages/img/SPBTLE-RF_lib.jpg\" alt=\"SPBTLE-lib\"></p>\n<p>Inside this example, the top level function that publishes the data to BLE is the function called  <code>update_environment_data</code></p>\n<pre><code class=\"language-cpp\">void update_environment_data(){\n  float humidity, temperature;\n  float pressure, temperature_lps22hb;\n\n  HumTemp->GetHumidity(&#x26;humidity);\n  HumTemp->GetTemperature(&#x26;temperature);\n\n  PressTemp->GetPressure(&#x26;pressure);\n  PressTemp->GetTemperature(&#x26;temperature_lps22hb);\n\n  //Update environnemental data\n  SensorService.Temp_Update(temperature*10);\n  SensorService.Press_Update(pressure*100);\n  SensorService.Humidity_Update(humidity*10);\n}\n</code></pre>\n<p>Once I load the firmware onto the device, I am able to use the LightBlue mobile app from PunchThrough to observe these three characteristics. You can see below that the humidity is 59.3% (593/10) and the temperature is 23.4 deg C (234/10).</p>\n<p><img src=\"https://raw.githubusercontent.com/simjxu/simjxu.github.io/gh-pages/img/lightblue_att.jpg\" alt=\"temp-humid-ble\"></p>","frontmatter":{"title":"B-L475E-IOT01A - Getting started on BlueNRG BLE"}}},"pageContext":{"slug":"/posts/stm32discovery_5/"}},"staticQueryHashes":["3649515864"]}