Do you mean this block part? What can I do if I don't split an empty text at spaces?
So here will be just 0 and 1 right?
Do you mean this block part? What can I do if I don't split an empty text at spaces?
So here will be just 0 and 1 right?
No, global list is just something like this.
global Script itself is an empty text, so you cannot avoid it. If it is empty text, it probably means that it has received nothing or received empty text.
Because you set a conditional that executes only when BytesAvailableToReceive is > 0, it will do nothing.
So does that means that maybe I need to change the way of code in Arduino? Is there any way that I can change the blocks instead changing the code in Arduino?
So how should I correct this part?
You probably have to look into your Arduino code and check if anything is wrong with it.
BytesAvailableToReceive is currently 0. I am not an expert in this, but it seems that something is wrong.
Do you know Arduino? Because I can't really think of another method of sending the data to the MIT app inventor
Not much, but I am checking. I am checking it, but I don't see problems in the code (yet).
Ya so I think the problem is more on the MIT app inventor
So should I change the value instead of putting 0? Actually what is the meaning of this block BytesAvailableToRecieve?
According to the documentation, it
Returns number of bytes available from the input stream.
The split at spaces block returns a list splitted in spaces. For example, if you split the string Apples are tasty
at spaces, it will return a list with the first item as Apples
, the second item as are
and the third as tasty
.
Then why is the global Script empty? Also does the spaces in the list counted as one index?
Because BytesAvailableToReceive is 0, and that converted into text is an empty string.
Yes, global List has an empty text item, but that list still has a length of 1.
So should I set other number for the BytesAvailableToRecieve?
But I thought it is >0?
Yes, probably.
I have tried >1 or >2 but it still doesn't works
I checked the description for that block.
It attempts to receive text from the Bluetooth, and if it returns empty text, it is probably an error (in your code).
So there is problem in my Arduino code?
Maybe. That's all I know - I think a power user should know more than me.
ok thank you so much