1
00:00:01,000 --> 00:00:02,110
Hello, welcome back.

2
00:00:02,590 --> 00:00:08,970
So in a previous lesson, we saw a basic example of events, groups, we saw how to set events.

3
00:00:09,790 --> 00:00:17,080
And over here, we just created a simple experiment where if a particular event is said, we take an

4
00:00:17,080 --> 00:00:19,990
action and a simple action is printed over here.

5
00:00:19,990 --> 00:00:27,070
I should point out that this block here can implement whatever complex code or whatever complex algorithm

6
00:00:27,070 --> 00:00:28,180
you want to implement.

7
00:00:28,180 --> 00:00:32,460
When an event bit to set over here, we are simply saying print something.

8
00:00:33,160 --> 00:00:34,510
So that's the purpose of it.

9
00:00:35,410 --> 00:00:41,980
In this lesson, we going to create a variation of this, we're going to have each task set in its own

10
00:00:41,980 --> 00:00:48,160
events bit, and then we have one task which inspects which event it is set to take a particular action.

11
00:00:48,370 --> 00:00:54,770
That is another simple experiment, but it would give you ideas of how to apply event bits in your project.

12
00:00:55,330 --> 00:01:00,280
So I'm going to I'm going to make a copy.

13
00:01:01,710 --> 00:01:03,840
Of the last project, I'll copy this.

14
00:01:07,570 --> 00:01:09,460
It copy and then paste over here.

15
00:01:20,820 --> 00:01:29,460
Also with multiple cities, event groups with multiple cities, right, there's a descriptive name.

16
00:01:33,360 --> 00:01:34,890
A copy over here like this.

17
00:01:40,040 --> 00:01:40,910
Click over here.

18
00:01:43,270 --> 00:01:43,840
And then.

19
00:01:46,380 --> 00:01:47,490
May not see for.

20
00:01:49,840 --> 00:01:51,790
OK, so over here.

21
00:01:55,180 --> 00:01:57,160
I'm going to clean all the.

22
00:02:00,320 --> 00:02:05,510
ARTUS related stuff so that we start from scratch to avoid confusion.

23
00:02:06,560 --> 00:02:07,120
OK.

24
00:02:14,770 --> 00:02:16,030
So this is our project.

25
00:02:17,560 --> 00:02:26,080
There is nothing here with regards to vent groups, we just have our projects, no artists, OK, we

26
00:02:26,080 --> 00:02:27,640
are going to create three.

27
00:02:28,810 --> 00:02:35,590
Events bids one for each, tasks one, one for each task, we're going to have three input tasks.

28
00:02:36,400 --> 00:02:44,800
So I'm going to start off by saying defined task one bit with zero task to bit task three bit.

29
00:02:45,010 --> 00:02:50,860
OK, once that is done, I'm going to declare a handle for an event group that we shall have.

30
00:02:51,580 --> 00:02:55,000
We have this event group and then once this is done.

31
00:02:57,620 --> 00:03:05,540
I'm going to create the event group and store the handle in the handle variable event group create and

32
00:03:05,540 --> 00:03:10,550
then we start the handle here and then I'm going to create three input tasks.

33
00:03:11,100 --> 00:03:12,560
I'm going to create three tasks.

34
00:03:13,160 --> 00:03:19,580
They'll call them input tasks is really difficult for me to pronounce the word tasks in plural, you

35
00:03:19,580 --> 00:03:19,810
know.

36
00:03:21,980 --> 00:03:22,370
Yeah.

37
00:03:22,370 --> 00:03:24,100
So we have these three of them.

38
00:03:24,500 --> 00:03:25,450
We have input.

39
00:03:25,460 --> 00:03:28,340
Ask one input task to input task three.

40
00:03:28,700 --> 00:03:32,140
They have the same stack size, the same priority.

41
00:03:32,480 --> 00:03:35,060
We're going to create one output task.

42
00:03:38,600 --> 00:03:40,670
We have one political task here.

43
00:03:40,830 --> 00:03:47,720
OK, and the name of the task function will be input task one, task two, three, etc. And once this

