More information is needed to diagnose this...
--
Your transmission source code,
Your timer milliseconds value,
your choice of delimiters on the sending and receiving sides,
Your Designer BlueTooth Client Delimiter setting
From your blocks, I see two things missing:
IF Connected THEN/ELSE surrounding your IF Data Available THEN/ELSE block
a delimiter -friendly BT Get Text byte count (< 0)
samples in my FAQ: Arduino and Bluetooth
Serial2.println("18.23"); is the transmission source code.
Serial2 is the interface to the bluetoothmodul.
2000 ms is the timer milliseconds value
The delemiter on the sending side is \n
on the receiving side I don't know.
The Designer BlueTooth Client Delimiter setting I don't know.
Setting the Information "Bluetooth OK" and "BT AUS" works correct.
Serial2 is the interface to the bluetoothmodul.
2000 ms is the timer milliseconds value
The delemiter on the sending side is \n
on the receiving side I don't know.
The Designer BlueTooth Client Delimiter setting I don't know.
Setting the Information "Bluetooth OK" and "BT AUS" works correct.
--
The delemiter on the sending side is \n
on the receiving side I don't know.
The Designer BlueTooth Client Delimiter setting I don't know.
In the Ai2 Designer, you have to set the Delimiter attribute of the BlueTooth Client component to 10.
That's the decimal equivalent of \n (LF).
This won't work without it.
The proper code sequence for this case is:
Clock.Timer
IF connected then
if bytes available > 0 then
get from BTClient.ReceiveText(-1 bytes) and process it.
text ReceiveText(number numberOfBytes)
Receive text from the connected Bluetooth device. If numberOfBytes is less than 0, read until a delimiter byte value is received.
--
In the Ai2 Designer, you have to set the Delimiter attribute of the BlueTooth Client component to 10.Do I get it right? When I want to get the value 18.23, I have to send 18.2310? But what happens, if the measured value is 18.10 and I send 18.1010?
--
How fast does the Arduino send things? Every time you are only reading 5 bytes. It may be that you still have a lot of data in a buffer that Android keeps for you.
Instead of reading 5 bytes, you should read -1 bytes (read until a delimiter is found) and increase the delay time in your Arduino, or keep reading until nothing is left to receive.
--
Instead of reading 5 bytes, you should read -1 bytes (read until a delimiter is found) and increase the delay time in your Arduino, or keep reading until nothing is left to receive.
--
It looks like you will need a good .aia sample and blocks to work from.
--
I checked my FAQ, and found none that show the use of the delimiter properly.
(I haven't done any personal BlueTooth projects, because I have no hardware and no application,
though I have worked in data comm in past lives.)
If you post a .aia file here, I can try to fix it and document it as a sample.
Warning - my college German evaporated in the 1970s.
This is the aia fileBaggersteuerung_zwei.aia
--
How fast does the Arduino send things? Every time you are only reading 5 bytes. It may be that you still have a lot of data in a buffer that Android keeps for you.
Instead of reading 5 bytes, you should read -1 bytes (read until a delimiter is found) and increase the delay time in your Arduino, or keep reading until nothing is left to receive.
The Arduino sends all 1.8 s
--
you also gave the hint to take the -1 bytes, but before I had not understand where to write and what it means. Excuse me!
After the hint of Ghica I tried it again and to my surprise it works now very well.!!
After the hint of Ghica I tried it again and to my surprise it works now very well.!!
--
댓글 없음:
댓글 쓰기