Hello, I am trying to receive the data coming from a clock of the MSP432. The following is my block code. I am getting errors in the app with the lists, either the list is too large, or similar errors, which I don't understand because I am only receiving data in the following format: 00:00. I am just trying to display the data received as a clock.
try to fix your global input block like this:
What is the meaning of empty bytes or zero? The "numberOfBytes" field is the number of bytes to read, if we want to receive all bytes up to the end character, we have to enter -1 there. The desired end character must be entered in the BT settings. The end byte will also appear in the list, so you have to remove it from the list.
you want to receive the available bytes, which is this
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
That's incorrect, the Math Block should be set to -1
That is not true - you have to tell the Bluetooth Client what the end byte is, normally 10 ( = LF = \n). The same end data flag must be used in the script - if using Arduino Serial code, that can be Serial.println()
I don't see in this thread the transmission code, which determines what to look for at end of message, if anything.
Please show your transmission code.
He doesn't want to receive text but binary data, so he used the "ReadUnsignetBytes block. So he should use serial.write () or serial.writeln (). But what if the data also shows" 10 "?
What did I write untrue? I wrote that the end of line character must be entered in the BT settings. And the fact that the line break will be added to the list, I read in the documentation of the BT component, if it's not true, please change the documentation.
... I did not see a mention of Binary by Marsell.
Where did you read that Patryk? This is what the built-in help says for the BT Client ReceiveUnsignedBytes Block:
Receive multiple unsigned byte values from the connected Bluetooth device.
If numberOfBytes is less than 0, read until a delimiter byte value is received.
I think we do need to see the script that sends the data.
These are the communication codes.
and what we're trying to receive is numbers in a "clock" as shown in the image.
The first 0 is in the blocks as label 1, which in the initial code (blocks) is Hrs, the 2nd one is mins and is label2, which in the indexes would be 1 and 2.
ReceiveUnsignedBytes( numberOfBytes )
Reads a number of unsigned bytes from the input stream and returns them as a List.
If numberOfBytes is negative, this method reads until a delimiter byte value is read. The delimiter byte value is included in the returned list.
Paste all code for arduino here. Replace .ino file extension with .txt and post here.
Where exactly did you find that Patryk?
Marsell
Trying to follow your Script:
- The values required are concatenated into a single space-separated value with sprintf.
- The procedure 'sendBluetooth' then breaks-up the concatenated value into individual characters, including the space char separator, into a Uart EUSCI_A2 Buffer?
Although the procedure is called sendBluetooth, I don't see any familiar comms that the App is going to pick up - is that another part of the script? What is the Baud rate? What is the exact format of those integers? I don't know enough about the MSP432 and how to use it.......
Edit: How frequently are you trying to send data?
Edit2: What is the exact Bluetooth version used?
I do not know the MSP432.
In this example to receive unsignedBytes, I used:
ReceiveUnsignedBytes.numberOfBytes: BytesAvailableToReceive
and got a list [65,66,67,68]
I don't see any \n terminating the transmitting text.
I suggest adding one to your sprintf call or to your sendBluetooth procedure.
It will be necessary if you go the numberofBytes(-1) route, and harmless otherwise.
I think it uses Java code
I copied from official help to the ReceiveUnsignetBytes block. Right-click on this block and select "help" from the menu.
Thanks Patryk - reporting the discrepancy for MIT to update.