O'Reilly logo

Raspberry Pi Android Projects by Gökhan Kurt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a sensor service to Bluetooth Low Energy

We will add a new service to the already existing example from Gatt. This new service will publish two new characteristics to begin with: one for humidity and the other for temperature measurements. We will read the measurements the same way using the techniques we've discussed in Chapter 2, Server Management with Pi. To read these measurements, we will create two new files with content similar to the sense.py file that we discussed Chapter 2, Server Management with Pi. Let's create two files under the home directory, and name them humidity.py and temperature.py. The temperature.py file has the following content:

#!/usr/bin/python import sys import Adafruit_DHT humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required