Hello, welcome back.
So in a previous lesson, we saw a basic example of events, groups, we saw how to set events.
And over here, we just created a simple experiment where if a particular event is said, we take an
action and a simple action is printed over here.
I should point out that this block here can implement whatever complex code or whatever complex algorithm
you want to implement.
When an event bit to set over here, we are simply saying print something.
So that's the purpose of it.
In this lesson, we going to create a variation of this, we're going to have each task set in its own
events bit, and then we have one task which inspects which event it is set to take a particular action.
That is another simple experiment, but it would give you ideas of how to apply event bits in your project.
So I'm going to I'm going to make a copy.
Of the last project, I'll copy this.
It copy and then paste over here.
Also with multiple cities, event groups with multiple cities, right, there's a descriptive name.
A copy over here like this.
Click over here.
And then.
May not see for.
OK, so over here.
I'm going to clean all the.
ARTUS related stuff so that we start from scratch to avoid confusion.
OK.
So this is our project.
There is nothing here with regards to vent groups, we just have our projects, no artists, OK, we
are going to create three.
Events bids one for each, tasks one, one for each task, we're going to have three input tasks.
So I'm going to start off by saying defined task one bit with zero task to bit task three bit.
OK, once that is done, I'm going to declare a handle for an event group that we shall have.
We have this event group and then once this is done.
I'm going to create the event group and store the handle in the handle variable event group create and
then we start the handle here and then I'm going to create three input tasks.
I'm going to create three tasks.
They'll call them input tasks is really difficult for me to pronounce the word tasks in plural, you
know.
Yeah.
So we have these three of them.
We have input.
Ask one input task to input task three.
They have the same stack size, the same priority.
We're going to create one output task.
We have one political task here.
OK, and the name of the task function will be input task one, task two, three, etc. And once this
is done, we going to start our scheduler.
Like this, OK, so once that is done, we go into.
We're going to define we're going to define a delay amount.
We're going to be applying some delay 500 mistily.
I'm going to define this Constancia code, you know, delay 500 times.
And this equals this.
It would be stored in this very X delay 500 times.
OK, so each input task will simply do something and then set its event, you know, event A.
So let's start with input to task one.
Input.
Task one would come over here.
And it's a one loop, let's say you have a complex system in your input.
Task one, you do something, you first do something.
And then you set the events a bit to tell the events group that, OK, you are done, the events bits
should be set so that they take it to the next level, if you may.
This could be a data acquisition system that acquires the data and then sets the event bits for a different
task to process the data.
OK, so imputed task one is going to set its particular event, but which is task one bit.
So input task to.
Which is the same will set its own event bit, so this can be another Senso, which you are quite on
data, different type of Senso, it's acquired the data.
So it would say, OK, I've grabbed the data.
So it sets its event bit and the same for Inputs Task three.
It's going to set its own event a bit here like this.
OK, so once this is done, we're going to have our output task, which is like the central task that
receives the event, beautiful from all of the input tasks and then process it does the processing that
is required.
And in our case, the processing is as simple as printing a confirmation.
So over here, because we have three events, bids or task bids, we have to combine all of them into
one variable.
So our bids to wait for is task one bit, task two bit and task three.
But once that's done, we're going to define an event.
An event group value here, which is of type event, it's going to define event of its year so that
the value returned from the event group will be stored in this bit so that we can know which one is
certain which isn't set.
So just like we did before we go into check, which is set.
OK.
Exactly as we did before.
OK, so then just like we did again, we go into use and if conditioned to check which of them is set.
So over here we're saying if tasc one bit is set mean and if it's not equal to zero, then we print
which task events with zero sets if task to events.
Which one is task three events bit.
To so I'll just put the name of the tasks here so that.
We don't get confused.
So this is task one.
This is talk to.
This is task three.
OK.
Let's build and see a click over here to build.
OK.
We have to put a function prototypes, a common mistake, we put task three and then we change this
to one and to two.
Semicolon here, seven here and output task should be down here.
We grabbed this prototype.
Pull over here and then click over here to build.
It's built successfully.
Right, click over here.
We see Dybbuk, US Ystem 32.
You selected twenty nine.
We say, OK.
It's opening click to switch.
We create space.
I'm going to clear what we have here.
Then I'm going to click to run.
Going to open Oshiro, as you can see, we're receiving it.
OK, I'm going to post this.
I see.
Which read in TASC event, but zero was set for task one.
You have event events, but one was set for task to event with three or four task three.
So all events which are being said the respective task said their own event bits and the central task,
which is the output task reads them.
OK, so we can experiment further by preventing one of the tasks from setting its event a bit.
And let's see whether we we wouldn't see that tasks get printed here.
Oh, come over here and I'm going to nominate task to empathise, to not to set its event bit, so I'll
comment this out.
Click here to build.
Then click here to go to the iboga.
Click here to switch.
I'll Claire, what we have over here, a click to run.
And then I'll click to open my support over here and I'll post, as you can see, we no longer have.
We no longer have a task to here.
We have one in three, just one in three.
So this is how we use events, events, bits in an event, a group with a second example.
I'm sure it's getting clearer and clearer what you can use this feature of the realtime operating system
to achieve this.
All the risk for this lesson.
And if you have any questions, leave them in the questions and answers.
So, yeah, I'll see you later.
Have a nice day.