1
00:00:01,120 --> 00:00:02,290
Hello, welcome back.

2
00:00:02,920 --> 00:00:11,020
So in this lesson, we going to create our tasks, we configured our system in the previous lesson by

3
00:00:11,020 --> 00:00:19,390
including our Ewart's configuration, and then we cleaned up the system and then we said we're going

4
00:00:19,390 --> 00:00:28,950
to use free ARTUS functions, not the the cube, not the societies functions, I should say.

5
00:00:29,440 --> 00:00:38,770
OK, so we're going to work with our very first function to the very first function as the create task

6
00:00:38,770 --> 00:00:39,310
function.

7
00:00:40,670 --> 00:00:48,110
Or the task created to function as it is written, so this function allows us to create a task.

8
00:00:49,160 --> 00:00:56,720
And the function is quite simple, it takes six argument, the first argument is a pointer to the task

9
00:00:56,720 --> 00:00:57,220
function.

10
00:00:57,500 --> 00:01:01,880
Remember, each task has a function which has an infinite loop.

11
00:01:03,110 --> 00:01:08,230
And it's within this task function, that's what we want a task to perform is pleased.

12
00:01:08,990 --> 00:01:18,670
OK, so the first argument of this state, this task creates function, is appointed to this task function.

13
00:01:18,680 --> 00:01:23,630
I keep saying function the function, let's get to it so that we see that it's not just me messing up

14
00:01:23,630 --> 00:01:24,160
with names.

15
00:01:25,220 --> 00:01:27,590
So to start off, I'm going to come over here.

16
00:01:28,820 --> 00:01:31,700
I'm going to create a task I call the function.

17
00:01:31,700 --> 00:01:34,970
The function here is X task create.

18
00:01:37,060 --> 00:01:37,540
OK.

19
00:01:38,960 --> 00:01:39,350
So.

20
00:01:40,640 --> 00:01:46,250
The first argument has to be our task function, let's say I'm going to have a task called.

21
00:01:47,210 --> 00:01:48,300
Blue lady control.

22
00:01:48,390 --> 00:01:56,000
Let's just see tasks controlling various abilities, so I'll come down here to create a function for

23
00:01:56,000 --> 00:01:58,760
this task, so I'll see void over here.

24
00:01:58,840 --> 00:02:05,480
Task functions have to have to return void, meaning they retain nothing and they have to take a single

25
00:02:05,480 --> 00:02:06,210
parameter.

26
00:02:06,590 --> 00:02:11,810
So I call this V Blue Alyda controller task.

27
00:02:15,420 --> 00:02:22,290
And then I'll see Voight over here and then P v over here parameters.

28
00:02:28,300 --> 00:02:31,330
And then in here, I'm going to have a while, one loop.

29
00:02:34,190 --> 00:02:39,170
OK, so when we execute in this, we'll get stuck here, the only way you come out of this one loop

30
00:02:39,290 --> 00:02:42,920
is when the scheduler switches to the next task.

31
00:02:43,460 --> 00:02:45,290
OK, so this is a task function.

32
00:02:45,410 --> 00:02:47,400
When we say a task function, this is it.

33
00:02:47,630 --> 00:02:52,190
So we're going to create a task for blue led to control Blue Alyda.

34
00:02:52,310 --> 00:02:58,460
We just assuming we have a system that has various leads and each of them is managed by its own task.

35
00:02:58,940 --> 00:03:01,520
OK, so we have this task function here.

36
00:03:03,190 --> 00:03:09,190
So once we've created this function, I'll copy its prototype and bring it to the top here because we

37
00:03:09,190 --> 00:03:14,410
want to access it in the main function and the main function is above this function.

38
00:03:14,560 --> 00:03:17,020
So we have to put a prototype here.

39
00:03:19,300 --> 00:03:27,210
OK, so this is our task function X task create the first document is the name of our task function,

40
00:03:27,220 --> 00:03:31,300
so I'll copy this place, this over here, the second document.

41
00:03:32,310 --> 00:03:37,950
This is a name we can give to this, a string, this will allow us to be able to view it in a certain

42
00:03:37,950 --> 00:03:38,520
debuggers.

43
00:03:38,850 --> 00:03:43,200
So it's supposed to be a string, a human readable name.

44
00:03:43,200 --> 00:03:44,790
You want to recognize this by.

45
00:03:44,790 --> 00:03:46,880
So I call this blue controller.

