In this lesson, I'm going to introduce you to a new Avenue ID debug tool, which is named the Serial
Plotter.
And as its name suggests, you will be able to plot what comes in the serial communication.
So this will be useful, for example, here, like we are going to do to see directly with a plot.
What is the burden state.
So I'm going to go back to so I'm going to open the push button so you can go back to your project and
just will just open.
The push button example.
So here we define the button pin.
We set the mode for the pin as input and we set up the cellular communication.
Now, what I'm going to do in the loop, I'm simply going to do.
Sale dots print n.
Digital read button in.
Okay, so I'm just going to print the output of the pin key and command those lines.
Okay, I'm going to print it at full speed this time.
No delay so I can upload the code to the available.
For uploading and uploading.
If you open the soil monitor, you will see it's going very fast.
Very, very fast.
If I press the button, it's going very fast.
And now to open the style plotter, you can go on tools and cellular plotter and you can see the shortcut
here, for example, on Windows control shift and l so say plotter, and you get a new window with a
plot.
So on the bottom of the window, you can see here the board, Right.
So make sure you have the same board right in your program and in the sale plot.
And on the bottom right here, you should have no line ending as well.
Now, what I'm going to do is I'm going to press the button and you can see here we have by here you
have the value zero.
You have the value three here.
So this is one.
Now, if I release the button, we go back to zero.
So you can easily visualize when you price and when you release the button.
We are going to come back to this tool a bit later on this course.
So this is really a nice to have functionality with your Arduino is to be able to directly print the
data from a sensor and note that to do that you should directly send the data you want to print.
Don't send any other text or any other data.
Just send the data.
So this could be digital rate for a button pin, or this could be simply you can try.
Also to do that is to create a counter and increment the counter every time and print on the cell communication.
And then with the cell plotter you should see the plot with all the numbers that you send.
And if you are on Tinker CAD, you can also use the cell plotter.
So if you run the code like this, you can click on cell monitor and you have this icon here that you
can click on total graph and you can see let's just put it a bit bigger.
You can see we have the graph here.
And so now if I press on the push button.
You can see I release and then I press and then I release.
You can see the data is going from 0 to 1 and then 0 to 1, etc. back to zero.
So you can do the side plotter as well on Tinker Cat.
All right.
Now you know how to use digital pins as output and input.
Congratulations.
And it's no time to switch to analog pins.