Hi to all,
trying to send string message to micro:bit "ALARM ON\n", or any other message message written in EditText.
According to documentation command should be
.writedata(serviceID ,characteristicID, byte)
micro:bit is working OK, it is tested with app inventor application but I wish to have app running as service, so I decide to do it with B4A.
here is a part of code which should send data over BTLE, but nothing happen.
trying to send string message to micro:bit "ALARM ON\n", or any other message message written in EditText.
According to documentation command should be
.writedata(serviceID ,characteristicID, byte)
micro:bit is working OK, it is tested with app inventor application but I wish to have app running as service, so I decide to do it with B4A.
here is a part of code which should send data over BTLE, but nothing happen.
B4X:
SUB
Dim slovo_b(1) As Byte
poruka="ALARM ON"
duzina=poruka.Length
Dim serviceID As String="6e400001-b5a3-f393-e0a9-e50e24dcca9e"
Dim RX_char As String="6e400002-b5a3-f393-e0a9-e50e24dcca9e"
For data_byte= 0 To duzina-1
slovo = poruka.SubString2(data_byte,data_byte+1)
slovo_b(0)=slovo.GetBytes("UTF8")
Starter.manager.WriteData(serviceID ,TX_char,slovo_b)
Next
slovo_b()=CRLF
Starter.manager.WriteData(serviceID ,TX_char,slovo_b)
end sub