46
00:03:49,620 --> 00:03:52,940
The deferred argument is stuck.

47
00:03:53,130 --> 00:03:57,450
The amount of stock you want to allocate to this function will pass 100 here.

48
00:03:59,160 --> 00:04:07,830
And then the fourth argument is the argument you want to pass, the argument you want to pass to this

49
00:04:07,830 --> 00:04:10,410
task or the parameters.

50
00:04:10,710 --> 00:04:12,380
Remember Peevey parameters here.

51
00:04:12,660 --> 00:04:16,470
We'll see how to make use of this for arguments later.

52
00:04:16,480 --> 00:04:18,390
But for now, I'm going to pass null.

53
00:04:19,170 --> 00:04:19,620
Right.

54
00:04:20,100 --> 00:04:25,230
And then the next argument, arguments number five, is the task priority.

55
00:04:25,920 --> 00:04:27,680
I'm going to pass one over here.

56
00:04:28,260 --> 00:04:33,330
And then finally, the last argument is a Hando for the task.

57
00:04:33,330 --> 00:04:39,540
You want to create a handle and from the handle, like the name implies, you can use it to reach the

58
00:04:39,540 --> 00:04:43,180
task information and to make that task do other functions.

59
00:04:43,560 --> 00:04:45,810
For now, we're not going to use Hindoos.

60
00:04:45,810 --> 00:04:48,320
So I'm going to pass Nalle over here as well.

61
00:04:50,730 --> 00:04:59,340
Like this, OK, so essentially we've created a task and a task here is going to be executing the content

62
00:04:59,340 --> 00:05:00,560
of this function here.

63
00:05:00,570 --> 00:05:08,010
Code blue ality controller, we've allocated this amount of stock for it and then we've given it this

64
00:05:08,010 --> 00:05:10,890
priority inside this task, blue lairy controller.

65
00:05:10,920 --> 00:05:12,660
I'm going to drop a simple message here.

66
00:05:13,200 --> 00:05:15,690
I'll say printf is the reason we have to include.

67
00:05:15,690 --> 00:05:17,210
Printf printf.

68
00:05:19,620 --> 00:05:21,210
And then I simply see.

69
00:05:31,630 --> 00:05:36,990
OK, I'll see Blue Lady Controller TASC running, OK?

70
00:05:41,560 --> 00:05:42,910
OK, so.

71
00:05:44,160 --> 00:05:48,690
After we've done this, all we have to do is call the task start.

72
00:05:49,200 --> 00:05:57,210
We have to start as scheduled so that our schedule starts, you know, scheduling and managing the tasks,

73
00:05:57,490 --> 00:05:57,880
OK?

74
00:05:58,020 --> 00:05:59,700
So currently we have just one task.

75
00:06:00,270 --> 00:06:03,530
So void task starts scheduler.

76
00:06:08,150 --> 00:06:08,620
OK.

77
00:06:13,420 --> 00:06:14,590
Click over here to build.

78
00:06:18,620 --> 00:06:20,120
No error, no warning.

79
00:06:21,350 --> 00:06:24,830
OK, I'm going to go to the back over here.

80
00:06:29,330 --> 00:06:29,990
uSwitch.

81
00:06:33,450 --> 00:06:37,270
I'm going to open Terrytown to see what we have open in real time.

82
00:06:37,290 --> 00:06:43,110
This is real Tim Aiport over here, as we know, is this boat, right?

83
00:06:43,110 --> 00:06:45,120
And my port eSports number 16.

84
00:06:45,900 --> 00:06:52,380
I'll click open over here and then I'll click run and then I'll minimize this so that we can see the

85
00:06:52,380 --> 00:06:54,420
contents of real Tim.

86
00:06:57,070 --> 00:07:01,720
As you can see, the lead controller task is running, right?

87
00:07:02,450 --> 00:07:06,340
OK, so what can we learn from this?

88
00:07:10,010 --> 00:07:11,300
I'm going to come out here.

89
00:07:17,540 --> 00:07:19,370
As you can see, we have.

90
00:07:20,510 --> 00:07:22,160
We have nothing in our.

91
00:07:25,480 --> 00:07:34,300
OK, and this is actually interesting, right, so we have our hello from SDM 32 printf statements that

92
00:07:34,300 --> 00:07:39,610
existed from our previous previous project when we configured the system.

93
00:07:40,850 --> 00:07:48,620
Right, but when we check rootin, we don't see any of that executing, so because our scheduler started

