1
00:00:00,800 --> 00:00:01,900
Hello, welcome back.

2
00:00:02,450 --> 00:00:10,340
And this lesson, we see how to work with message cues, so we simply make a copy of the last project.

3
00:00:12,080 --> 00:00:15,890
I copy this and I'll paste this over here.

4
00:00:16,610 --> 00:00:18,620
And I call this message Kyuss.

5
00:00:35,640 --> 00:00:39,600
Then we explain this and then we open this.

6
00:00:40,690 --> 00:00:42,040
Made a seat over here.

7
00:00:43,290 --> 00:00:45,590
OK, so like we always do.

8
00:00:45,630 --> 00:00:51,090
Let's go to the documentation and find out what we need to do to create a new message.

9
00:00:51,130 --> 00:00:54,540
Q I'm going to go to our documentation over here.

10
00:00:56,450 --> 00:00:59,270
So we have to go to the queue management section.

11
00:01:01,780 --> 00:01:05,260
Let's see, there is a message queue over here.

12
00:01:13,850 --> 00:01:16,250
So there is a message you create.

13
00:01:20,060 --> 00:01:25,760
Let's click on this and the message to you also has a structure, it takes attributes like we saw for

14
00:01:25,760 --> 00:01:32,660
semaphores, the SEMAFO mutex in the tasks so we can you know, we have to define a structure for us.

15
00:01:32,690 --> 00:01:34,940
Well, let's click on voice message.

16
00:01:35,010 --> 00:01:38,360
You knew the first argument is the message counts.

17
00:01:38,960 --> 00:01:45,850
And then the second argument is the size, the message size, maximum message size invites, it says

18
00:01:45,860 --> 00:01:46,490
over here.

19
00:01:47,060 --> 00:01:52,160
And the third argument is the attributes, whether we are using attributes or not, we can personally,

20
00:01:52,160 --> 00:02:00,020
if we want or we can assign it, we can use one of the message cue attributes members such as a sign

21
00:02:00,020 --> 00:02:00,920
to cue a name.

22
00:02:01,490 --> 00:02:02,000
OK.

23
00:02:04,000 --> 00:02:10,510
So just to be consistent, we're going to define we're going to define an attribute structure for the

24
00:02:10,510 --> 00:02:12,460
message cue to start off.

25
00:02:12,490 --> 00:02:19,180
I'm going to define I'm going to create a variable to hold the message ID, because when we create the

26
00:02:19,630 --> 00:02:22,540
cue is going to return the ID.

27
00:02:22,570 --> 00:02:24,940
We want to store it somewhere so that we can access it.

28
00:02:25,720 --> 00:02:29,040
So I'll create always message cue ID type.

29
00:02:29,050 --> 00:02:32,440
I'll call this MSG covid like this.

30
00:02:33,280 --> 00:02:40,270
OK, once that is done I'm going to create the voice message, cue attribute type and I'm going to call

31
00:02:40,270 --> 00:02:43,240
this MSG cue attributes like this.

32
00:02:43,760 --> 00:02:48,160
And over here we're using just one member in the attribute structure we just given.

33
00:02:48,580 --> 00:02:50,920
It's a name we're using just the name Amber.

34
00:02:51,500 --> 00:03:00,970
OK, so once that is done, we can create the cue by calling our message cue new function and then it's

35
00:03:00,970 --> 00:03:01,540
going to.

36
00:03:03,420 --> 00:03:09,570
It's going to return the idea of the created message, so I'm going to come down here and create a message

37
00:03:09,570 --> 00:03:13,120
for you and the idea is going to be retained and stored here.

38
00:03:13,590 --> 00:03:15,300
This is going to hold five elements.

39
00:03:15,420 --> 00:03:19,270
This the size screen to hold elements of type you in 16.

40
00:03:19,680 --> 00:03:22,170
And this is the attribute we defined up here.

41
00:03:22,770 --> 00:03:31,320
OK, so once that is done, what are we going to do in this experiment is to, um, let's say use the

42
00:03:31,320 --> 00:03:31,770
red.

43
00:03:32,660 --> 00:03:37,640
LCD controller has to send something to the queue and receive it from the blue task.

44
00:03:38,180 --> 00:03:39,230
OK, so.

45
00:03:40,990 --> 00:03:46,310
I'm going to take out our mutex experiment code, this one here.

46
00:03:46,330 --> 00:03:47,350
I'm going to remove it.

47
00:03:49,530 --> 00:03:50,640
And this one here.

48
00:03:52,880 --> 00:03:57,710
OK, so what we're going to do is we agreed to.

49
00:04:00,780 --> 00:04:04,560
Create a variable over here.

50
00:04:06,940 --> 00:04:13,270
Let's see, we said our Q is going to hold you in 16 type, so I'm going to see you in 16.

