OK so...
In Android Studio 1.1.0 (i think it updates itself to this version anyway)
I went
File -> Import Sample
then search for Bluetooth Chat
(com.example.android.bluetoothchat)
It prompted me to install some SDK things that I did not have on before.
Then I went to
(in the project tree)
BluetoothChat -> Application -> src -> main -> java -> com.example.android -> bluetoothChat -> BluetoothChatService.java
At the top of that file there are UUIDs declared:
- Code: Select all
// Unique UUID for this application
private static final UUID MY_UUID_SECURE =
UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
private static final UUID MY_UUID_INSECURE =
UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
I added below :
- Code: Select all
private static final UUID MY_UUID_SERIAL_PORT =
UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //
Then went on to substitute where original code wanted MY_UUID_SECURE or INSECURE, I pasted MY_UUID_SERIAL_PORT instead.
Compile, run, turn car on.
On phone go to Bluetooth menu, pair the phone with device HC-06 (pin 1234).
On the now running Bluetooth Chat app, touch the Bluetooth symbol, then tell it to connect to HC-06.
It connects ! At least says it's connected.
Into the chat window below, type rf, done
wow but... i touch done repeatedly and nothing happens???
WTF?
I go to the chat app again, connect in insecure mode. Same thing.
Type what you want, ON THE on screen keyboard, press DONE, nothing.
Then i hide the keyboard and hey presto there is the SEND button instead of DONE.
I press SEND.
HC-06 replies!
HC-06: r
HC-06: f
The car turns front wheels to the right lock (RF)
WOW.
pf, hide keyboard, send, unhide keyboard, rf, send,... All works