94
00:07:48,650 --> 00:07:51,700
this block of code is not reachable, it is unreachable.

95
00:07:52,070 --> 00:07:53,540
So that is why we don't see this.

96
00:07:54,110 --> 00:08:01,850
And more interesting, you don't find anywhere in main function that we are sort of executing this.

97
00:08:02,510 --> 00:08:03,490
We are printing this.

98
00:08:03,740 --> 00:08:08,390
So this shows that we actually execute in the function of the artist.

99
00:08:08,810 --> 00:08:11,330
OK, so I'm going to delete this now.

100
00:08:11,340 --> 00:08:16,580
We're not going to be using one loop here or we have to do is create a task and then a task over.

101
00:08:16,820 --> 00:08:18,260
I'm going to add another task.

102
00:08:18,260 --> 00:08:20,240
I'll make a copy of this task.

103
00:08:21,520 --> 00:08:28,540
Control and then control, easy to copy control of each patient, I'll call this one red alert controller.

104
00:08:31,310 --> 00:08:31,850
And then.

105
00:08:34,300 --> 00:08:40,990
I'll create a task function for this code red alert controller, so I'm simply going to copy this.

106
00:08:42,330 --> 00:08:50,990
Controversy and then I'll change the name here, red alert controller change.

107
00:08:51,030 --> 00:08:58,890
What is going to be printed red the controller and then out its prototype here, control to copy, control

108
00:08:58,890 --> 00:08:59,670
V to paste.

109
00:09:00,570 --> 00:09:05,160
And then the name here, this red light controller.

110
00:09:05,910 --> 00:09:08,730
And then I'm going to add another one controversy.

111
00:09:13,330 --> 00:09:19,750
This one, I'm going to call it Blue Élodie controller, and then this one here is blue.

112
00:09:22,040 --> 00:09:22,550
And then.

113
00:09:24,520 --> 00:09:27,040
Oh, goodness, I'm losing my mind.

114
00:09:27,070 --> 00:09:32,980
We already have blue, so this could be green green LEDs controller.

115
00:09:35,260 --> 00:09:36,670
Green light controller.

116
00:09:37,880 --> 00:09:42,980
And I'm going to make a copy, I'm going to create a task function for this, I'll call this green lady

117
00:09:43,010 --> 00:09:43,620
controller.

118
00:09:44,060 --> 00:09:46,160
So this word red becomes green.

119
00:09:48,140 --> 00:09:55,580
So there is green algae control here, green algae, control of green algae control, I'm going to create

120
00:09:55,580 --> 00:09:59,270
a prototype for this controversy controversy.

121
00:09:59,930 --> 00:10:03,140
And then this is green algae controller.

122
00:10:03,560 --> 00:10:04,580
This has to be up to.

123
00:10:07,100 --> 00:10:15,740
OK, so let's build this and see now we have three tasks, each of them have the task functions to click

124
00:10:15,740 --> 00:10:16,850
over here control.

125
00:10:18,050 --> 00:10:20,340
I'll click over here to build Sloboda.

126
00:10:21,110 --> 00:10:25,400
I'm used to other ideas where you can just, you know, press shortcuts.

127
00:10:25,910 --> 00:10:28,880
This probably has a shortcuts to build, but.

128
00:10:29,840 --> 00:10:34,850
Yeah, so anyway, we've got no error, I'll click over here, Dybbuk.

129
00:10:38,780 --> 00:10:39,440
uSwitch.

130
00:10:40,640 --> 00:10:48,050
This is real time, I'll real to take over here to Claire and then I'll click it play no less you real

131
00:10:48,050 --> 00:10:48,380
to.

132
00:10:52,600 --> 00:10:54,420
Term is not responding.

133
00:10:57,340 --> 00:10:58,930
Let's stop and see what we have.

134
00:11:00,910 --> 00:11:03,940
All you transmutes that's come out.

135
00:11:08,150 --> 00:11:14,600
OK, so real time is not responded in this course was going to happen is we're going to debunk everything

136
00:11:14,600 --> 00:11:15,120
together.

137
00:11:15,500 --> 00:11:23,290
I'm not going to make a clean course where there are no issues and there are no opportunities to debug.

138
00:11:23,300 --> 00:11:24,540
I think that's really useful.

139
00:11:25,130 --> 00:11:25,580
So.