51
00:04:19,950 --> 00:04:25,460
And then we're going to call this value to send we want to send the year 2050 to the queue.

52
00:04:26,110 --> 00:04:32,460
OK, so then to send we use the always message queue put function to do this.

53
00:04:32,970 --> 00:04:36,660
So I'm simply going to send this by voice message queue put.

54
00:04:37,530 --> 00:04:39,540
This is the one to send to this queue.

55
00:04:39,840 --> 00:04:42,210
So we pass on the idea of the queue here.

56
00:04:42,540 --> 00:04:43,580
Message queue ID.

57
00:04:44,400 --> 00:04:45,660
This is what we want to send.

58
00:04:46,910 --> 00:04:53,340
Over here and then the priority of the message, it's allows us to set priorities and then time out.

59
00:04:53,900 --> 00:05:00,320
OK, let's go to the documentation and find out what we mean by this priority of the message.

60
00:05:03,890 --> 00:05:04,900
Let's see, where are we?

61
00:05:06,300 --> 00:05:10,230
I'm going to click back here so that we can have all the functions.

62
00:05:11,180 --> 00:05:12,980
That's a message you put.

63
00:05:14,060 --> 00:05:16,910
OK, first argument is the message ID.

64
00:05:18,200 --> 00:05:26,150
Pointer to the buffer that contains the data you want to send in a priority and then time out over here,

65
00:05:26,150 --> 00:05:31,400
it says message priority so we can assign priority to the message and then the timeout.

66
00:05:32,420 --> 00:05:37,580
Tynemouth Value O0 in case of Norteños, so we pass in zero for no time.

67
00:05:37,820 --> 00:05:39,250
That's what we have over here.

68
00:05:39,970 --> 00:05:40,490
OK.

69
00:05:42,900 --> 00:05:50,850
So once we've sent this, then we expect to receive this somewhere, we going to use the blue led task

70
00:05:50,850 --> 00:05:51,690
to receive this.

71
00:05:52,710 --> 00:05:54,540
So we're going to declare.

72
00:05:57,110 --> 00:06:03,120
We going to declare two variables here in the blue LCD task.

73
00:06:03,140 --> 00:06:07,220
I'm going to have received message and I'm going to update.

74
00:06:07,620 --> 00:06:17,810
OK, so what I'm going to do is use the OS who has a message to get function to get the message from

75
00:06:17,810 --> 00:06:25,940
the Q The first document is the Q idea of the Q you want to get from the second document over here is

76
00:06:25,940 --> 00:06:29,850
the is the way where you want to store it.

77
00:06:31,580 --> 00:06:36,560
The third argument is the priority and then the last document is the time out.

78
00:06:36,950 --> 00:06:41,690
Over here we say wait forever and once we receive this, it's going to be stored here.

79
00:06:42,050 --> 00:06:48,890
We're going to read it and storage in our data variable and we can print this to our serial port.

80
00:06:51,860 --> 00:06:58,700
I'm making it global, just in case you want to view this and the live expressions, but we can make

81
00:06:58,700 --> 00:06:59,380
this local.

82
00:07:01,140 --> 00:07:06,310
OK, so we still have this because we made a copy of our time, a project.

83
00:07:06,320 --> 00:07:09,230
This can be removed, but I don't want to mess it up, so I'll leave it.

84
00:07:10,340 --> 00:07:12,800
So once we have this, we can print.

85
00:07:15,100 --> 00:07:24,070
We can see the message received is this, and I'll just typecast this to an end to avoid warnings,

86
00:07:25,090 --> 00:07:33,850
so we're simply using message puts and the message you get a squeakier to build.

87
00:07:39,350 --> 00:07:40,010
It's Beurden.

88
00:07:46,410 --> 00:07:47,520
We have one warning.

89
00:07:47,580 --> 00:07:48,600
I see where that is.

90
00:08:00,910 --> 00:08:07,480
Oh, so because we're not using this, OK, so the plan was to view the date or one of the variables

91
00:08:07,480 --> 00:08:08,310
in a watch window.

92
00:08:09,440 --> 00:08:13,070
Since the data is redundant, we can remove the data variable.

93
00:08:14,390 --> 00:08:14,910
OK?

94
00:08:16,400 --> 00:08:16,880
Right.

95
00:08:20,900 --> 00:08:23,250
Let's do it and see a click over here to view it.

96
00:08:28,530 --> 00:08:29,640
To build successfully.

97
00:08:31,890 --> 00:08:33,330
All right, click over here.

98
00:08:34,970 --> 00:08:35,630
I'll see.

99
00:08:36,640 --> 00:08:38,580
Keep us ASTM 30 to.

100
00:08:39,970 --> 00:08:42,160
Double click forty four over here.

101
00:08:45,990 --> 00:08:47,700
And then I'll say, OK, over here.

102
00:08:52,890 --> 00:08:53,580
It's open in.

