Bluethooth

Heinz

Active Member
Licensed User
Longtime User
i have a Bluethooth-relais card.
it is visible on my touchlet tablet
but the connection fails.
the relais card has a baud rate
19200. in Basic4ppc i can connect
it with
B4X:
Serial1.New(portnr, 19200, "N", 8, 1)

Is ist possible to set baud to 19200
like a com port ?
 

Heinz

Active Member
Licensed User
Longtime User
i can set manual the baud rate on my relais
but what is the baud rate on my BT-Android device
(9600) ?
i haven't seen any information on my device.
 

RiskFour

Member
Licensed User
Longtime User
Hi Heinz,

I'm using the BTM-222 Bluetooth Module and the setting are:

Bitrate = 57600
Databits = 8
Parity = no
Stopbits = 1

This Works fine for me, but this Setting are normally for the RS232 Connection between the Bluetooth Module an the Microcontroller.
The Handshake between the phone and the BT-Module will be done automatically.

If you use the Serial-Lib in B4A take a look on this Tutorial:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/6908-android-serial-tutorial.html

- Pairing your phone with your Relaycard
- Open the Tutorial App und select Menue-> Connect
- Send a string

Hope this helps...
 

Heinz

Active Member
Licensed User
Longtime User
it runs, but if i disconnect
after sending a string the relais
works.:sign0085:
i'll have a look to the source code.

thanks.
 

RiskFour

Member
Licensed User
Longtime User
Looks like you have to send <LF> or <CR> at the end of each String...

Change the code in the Sub "btnSend_Click"

from: TextWriter1.WriteLine(txtSend.Text)

to: TextWriter1.WriteLine(txtSend.Text & Chr(13))
 

Heinz

Active Member
Licensed User
Longtime User
thank you,
it works now.

B4X:
TextWriter1.Write(sendstring & Chr(13))

do the job.
 
Top