FEZ and Android Bluetooth communication
This code example show the easiest way to make simple communication between FEZ Spider and Android device using Bluetooth.
For this example I simplified Bluetooth Chat sample, provided by Android developer site. It is also possible to enable Bluetooth adapter from application and to make new pairing, but I want to make this sample as simple as possible. To use this code you need to install Android development environment (http://developer.android.com/sdk/installing/index.html) and Android device with Bluetooth adapter and Android version 2.1 or later. Android emulator doesnt support Bluetooth connections.
These are the steps to make this snippet work:
- I used FEZ Spider, Bluetooth module (http://www.ghielectronics.com/catalog/product/312) on socket 9 and Button module (http://www.ghielectronics.com/catalog/product/274) on socket 6. Change connections using Visual Studio if necessary. Run the program in debug mode using Visual Studio. After a few seconds blue and red light should blink.
- Enable Bluetooth adapter on you Android device and do a pairing. Use menu Settings Wireless and network Bluetooth Settings Scan devices. Seedstudio device should appear on the list. Select it and use PIN 0000 to complete pairing process.
- Deploy Android application to you device using Eclipse or any other IDE. You need at least Android 2.1 (API level 7) device. I tested it on my Samsung Galaxy S with Android version 2.3.6. When you run application the list of paired Bluetooth devices will appear. Select seedstudio. Wait for message Connected to seedstudio.
- Click button on your spider and check for message on you Android device.
- Click Send message on you Android device and check Visual Studio Output window.