posted Jan 5, 2012, 11:17 AM by Lewis Baumstark
updated Jan 13, 2012, 6:17 AM
I wanted to use Amarino
such that the Bluetooth module was communicating with an Arduino via
. I have nefarious plans for later that require the regular hardware-based
for something other than Bluetooth (hint: XBee!).
Since this is based on
, some caveats
apply (scroll down to the "Limitations" section). Otherwise:
- Anytime you use this patched library you MUST
#include <SoftwareSerial.h> in your sketch, even if you only want to use the standard
Serial for Bluetooth. This is a limitation of the Arduino IDE.
class MeetAndroid now defines an additional constructor
MeetAndroid(int rxPin, int txPin, long int baud). Using this constructor forces a
MeetAndroid object to use
SoftwareSerial, with the indicated pins and baud rate, instead of
Serial. Note that, unlike when using
Stream.begin(baud) automatically when using
Other than the new constructor,
MeetAndroid's API is unchanged. All other public methods work exactly as before.
My test setup was an Arduino UNO with a Bluesmirf Gold Bluetooth modem running the sketch below and a Motorola XOOM, running Amarino, logging Bluetooth events. I discovered no conflicts (blocking, etc.) using both streams interspersed.
// inits a SoftwareSerial BT connection on rxPin=4, txPin=3, with baud=115200
MeetAndroid meetAndroid(4,3, 115200);
if(Serial.available() > 0)
char incomingByte = Serial.read();