140
00:11:26,660 --> 00:11:28,920
I I'm coming back here.

141
00:11:28,970 --> 00:11:30,360
I went out of the bag for you.

142
00:11:30,380 --> 00:11:31,770
I'm coming back into the bag for you.

143
00:11:31,790 --> 00:11:33,260
I'm going to click play again.

144
00:11:34,650 --> 00:11:37,290
OK, click here to play.

145
00:11:38,550 --> 00:11:44,880
The reason I'm laughing is because this another learning opportunity, a click here to clean and then

146
00:11:45,630 --> 00:11:46,740
open real time again.

147
00:11:48,030 --> 00:11:49,980
You see, real time is not responding, writes.

148
00:11:51,010 --> 00:11:56,770
I'll come out here, I'll come out again, just bear with me, and what I'm going to do is I'm going

149
00:11:56,770 --> 00:12:03,100
to comment the printf statement in two of the tasks such that just one task has printf.

150
00:12:03,550 --> 00:12:09,100
So we just blew has printf or because we've seen blue before, I'm just going to make sure just read

151
00:12:09,100 --> 00:12:09,580
Hotspring.

152
00:12:09,580 --> 00:12:12,970
If the others do not, I'll click over here to build.

153
00:12:17,320 --> 00:12:18,880
And then I'll click over here, debark.

154
00:12:22,780 --> 00:12:29,470
Switch over here, a school to to OK, this real time, I'll Clarington first.

155
00:12:30,660 --> 00:12:31,260
And then.

156
00:12:32,640 --> 00:12:34,080
I'll quickly over here.

157
00:12:40,590 --> 00:12:44,340
I'm going to restart Realto.

158
00:12:47,420 --> 00:12:48,440
OK, so.

159
00:12:49,330 --> 00:12:51,040
This real iSelect.

160
00:12:53,820 --> 00:12:56,400
This, then Kosilek, this.

161
00:13:06,530 --> 00:13:07,460
You know, play.

162
00:13:12,460 --> 00:13:14,790
OK, real time is not responded.

163
00:13:17,500 --> 00:13:24,260
OK, let's exit this, I would explain the landing opportunity, I meant before that.

164
00:13:24,280 --> 00:13:25,090
Let's see this.

165
00:13:25,690 --> 00:13:28,660
Let's make sure our system is configured properly.

166
00:13:29,080 --> 00:13:31,750
So this is green and red leidy's.

167
00:13:32,880 --> 00:13:33,930
And then the tasks.

168
00:13:39,530 --> 00:13:43,790
All of them have their prototypes, as they ought to have.

169
00:13:51,980 --> 00:13:59,140
And we use them printed only in red red me control controller running, OK.

170
00:14:00,240 --> 00:14:00,720
So.

171
00:14:06,050 --> 00:14:13,100
So one thing we would notice here is all our tasks have the same priority, all of them have a priority

172
00:14:13,100 --> 00:14:13,570
of one.

173
00:14:13,850 --> 00:14:17,880
And in the free AHTO system, the lower the priority number, the higher it is.

174
00:14:18,260 --> 00:14:25,130
So if I change the priority of other tasks, let's say I change blue to two and then green to three,

175
00:14:26,240 --> 00:14:28,540
then task red would have the highest priority.

176
00:14:28,550 --> 00:14:30,320
But currently they all have the highest.

177
00:14:30,890 --> 00:14:32,590
They all have the same priority.

178
00:14:33,110 --> 00:14:40,010
So no one is given preferential treatment over the other and they are all expecting to have access to

179
00:14:40,010 --> 00:14:40,740
the Processo.

180
00:14:41,180 --> 00:14:43,190
So the process of Rosewarne for a bit.

181
00:14:43,190 --> 00:14:47,610
And then he goes on to the next one and then he runs the next one and then he goes on to the third.

182
00:14:48,100 --> 00:14:56,060
OK, but we want to see that reducing this, making sure just enough is left.

183
00:14:57,910 --> 00:15:04,810
We want to see if this allows us making sure just red task issues in print, if this allows us to print

184
00:15:05,020 --> 00:15:10,450
this, if this doesn't allow us to print this, then there are a number of things we can learn from

185
00:15:10,450 --> 00:15:10,750
this.

186
00:15:11,230 --> 00:15:12,640
OK, I'll click to build again.

187
00:15:13,150 --> 00:15:15,670
What is really going to happen.

