Hello, guys, and welcome back.
Now we're going to continue over our search and we're going to publish the data from our potential media.
Now we have a potential major connected, not MCU.
We're going to simply read the data and we're going to publish it.
But it's important to show you how we can do that.
So first is the same as we've been doing before.
In order to read anything from the analog print, you're going to say integer.
I'm going to create a variable called spot for potential meter and then I'm going to do analog read
of a zero, which is the pen we're going to read from.
Now, we just need to add one instruction here, we're going to say client, not publish.
And we're going to choose what is the topic name and I'm going to say, let's say analog.
And you were going to say.
What value this is the name of the topic and we're going to do this on the threat end as well, and
then we're going to send developing now the value is actually however, if we try to compile this,
even though it makes perfect sense, we're going to get some errors.
If we go compiling and we get an error, it's saying that this publisher is expecting some kind of CONSED
character string right here.
However, our data we're trying to publish is integer, remember, no dread.
And we all computer protocol is based on messaging and this messaging is using strings and especially
this library is based on string.
So we cannot really send integers.
So we need to guess that we have learned about casting values from time to time.
And the casting work done to do here is to string.
So I'm going to say string.
But while you might think that this work would work because, well, now pieces drink and we convert
converted into something that is character based, if I try to upload.
I'm going to get another error, and it is not really satisfied with this string type as well.
So because there is a difference between this string that the Arduino is having and its syntax and the
C string that we actually need, the C string is actually what we need.
If you try to call a function here on it, it's called C string.
Now, the string is actually a C++ string and C++ string differs a lot from scissoring.
The C string is actually a pointer to a character so that you can create a string from multiple characters.
But a string here in C++ is an object class that has more properties.
This pops up library right to you is expecting something like this C string.
This is why the easiest way to do it is first just convert it to a regular string.
The C++ string then converted to a string.
Now C and C++ are two different programming languages and they differ in syntax and there is a huge
differences in between them.
So to solve this issue, just telling you converted the string, then converted to string and you should
be good to go now if we try to compile.
All right, and we are done.
Now, let us go and create the user interface.
The first thing we need here is some cutie and.
Because in this case, we were sending to another MCU.
Now we want to receive from not MCU.
So this ambiguity will be an input to whatever structure we are going to use here.
Now, the easiest way to display things is by using this numeric here in the dashboard, just get the
numeric and thus and connect them together.
Now let us configure and Kutty here, it's going to be the same server that you demand a brochu that
we have created and the topic is going to be both value the same one we have created here.
OK, next let's go to numeric and I want to take the range between zero and thousand, let's say 23.
OK.
I'm going to click on Don, I'm going to click on Deploy.
Now, if you go to the dashboard, you're going to see something new.
Now in the next lecture, we will do this together.