Bluetooth Serial Chat Example

This example program demonstrates using the Bluetooth Serial PhoneGap plugin for communications between a iOS or Android phone and an Arduino.  It is not very useful for chat, but it demonstrates sending data to and receiving data from the Arduino.  This should help you integrate Bluetooth Serial into your PhoneGap projects.

Some assembly required.

I'll assume you've cloned https://github.com/don/BluetoothSerial into ~/BluetoothSerial

Copy the chat example to a new directory.  

    $ cp -R ~/BluetoothSerial/examples/Chat ~/Chat
    
You need to copy the project to a new directory, otherwise the plugin installer will fail.

This code requires [cordova-cli](https://github.com/apache/cordova-cli), which require [node.js](http://nodejs.org)
    
    $ npm install cordova@2.7.4 -g
    
Adding platforms generates the native projects

    $ cordova platform add android
    $ cordova platform add ios
    
Install the Bluetooth Serial plugin with cordova

    $ cordova plugin add ~/BluetoothSerial
    
This code requires an Android device since the emulator does not support Bluetooth. Pair your Android device the Bluetooth modem running on the Arduino.

Build and deploy to an Android device. (Emulate deploys to the connected device.)

    $ cordova build android && cordova emulate android
    
This code uses Bluetooth and requires an iOS device, rather than the emulator.  The iOS version uses Bluetooth Low Energy, so there's no need to pair with the remove device.  The iOS code *only* connects to Red Bear Labs BLE Mini http://redbearlab.com/blemini/

Build the code

    $ cordova build ios
    
Open Xcode and deploy to your device
    
    $ open platforms/ios/Chat.xcodeproj
    
NOTE: Don't edit the HTML or JS in the generated projects. Edit the source in ~/BluetoothSerial/examples/Chat/www and rebuild with cordova-cli.

See the Arduino Folder for Sketches

    Red Bear Labs BLEMini
    SeeedStudio Bluetooth Shield
    Sparkfun Bluetooth Mate Silver
 
This example uses
    Topcoat CSS http://topcoat.io/ (c) Adobe Systems
    Apache Cordova
    BluetoothSerial PhoneGap plugin