188
00:15:16,550 --> 00:15:18,580
Let's see a click to go to the debug view.

189
00:15:20,070 --> 00:15:20,760
And this is.

190
00:15:25,350 --> 00:15:26,510
A switch over here.

191
00:15:30,370 --> 00:15:34,730
OK, so whenever we run, we see something a little happen here.

192
00:15:35,440 --> 00:15:37,960
OK, this means our real time is fine.

193
00:15:38,150 --> 00:15:40,870
It's just the firmware given the data.

194
00:15:41,590 --> 00:15:45,580
OK, so we run in by real time.

195
00:15:45,580 --> 00:15:47,140
It's not printing everything.

196
00:15:47,920 --> 00:15:51,990
OK, so I'll let you guess what is happening.

197
00:15:52,510 --> 00:15:55,390
What I'm going to do is I'm going to comment out one task.

198
00:15:56,390 --> 00:16:00,650
I'll comment on screen, OK, we comment on green.

199
00:16:01,610 --> 00:16:03,830
Meaning green no longer exist.

200
00:16:04,220 --> 00:16:08,270
We can leave that task function as it is a click over here to build.

201
00:16:11,120 --> 00:16:14,180
And then click over here to go to the box you.

202
00:16:18,580 --> 00:16:20,050
And then switch over here.

203
00:16:25,240 --> 00:16:27,820
And then I'll click to run the AC.

204
00:16:29,300 --> 00:16:30,860
I open my port here.

205
00:16:40,260 --> 00:16:41,640
OK, see?

206
00:16:44,730 --> 00:16:46,560
Oh, this is my sports.

207
00:16:52,880 --> 00:16:53,310
Right.

208
00:16:53,610 --> 00:16:58,730
So we getting the idea that there's a problem to do with time.

209
00:17:00,010 --> 00:17:09,820
It's as if the task is not getting enough time to print what it's supposed to print, right, to confirm

210
00:17:09,820 --> 00:17:13,630
this, what I'm going to do is I'm going to comment out blue task.

211
00:17:14,780 --> 00:17:19,330
I'm going to comment on blue task such that we just have red task and let's see what would happen.

212
00:17:19,850 --> 00:17:20,980
Click over here to build.

213
00:17:24,700 --> 00:17:26,800
And then go to debulked you over here.

214
00:17:30,420 --> 00:17:30,990
Switch.

215
00:17:34,900 --> 00:17:36,970
And then where is Terrytown?

216
00:17:37,890 --> 00:17:44,880
OK, it's actually started on its own, I'll click over here to run, as you can see, read ality controller

217
00:17:44,890 --> 00:17:46,870
task is running, OK?

218
00:17:46,980 --> 00:17:48,120
So what does this mean?

219
00:17:48,300 --> 00:17:50,400
Does it mean we can have just one task?

220
00:17:51,030 --> 00:17:51,410
Right.

221
00:17:51,420 --> 00:17:56,760
It's necessary that we went through all the roadblocks to get to this rather than me telling you what

222
00:17:56,790 --> 00:17:57,470
has to be done.

223
00:17:58,020 --> 00:17:58,980
What does this mean?

224
00:17:59,120 --> 00:18:03,990
This means that the hardware that we're trying to access takes too much time.

225
00:18:03,990 --> 00:18:12,060
It takes more time than the the tiny piece of time allocated for each task to execute before the scheduler

226
00:18:12,270 --> 00:18:13,830
switches to the next task.

227
00:18:14,970 --> 00:18:21,960
So there's something known as a time slice or a time quanta when you have tasks, multiple tasks of

228
00:18:21,960 --> 00:18:26,240
the same priority, each task will run for a particular time quanta.

229
00:18:26,580 --> 00:18:33,300
And as soon as that timeout occurs, regardless of whether you are done executing something important

230
00:18:33,300 --> 00:18:38,280
or not, the scheduler would pause that task and then go onto the next one.

231
00:18:39,600 --> 00:18:48,180
So because of where you are to requires more time to produce all of what he has to produce or print

232
00:18:48,210 --> 00:18:55,590
out all of what he has to print out, it never gets the amount of time it requires to perfectly print

233
00:18:55,590 --> 00:19:02,280
out its information or to print out all of its information before the scheduler is taken from the task

234
00:19:02,280 --> 00:19:03,780
and then given to another task.

235
00:19:04,350 --> 00:19:07,590
So that is what we just we just experienced.