44
00:03:47,720 --> 00:03:50,660
is done, we going to start our scheduler.

45
00:03:52,360 --> 00:03:57,370
Like this, OK, so once that is done, we go into.

46
00:03:59,260 --> 00:04:03,480
We're going to define we're going to define a delay amount.

47
00:04:03,850 --> 00:04:06,610
We're going to be applying some delay 500 mistily.

48
00:04:07,000 --> 00:04:14,030
I'm going to define this Constancia code, you know, delay 500 times.

49
00:04:14,050 --> 00:04:15,340
And this equals this.

50
00:04:15,460 --> 00:04:18,280
It would be stored in this very X delay 500 times.

51
00:04:18,880 --> 00:04:26,200
OK, so each input task will simply do something and then set its event, you know, event A.

52
00:04:27,040 --> 00:04:29,680
So let's start with input to task one.

53
00:04:31,010 --> 00:04:31,470
Input.

54
00:04:31,520 --> 00:04:33,430
Task one would come over here.

55
00:04:35,840 --> 00:04:41,760
And it's a one loop, let's say you have a complex system in your input.

56
00:04:41,780 --> 00:04:45,500
Task one, you do something, you first do something.

57
00:04:48,970 --> 00:04:56,020
And then you set the events a bit to tell the events group that, OK, you are done, the events bits

58
00:04:56,020 --> 00:04:59,240
should be set so that they take it to the next level, if you may.

59
00:04:59,860 --> 00:05:06,520
This could be a data acquisition system that acquires the data and then sets the event bits for a different

60
00:05:06,520 --> 00:05:08,950
task to process the data.

61
00:05:09,430 --> 00:05:16,620
OK, so imputed task one is going to set its particular event, but which is task one bit.

62
00:05:17,500 --> 00:05:19,420
So input task to.

63
00:05:20,770 --> 00:05:28,300
Which is the same will set its own event bit, so this can be another Senso, which you are quite on

64
00:05:28,300 --> 00:05:31,900
data, different type of Senso, it's acquired the data.

65
00:05:31,900 --> 00:05:34,390
So it would say, OK, I've grabbed the data.

66
00:05:34,810 --> 00:05:40,090
So it sets its event bit and the same for Inputs Task three.

67
00:05:44,750 --> 00:05:48,300
It's going to set its own event a bit here like this.

68
00:05:48,980 --> 00:05:57,110
OK, so once this is done, we're going to have our output task, which is like the central task that

69
00:05:57,110 --> 00:06:05,240
receives the event, beautiful from all of the input tasks and then process it does the processing that

70
00:06:05,240 --> 00:06:05,930
is required.

71
00:06:05,930 --> 00:06:09,470
And in our case, the processing is as simple as printing a confirmation.

72
00:06:10,130 --> 00:06:17,810
So over here, because we have three events, bids or task bids, we have to combine all of them into

73
00:06:17,810 --> 00:06:18,520
one variable.

74
00:06:19,790 --> 00:06:26,360
So our bids to wait for is task one bit, task two bit and task three.

75
00:06:26,360 --> 00:06:30,020
But once that's done, we're going to define an event.

76
00:06:31,920 --> 00:06:38,730
An event group value here, which is of type event, it's going to define event of its year so that

77
00:06:38,970 --> 00:06:43,440
the value returned from the event group will be stored in this bit so that we can know which one is

78
00:06:43,440 --> 00:06:44,830
certain which isn't set.

79
00:06:45,420 --> 00:06:49,950
So just like we did before we go into check, which is set.

80
00:06:52,810 --> 00:06:53,300
OK.

81
00:06:53,800 --> 00:06:55,510
Exactly as we did before.

82
00:06:56,100 --> 00:07:04,390
OK, so then just like we did again, we go into use and if conditioned to check which of them is set.

83
00:07:05,290 --> 00:07:11,650
So over here we're saying if tasc one bit is set mean and if it's not equal to zero, then we print

84
00:07:11,650 --> 00:07:16,330
which task events with zero sets if task to events.

85
00:07:16,330 --> 00:07:18,610
Which one is task three events bit.

