Now, let us upload the sketch.
Now, as we can see, there is no blinking going on the does serial monitor.
We printed this once and we got stuck.
So what's going on here?
Exactly.
The thing is, this desk delay is not exactly as the delay, it's not the same as where you right delay
and you specify the number of milliseconds.
This will not work.
What you need to add is the following line.
You need to do this division like this and then you need to support.
They underscore period, underscore Ms.
Now, by that, you have converted this 500 to 500 millisecond, according to your microcontroller,
because you need to specify what type of ticks is going on.
So this is only the number of ticks, but you need to specify the unit of this as well.
Right?
Otherwise, it won't work.
I know this is a little bit low level, but that's totally fine because you need to know what is your
ideal for ticking in this situation and this constant here.
By doing this operation, you are calculating automatically what is the tick right here.
And what we are doing here is we're converting this five hundred to five hundred milliseconds.
So we need to do this for every delay, but again, this does not seem a very practical way to write
all of this every time I want a delay.
So I'm going to write a very simple macro now.
And macro is a thing that will be replaced by your whole code.
So I'm going to say he define.
Marty DeLay.
I'm going to put a parameter V and then I'm going to do the following, I'm going to say V.
Desk delay.
I remember my desk delay, and I'm going to say the.
Over.
Like this now, every time I write arty delay and a number of milliseconds, it's going to be replaced
by this.
That's amazing.
This is a compiler trick, actually, so you can always use it.
You can replace a statement by your whole different statement in your whole code.
So.
Right now, I'm going to copy this or to delay.
And replace it here.
I'm going to put you 500.
Based to, again, 500.
Same thing here.
And that's it.
Now, let us try again.
I'm going to verify this.
And I'm going to upload it.
Now, let us take a look at our microcontroller.
As we can see, we are blinking right now, and if I open my cereal monitor.
Everything is working as expected.
So today, we have learned how to do multithreaded and we learned about this macro in our Adreno, which
is a little bit of advanced technique.