236
00:19:07,830 --> 00:19:15,240
Later on, we shall see how to assign priorities to tasks such that we know that, OK, each task is

237
00:19:15,240 --> 00:19:17,370
treated with this amount of time.

238
00:19:17,370 --> 00:19:21,630
But this particular task, we want you to give this one priority.

239
00:19:21,640 --> 00:19:23,430
We'll see how to assign priorities.

240
00:19:24,510 --> 00:19:31,800
And even when we start assigning priorities, would still face instances where you would have two tasks,

241
00:19:32,070 --> 00:19:35,400
trying to access the same resource at the same time.

242
00:19:36,390 --> 00:19:42,570
And with that, we would use another ARTUS tool known as semaphores and mutex.

243
00:19:43,020 --> 00:19:49,080
We use them to to enable exclusive access to a particular resource.

244
00:19:49,200 --> 00:19:53,560
And a resource can be an LCD screen that you, outsports, et cetera.

245
00:19:54,000 --> 00:20:01,980
So this simple experiment has shown us some of the issues that we would have to be keeping in mind and

246
00:20:01,980 --> 00:20:04,310
designing our system to conform around.

247
00:20:04,650 --> 00:20:05,050
Right.

248
00:20:05,310 --> 00:20:09,600
So then the question becomes, OK, now we see that we can.

249
00:20:11,060 --> 00:20:17,750
We can print from just one task, this long sentence, so then how do we know the other tasks are executing?

250
00:20:18,200 --> 00:20:23,320
This will introduce us or this brings us to one other debugging tool that we shall use.

251
00:20:23,870 --> 00:20:26,500
This is known as the task profiler.

252
00:20:26,500 --> 00:20:28,340
We're going to create task profilers.

253
00:20:28,490 --> 00:20:32,180
And these are just global variables that we would place in each task.

254
00:20:32,390 --> 00:20:39,560
And when the global variable increments, we know that a task is executed and when the incremental value

255
00:20:39,740 --> 00:20:46,100
of all global variables are the same, then we would know that the tasks executed at the same rate the

256
00:20:46,100 --> 00:20:48,000
order are offered the same amount of time.

257
00:20:48,560 --> 00:20:50,720
So to do that, I'm going to comment.

258
00:20:52,350 --> 00:21:02,700
All of our other tasks here will come up with three tasks over here, so I'm going to I'm going to take

259
00:21:02,700 --> 00:21:03,780
out the prenups.

260
00:21:06,580 --> 00:21:07,090
OK.

261
00:21:08,580 --> 00:21:09,010
Right.

262
00:21:09,330 --> 00:21:16,950
So then I'm going to come over here, I'll use I'll say typedef typedef is used to create a new type

263
00:21:17,130 --> 00:21:19,260
to rename it an already existing type.

264
00:21:19,260 --> 00:21:24,540
So she typed a few into that to underscore T and then I'll see this.

265
00:21:24,540 --> 00:21:26,970
I want to call task profiler.

266
00:21:30,330 --> 00:21:37,920
So now, whenever I want to whenever I want to say you said it to an escort, you could simply use the

267
00:21:37,920 --> 00:21:41,700
word typedef, OK, and we use TYPEDEF to improve readability.

268
00:21:41,880 --> 00:21:47,280
So now I'll come, I'll come down here, say typedef and then I'll say.

269
00:21:52,220 --> 00:21:53,120
Blue Tosk.

270
00:21:55,330 --> 00:22:00,370
Profiler and then I have another one for Red.

271
00:22:03,480 --> 00:22:08,600
We have read, we do have read, and then I'll have another one for Green.

272
00:22:13,210 --> 00:22:18,790
OK, so then what is going to happen is I'm going to copy Blue Task profile up and then I'm going to

273
00:22:18,790 --> 00:22:23,740
drop it inside a blue one and then increment and then red.

274
00:22:23,770 --> 00:22:27,280
I'll drop it inside red and then this increment.

275
00:22:31,100 --> 00:22:33,850
And then green or drop it inside green over here.

276
00:22:35,100 --> 00:22:36,480
Then this increments.

277
00:22:40,610 --> 00:22:44,390
OK, so I'm going to click over here to build.

278
00:22:48,540 --> 00:22:50,280
Oh, goodness, Castle.

279
00:22:50,310 --> 00:22:52,500
I want to build first click over here to build.

280
00:22:55,980 --> 00:22:58,420
OK, we have no warning, no error.

