Bluetooth and Clock2

166585c0ff6d87251795223fce2d2606354908ef_2_517x367 Hello everyone, I have such a problem, for example, if the button is pressed, then the timer is activated and sends text to the textbox separately for 100 milliseconds, for example, if you write 12345 bluetooth sends "1" 100 milliseconds "2" 100 "3" 100 "4" current. And now I need every 200 milliseconds bluetooth should send 2 letters "12" "34" I was playing but it gives me an error4f84449229c22b26e6fa5f787def72f3bc54de7f_2_517x345

I changed the location 1 to 2 to make it work what needs to be done

74f6d4c3a508a245f465cbfca2e12ef755101438

if length(TextBox4.Text) > 1 + index then
   send text segment ... length(2)
   set global index to global index + 2

Try like this (replace my label blocks with your bluetooth blocks):
The main change is for index to be less than length of textbox, not less than or equal to. This fixes your error.

You might consider an alternate method:

(Note for Android < 10 you will need to remove the extra empty first item of the list created by split by)

Thank you all for your hard work, but I'm new to this, can you show it in blocks please

please help me

it is right?
but bluetooth does not send characters to the end (error)

The original request for sending 2 characters at a time did not mention the corner case of what to do with an odd number of characters:

  • Send only pairs of characters and wait for pair completion, or
  • Send pairs up to the last single character and send that alone?

I took the first choice, for lack of direction, and based on your use of a TextBox for the input, so I assumed you might be typing additionaal characters into the TextBox.

But now you have switched to a Label, so I am guessing you want to send the odd last character too?

If so, the segment() block needs to adjust its length based on how close the index variable has come to the length of the .Text value.

I'll give you some time to think about this and try things.

hello, thanks, I tried it, but what will I write, such a text is sent without separation and at the end of the text "," and that's it, I did the right thing, please help

These blocks are missing from your Button.Click event
image
(split at block is "empty")

Change these blocks to look like this in your Clock Timer event:

image
(as I previously said you need less than, NOT less than equal to)

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

In your code I see

image

instead of

image

if i send "123456" the result is like this

Can you understand what Dora Paz wrote? Do you tell the> sign from the => sign?

not shared

Yes, sorry, i forgot to change the label blocks to bluetooth blocks as well.

image

thanks but this is sending one by one.How can i send by 2

Solution was based upon your original blocks.

What do you mean by sending 2 ? Two individual texts, or each set of two texts sent together as one?

If you want to send pairs then change these blocks in your clock timer event:

This will not work for an odd number of items in your tbNumber list. for that you will need to test for even/odd and handle the odd item (e.g. add a 0/zero, or exclude it).

yes, each set of two texts is sent together as one. For example: write "12345678".
then first "12" 200 milliseconds, then "34" and so on. And I have a question, if you send "123", then send "12", but "3" does not send? Is it possible in this case to bind one character at the end and send as "12" and "3 *", how can the application understand how it is and determine how it can be implemented

repeated if sent "1234" then it accepts "1122334" what is the problem