Saturday, September 6, 2014

My Take on the RFduino Temperature Example for Windows 7

One of the examples that comes with the RFduino is an example which reads the RFduino’s core temperature via BLE.  This is my take on that example running under Windows 7 using the BLED112 and BGLib.  The output is just text and not the nice graphics of the IOS RFduino example but it should get the idea across.

One change I made to the sketch running on the RFduino is to only update the temperature if it changes.  This allows the program running on the Windows PC to set the notify attribute and have the RFduino send a notification with the new temperature when it changes.

I found this program not a really good example of using notify because the core temperature doesn’t appear to change too often.  However, it shows all the steps necessary to utilize the notify BLE feature with the RFduino and BLED112.

The code for this example can be found on GitHub in the dhRFduino repository under digitalhack.

For a step by step example of getting this to run under windows see the post on RFduino and BLED112, Putting It All Together but substitute the TemperatureExample sketch and windows program for the ReadValueExample sketch and windows program.

This example uses a soft reset for the BLED112 and has timeouts implemented in a slightly different way than the ReadValueExample.

As always I hope you find this helpful and thanks to Bluegiga and RFduino because without their products none of this would be possible.

If you find something that doesn’t work for you or you have questions please post them as comments and I will get back to you as soon as I can.

2 comments:

Pero said...

First of all great series of post! You really did a breaktrough in this BLE+Rfduino communication! Thank you for that!


Second, if I wanted to modify this program to initate communication with RFduino and than patiently wait till RFduino sends something, print that out and finally close the communication what should I do?

digitalhack said...

Pero,

What you are looking to do is basically what this example does. If you were to add loop = 0; to blte_notify_event it would print out the temperature once and then disconnect from the
RFduino and then exit.

Hope this helps,

digitalhack