86
00:07:19,510 --> 00:07:24,430
To so I'll just put the name of the tasks here so that.

87
00:07:25,760 --> 00:07:26,910
We don't get confused.

88
00:07:26,930 --> 00:07:28,340
So this is task one.

89
00:07:31,020 --> 00:07:32,250
This is talk to.

90
00:07:34,940 --> 00:07:36,380
This is task three.

91
00:07:37,010 --> 00:07:37,490
OK.

92
00:07:39,590 --> 00:07:42,530
Let's build and see a click over here to build.

93
00:07:45,070 --> 00:07:45,780
OK.

94
00:07:46,870 --> 00:07:57,400
We have to put a function prototypes, a common mistake, we put task three and then we change this

95
00:07:58,360 --> 00:08:00,070
to one and to two.

96
00:08:01,830 --> 00:08:08,430
Semicolon here, seven here and output task should be down here.

97
00:08:10,350 --> 00:08:11,760
We grabbed this prototype.

98
00:08:15,340 --> 00:08:19,780
Pull over here and then click over here to build.

99
00:08:23,490 --> 00:08:24,810
It's built successfully.

100
00:08:26,040 --> 00:08:27,270
Right, click over here.

101
00:08:28,680 --> 00:08:31,320
We see Dybbuk, US Ystem 32.

102
00:08:32,520 --> 00:08:33,870
You selected twenty nine.

103
00:08:36,010 --> 00:08:37,030
We say, OK.

104
00:08:42,890 --> 00:08:44,630
It's opening click to switch.

105
00:08:49,640 --> 00:08:50,570
We create space.

106
00:08:50,900 --> 00:08:52,570
I'm going to clear what we have here.

107
00:08:56,730 --> 00:08:58,260
Then I'm going to click to run.

108
00:09:02,750 --> 00:09:06,410
Going to open Oshiro, as you can see, we're receiving it.

109
00:09:06,840 --> 00:09:08,300
OK, I'm going to post this.

110
00:09:08,390 --> 00:09:08,840
I see.

111
00:09:09,530 --> 00:09:13,100
Which read in TASC event, but zero was set for task one.

112
00:09:13,610 --> 00:09:18,440
You have event events, but one was set for task to event with three or four task three.

113
00:09:18,680 --> 00:09:26,480
So all events which are being said the respective task said their own event bits and the central task,

114
00:09:26,480 --> 00:09:28,730
which is the output task reads them.

115
00:09:29,000 --> 00:09:37,910
OK, so we can experiment further by preventing one of the tasks from setting its event a bit.

116
00:09:37,910 --> 00:09:43,550
And let's see whether we we wouldn't see that tasks get printed here.

117
00:09:45,120 --> 00:09:53,940
Oh, come over here and I'm going to nominate task to empathise, to not to set its event bit, so I'll

118
00:09:53,940 --> 00:09:54,730
comment this out.

119
00:09:54,930 --> 00:09:55,860
Click here to build.

120
00:10:01,900 --> 00:10:03,610
Then click here to go to the iboga.

121
00:10:08,680 --> 00:10:09,580
Click here to switch.

122
00:10:19,010 --> 00:10:22,370
I'll Claire, what we have over here, a click to run.

123
00:10:23,920 --> 00:10:31,480
And then I'll click to open my support over here and I'll post, as you can see, we no longer have.

124
00:10:32,390 --> 00:10:34,610
We no longer have a task to here.

125
00:10:34,640 --> 00:10:36,430
We have one in three, just one in three.

126
00:10:37,010 --> 00:10:43,440
So this is how we use events, events, bits in an event, a group with a second example.

127
00:10:43,460 --> 00:10:49,100
I'm sure it's getting clearer and clearer what you can use this feature of the realtime operating system

128
00:10:49,100 --> 00:10:50,690
to achieve this.

129
00:10:50,690 --> 00:10:52,030
All the risk for this lesson.

130
00:10:52,030 --> 00:10:55,650
And if you have any questions, leave them in the questions and answers.

131
00:10:55,650 --> 00:10:57,120
So, yeah, I'll see you later.

132
00:10:57,140 --> 00:10:57,910
Have a nice day.
