2017년 8월 22일 화요일

Need help for an application using bluetooth


I am making an application for drive a test bench by bluetooth , so i send commands to the bench like for change the frequency (#F?) and he will answer for example 28 hz to the right label .
You can see the appli and blocks attached.

The problem is when i get the answer for the bench like (28) hz i see on the right label not 28 but 2... and 1 second later ...8.. but i want 28, he dont save the first number ! i dont know how to do.

The other problem is : i want the see all data on one label (label 11) (a terminal we can see it at the end of the application)  its to know if the command is send to the bench.


--
You should post your sketch so we can see how you are transmitting the data from the other end.

Your symptoms are usually relieved by adding a Delimiter like LF to the end of the messages coming in to AI2,
by using the println() command to send each message, and making three changes to the AI2 side:

Set the Designer BlueTooth Client Delimiter to 10
(10 is decimal for LF)

Use a two-layer IF/THEN test in your Clock Timer:
IF Connected THEN
  IF Bytes Available > 0 THEN
     (only ask for data if it's available)

Have the inner BlueTooth Receive Text ask for -1 bytes,
to get only complete messages.

Regarding the relative transmission and reception speeds,
try not to have either side drink from a firehose.

--
Hello,
I tried to do the modification of the program, but he doesn't work , you can see it on attached file.

--
See this post's attachments for how to do it right. info for app arduino/android communication

You had two serious errors in your code,
setting the delimiter in the wrong place and
not requesting number of bytes = -1 bytes.

--
I did like the other guys on your link, but it doesn't work can you see what is wrong on my .aia pls.


--
Post your blocks image, please.

--
I finally got a chance to import your .aia file (after helping all the other people who posted 
easier to debug screen shots for express service).

The only thing I noticed that might be a problem was the inclusion
of an extra clock, Clock2, always firing for no reason.
I suggest removing it in the Designer.

I don't see your latest C code from the other side, so I
can't tell if the markers you check for in the incoming text
are being transmitted from the other side of the connection.

For complete diagnosis, I suggest adding temporary labels
to your AI2 design and updating them with the incoming message
and the number of available bytes.

Also post your C code.

--

댓글 1개: