O'Reilly logo

Make: Arduino Bots and Gadgets by Kimmo Karvinen, Tero Karvinen

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

Appendix A. tBlue Library for Android

In the Bluetooth examples you’ve seen in this book, the interactions have been simple: opening a connection and sending a few characters. But to use Bluetooth, you must also:

  • Find the cell phone’s Bluetooth adapter.

  • Define a Bluetooth object that represents the device you are talking to (such as an Arduino).

  • Open a socket that represents the Bluetooth serial connection.

  • Open some stream objects: one for sending messages, one for receiving.

Because the Android Bluetooth APIs are complex, we created the class TBlue, which keeps things simple. Chapter 8 has example code that shows you how to use the tBlue library. Here is the source of the TBlue class:

// tBlue.java - simple wrapper for Android Bluetooth libraries ...

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