Here is yet another activity for you to practice more on cereal.
And in this activity, here is what you are going to do.
So from the Arduino, you are going to send a counter.
So you're going to initialize a counter.
Okay, so init counter and then send it every 500 milliseconds.
So every time of course you're going to increase the counter and so increment it.
So you send zero, one, two, three, etcetera.
Okay.
And that of course from the main loop on the Raspberry Pi, what you are going to do is of course receive
and print the counter.
So that is the first action.
Now this would be a little bit too easy for you at this point.
So what you're going to do is also that every 10s, so every 10s you are going to reset the counter.
So to reset the counter, you are going to need to send a special command to the Arduino.
And on the Arduino is that when you receive when receive
reset counter command, then you reset the counter, of course, so you reset it to zero.
And the thing is that those two actions here are completely independent.
Okay?
So here, as you did in the previous activity, you're going to send the counter every 500 milliseconds
without using delay and you're going to in parallel and in a different action check if you have received
that reset counter comment on the Raspberry Pi, you're going to do the same.
Okay.
So in Python, you are not going to use time dot sleep for 10s, of course, because if you do that,
you're not going to be able to print the counter for 10s.
Okay.
So in Python you're going to need to do also a non-blocking action every 10s with basically the same
structure as we did previously on the Arduino.
So in your while true in the void loop of your Python program, the first action or the second.
Okay doesn't matter.
The order is to receive and print the counter and the second action is to reset the counter whenever
you have past 10s.
All right.
And I will see you in the next video for The Solution.