Hello,
I'm working on an B4A app to send and receive data between a HTC One Android phone and an Arduino board. The Arduino board is equipped with a Bluefruit EZ-Link Bluetooth chip.
When I run the B4A app, I get through serial1.connect() without any error messages. The light on my Bluetooth chip begins flashing quickly, indicating a connection. However, Serial1_Connected() never gets called back.
I've gone through all of the discussion boards and Bluetooth examples, and am stumped.
Here's the relevant code:
I've also tried connecting using this instead:
...but it also doesn't work -- same result.
If I try to call AStreams.Initialize after any of the above, I get a Java NullPointer error, so it looks like something's not being initialized properly.
I've also tried unpairing and re-pairing my phone to the Bluetooth chip.
I can pair, connect, and send/receive data from my OS X Mac, so I know the Arduino + Bluetooth chip are working OK physically.
What else would you suggest?
Thanks for your help!
I'm working on an B4A app to send and receive data between a HTC One Android phone and an Arduino board. The Arduino board is equipped with a Bluefruit EZ-Link Bluetooth chip.
When I run the B4A app, I get through serial1.connect() without any error messages. The light on my Bluetooth chip begins flashing quickly, indicating a connection. However, Serial1_Connected() never gets called back.
I've gone through all of the discussion boards and Bluetooth examples, and am stumped.
Here's the relevant code:
B4X:
Sub Process_Globals
Dim serial1 As Serial
Dim admin As BluetoothAdmin
Dim AStreams As AsyncStreams
End Sub
Sub initBT
admin.Initialize("admin")
serial1.Initialize("serial1")
serial1.Connect("98:76:B6:00:42:34") ' mac address from serial1.GetPairedDevices()
End Sub
Sub serial1_NewConnection (Successful As Boolean)
log("!!!!!!!!! called !!!!!!!!!")
End Sub
I've also tried connecting using this instead:
B4X:
serial1.ConnectInsecure(admin, "98:76:B6:00:42:34", 1)
...but it also doesn't work -- same result.
If I try to call AStreams.Initialize after any of the above, I get a Java NullPointer error, so it looks like something's not being initialized properly.
I've also tried unpairing and re-pairing my phone to the Bluetooth chip.
I can pair, connect, and send/receive data from my OS X Mac, so I know the Arduino + Bluetooth chip are working OK physically.
What else would you suggest?
Thanks for your help!