How to remove parentheses from a label when receiving strings by Bluetooth

How do I remove the parenthesis inserted into my label when receiving strings from Bluetooth.
I see on this board how to do this for a list but not a Label.
On Bluetooth I am sending:

But my label displays:
) (362,-150,-3,3,6
) (363,-150,-3,3,6
) (364,-150) (,-3,3,6
) (365,-150,-3,3,6
) (366,-150,-3,3,6
) (367,-1) (50,-3,3,6
) (368,-150,-3,3,6

blocks (23)

OK TIMA12, that worked but as I am receiving at a 20 millisecond update I want to reduce the work load by not having to manipulate strings if possible.
Why are the parenthesis applied in the first case and how can I avoid them being inserted?

Without seeing what and how you are sending from your bluetooth device, my guess is that you are receiving a list, placing the list in a label will show the parantheses. It will probably take more blocks to put your data into a list and convert it to a label than the replacement blocks!

If it is a list, it looks a bit malformed in places - lines 3 & 6

I don't think I am sending a list.

My test Arduino code is this:
X1 = -3; Y1 = 3; Z1 = 6; Sync = -150;
BleDataString = String(DataCounter) + ',' + String(Sync) + ',' + String(X1) + ',' + String(Y1) + ',' + String(Z1);

Yes the RX data seems muddled with parenthesis inserted in the middle of lines.

It appears correctly as transmitted in other Bluetooth terminals.


If you add a \n (New line) to the end of each message you send, you can apply the technique at Hm-10 sending string - Problems - to grab complete individual message lines and process them one by one.

The event block returns a list of strings. Use the corresponding blocks in the list drawer to manipulate the list rather than doing the string contortions. If you get the first element of the list it should give you what you're looking for while being easier to understand.

OK ewpatton, i will try that and report back.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.