103
00:08:56,220 --> 00:08:57,000
Click to switch.

104
00:09:00,560 --> 00:09:02,810
Then I'll give space.

105
00:09:08,110 --> 00:09:15,310
And I'll clear what we have over here, open this report, then click to run.

106
00:09:16,550 --> 00:09:24,680
OK, so the message you received is getting this number here, OK, so that is why I think I had the

107
00:09:24,680 --> 00:09:28,730
dates for before because I had tested this.

108
00:09:30,560 --> 00:09:37,040
OK, so to receive it, once we receive from the Buffa, we're going to store it in our variable outdates

109
00:09:37,040 --> 00:09:38,430
variable before we print.

110
00:09:39,150 --> 00:09:39,650
OK.

111
00:09:48,870 --> 00:09:54,920
So over here, I'll simply have a date over here.

112
00:09:56,440 --> 00:10:05,380
And I'll come over here and see when we receive the data storage in the buffer dates because received

113
00:10:05,380 --> 00:10:06,570
message indexer.

114
00:10:09,620 --> 00:10:11,000
Indexer over here.

115
00:10:12,030 --> 00:10:14,130
And this time.

116
00:10:15,200 --> 00:10:19,100
We're going to print dates, this word should be dates, not data.

117
00:10:23,600 --> 00:10:24,050
So.

118
00:10:25,990 --> 00:10:28,030
We print the deeds variable here.

119
00:10:31,830 --> 00:10:32,670
OK, let's see.

120
00:10:34,410 --> 00:10:35,610
Click over here to build.

121
00:10:43,360 --> 00:10:48,850
It's built in to build successfully, and then I'll click to go to the burger.

122
00:10:54,430 --> 00:10:55,090
To in.

123
00:11:02,020 --> 00:11:02,800
Click to switch.

124
00:11:14,830 --> 00:11:16,330
And I'll make way.

125
00:11:19,470 --> 00:11:20,360
Eau Claire, this.

126
00:11:22,320 --> 00:11:23,790
And then a click to run.

127
00:11:26,480 --> 00:11:27,590
That's right, a strange.

128
00:11:29,300 --> 00:11:31,940
OK, let's try to find out where the issue is.

129
00:11:37,070 --> 00:11:37,400
See?

130
00:11:39,080 --> 00:11:39,580
OK.

131
00:11:41,350 --> 00:11:43,090
So we're going to exit this.

132
00:11:47,110 --> 00:11:47,740
Let's see.

133
00:11:49,290 --> 00:11:52,200
Whether we are sending and receiving the right information.

134
00:11:57,100 --> 00:12:01,300
Value to send over here, we send in this.

135
00:12:04,540 --> 00:12:05,110
And then.

136
00:12:07,970 --> 00:12:08,930
A message.

137
00:12:12,660 --> 00:12:13,630
During this year.

138
00:12:14,480 --> 00:12:17,440
And dates and then Prince dates.

139
00:12:20,010 --> 00:12:24,100
To solve this, we can simply make our buffer here global.

140
00:12:24,150 --> 00:12:25,590
I'm going to cut this.

141
00:12:25,920 --> 00:12:27,050
I received a.

142
00:12:28,020 --> 00:12:34,590
And then make Globo over here, we don't need we don't need data anymore, we simply going to print

143
00:12:34,590 --> 00:12:36,460
the contents directly.

144
00:12:37,110 --> 00:12:37,590
Right.

145
00:12:37,710 --> 00:12:39,360
So I'll see print receive.

146
00:12:40,530 --> 00:12:41,940
Message index zero.

147
00:12:42,000 --> 00:12:46,890
I'll type cause this to end, it's already on edge, isn't it?

148
00:12:47,460 --> 00:12:48,630
It's into too.

149
00:12:48,750 --> 00:12:49,740
So we don't need this.

150
00:12:50,350 --> 00:12:51,060
We don't need this.

151
00:12:51,090 --> 00:12:53,550
OK, now let's run and see.

152
00:12:53,550 --> 00:12:54,870
OK, click over here to build.

153
00:13:00,320 --> 00:13:01,010
It's Putin.

154
00:13:02,580 --> 00:13:06,420
It's built successfully and click here to run.

155
00:13:16,080 --> 00:13:16,770
Und.

156
00:13:18,070 --> 00:13:19,030
Let's wait for it.

157
00:13:19,420 --> 00:13:21,850
OK, I'm going to open my cereal port.

158
00:13:24,310 --> 00:13:32,110
And I can see receiving a message receives 20, 50, OK, so this is it, this is how to use message

159
00:13:32,110 --> 00:13:34,910
cues with our Simms's ourselves apps.

160
00:13:35,260 --> 00:13:36,190
So that's all there is.

161
00:13:36,220 --> 00:13:37,030
I'll see you later.

162
00:13:37,060 --> 00:13:37,740
Have a nice day.
