Hello, guys, and welcome back.
So I'm going to teach you how we can send strings to our cue from a desk, I wanted to teach you this
skill because sending a string is a little bit different than sending normal data, because strings
will be packed in arrays and then we will be sending elements of an array.
So I'm going to teach you how we can do that instead of constantly sending fixed number.
So I'm going to delete this integer data 123.
I'm going to replace it with a char and then it's a pointer char because we're going to define a string
right here.
So we're defining an array of string to be accurate.
So let's say that we have a string that is divided to multiple works.
Let's say hi.
Next word is this is.
A string being.
Transferred.
OK, so we have one, two, three, four, five, six, seven, OK, so we have seven elements or seven
strings inside this area.
This is how you define an array of multiple strings together.
OK, so this is the first thing we're going to learn next.
How can we send these arrays one by one?
Well, we have learned that we can use for loops to do this.
So here I could say for integer I equals zero.
I is less what is the number here, seven Solís than eight.
I plus plus, I'm going to iterate over all of these elements, I'm going to send them one by one.
Let's open.
Curly brackets.
So everything here now is inside this hall.
OK, so here, instead of sending data which will only send us the first element, we need to send in
index.
No, I'm going to show you what do I mean by it will only send the first element.
Now, this is data and this is data.
And here you are saying send me a copy of the data.
You would expect it will send everything, but it won't.
So we're going to iterate over everything.
So here, since we are iterating over the data, we need to specify which index do you want to send
for it?
So I'm going to put here brackets and I write, if you remember when we took four loops and arrays in
the A section, we said this is how we iterate over an error rate.
So we have an array of strings here.
And I am sending a copy of all of this data one by one to my Q OK, now everything is going to stay
the same.
But here when you're trying to print, we cannot print data like that.
We can print them element by element.
So in order to do this, we're going to specify which element do we want to print.
And it depends on the eye.
Right.
So we're going to print out equals zero.
One, two, three, four, five and six.
OK.
Let us applaud this.
This is my cereal.
And here we go.
Hi.
This is a string.
OK, why is that why did we stop here because we did not increase the size of our queue right now.
You can only hold five elements, so it will stop exactly at this point.
How about we change this to, let's say, 10 elements?
Now, our cue has a size of 10 elements, let's say of the size of char pointer of a string.
Right.
I mean, this is the type of the data I have.
Now, let me upload again.
So this is the print out.
This is a string being transferred.
And again, we are repeating, but here we are sending some weird values, why?
Well, it's very simple because the number of elements here is larger than here.
So now we are going to a memo address that has garbage, which value.
This is why we are extending this we value.
So in order to fix this, we need to be I is less than seven, not eight, because I have already here
seven elements.
Let me clear this out, but.
So Hugo saying, hi, this is a string being transferred again, and we are repeating because this is
in a wire loop and we are going to fill 10 elements.
Exactly.
That is, you can see from the second sentence, we got the space of zero.
That's a great.
Now, we have learned how we can transfer text over serial using Qs.