281
00:22:58,620 --> 00:22:59,940
Click here to go to Debugger.

282
00:23:08,700 --> 00:23:11,930
As the debugger opening, OK, it's opening up.

283
00:23:13,610 --> 00:23:14,270
uSwitch.

284
00:23:19,180 --> 00:23:25,210
So what we want to do is come over here, we have live expressions window here, we want to put our

285
00:23:25,210 --> 00:23:27,520
global variables here to observe them.

286
00:23:28,920 --> 00:23:35,640
In other ideas, like how you vision, this is known as the watch window, OK, so to put this in that

287
00:23:35,640 --> 00:23:42,600
live expression, I'm going to copy this global variable Code Blue Task profile, copy this and then

288
00:23:42,600 --> 00:23:48,030
I'll come to live expressions and then I'll paste our hits, enter and then I'll copy Red.

289
00:23:48,360 --> 00:23:57,840
Copy this, a paste or hit enter and then I'll copy Green copy this or paste and then I'll hit enter

290
00:23:58,140 --> 00:23:59,430
and then I'll click here to run.

291
00:24:00,210 --> 00:24:07,170
As you can see, the variables are incrementing and they have almost the same value, meaning each task

292
00:24:07,170 --> 00:24:11,790
is given the same amount of time to execute because they have the same priority as we saw.

293
00:24:12,180 --> 00:24:17,390
So this is another way of knowing whether your task is executed or not executed.

294
00:24:17,550 --> 00:24:18,660
These are simple ways.

295
00:24:19,110 --> 00:24:24,600
Of course, they are more elaborate ways of measuring the Arktos time, using other proofs.

296
00:24:25,410 --> 00:24:33,140
But this will suffice for someone who just has the board and wants to do some simple tests to know whether

297
00:24:33,150 --> 00:24:35,460
a task is functioning or not functioning.

298
00:24:36,000 --> 00:24:40,680
OK, so we've seen how to profile in this lesson.

299
00:24:41,130 --> 00:24:48,930
We also learned that when the hardware you are accessing requires more time than the amount of time

300
00:24:48,930 --> 00:24:52,080
allocated to the task, you might not get it to work.

301
00:24:53,300 --> 00:24:59,990
So that is what happened with we trying to print the sentence using the Ewart's in all of our tasks,

302
00:25:00,860 --> 00:25:04,160
no single task had enough time to bring the sentence.

303
00:25:04,400 --> 00:25:05,820
So that's the lesson here.

304
00:25:06,660 --> 00:25:12,950
OK, and also I want to reiterate that you find it essential that we went through this process together,

305
00:25:13,340 --> 00:25:19,550
hitting the roadblocks and coming back to test other things, to comment out on the part of the system

306
00:25:19,790 --> 00:25:21,850
to see what the cause could be.

307
00:25:22,400 --> 00:25:25,700
I could have cut to this bit out of the the lesson.

308
00:25:25,700 --> 00:25:31,670
I could have just edited this bits out and then given you a perfect lesson with this is how you create

309
00:25:31,670 --> 00:25:32,570
a single tax.

310
00:25:33,260 --> 00:25:35,650
This is how you create a single task, I should say.

311
00:25:35,870 --> 00:25:41,300
And then when you put all you add in the three tasks, it wouldn't work.

312
00:25:41,330 --> 00:25:42,140
So we do this.

313
00:25:42,140 --> 00:25:45,860
I could have done all of that, but rather we saw it together.

314
00:25:45,890 --> 00:25:47,880
So I hope you appreciate it this week.

315
00:25:47,900 --> 00:25:49,460
I don't want some of you to complain.

316
00:25:49,470 --> 00:25:50,990
There's so many fixing of errors.

317
00:25:51,380 --> 00:25:58,090
I mean, I really hope you see this points to some, if you like, getting me in the reviews.

318
00:25:58,100 --> 00:25:59,480
So that is why I'm saying this.

319
00:25:59,480 --> 00:26:03,710
If you are not one of those people, that is fine, but it needs to be stated.

320
00:26:04,260 --> 00:26:05,750
OK, so have a nice day.

321
00:26:05,750 --> 00:26:10,070
If you have any questions, of course you can leave it in the questions and answers area.

322
00:26:10,220 --> 00:26:11,190
And I'll see you later.

323
00:26:11,390 --> 00:26:12,100
Have a nice day.
