-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code (MATLAB)
754 lines (624 loc) · 25.5 KB
/
Code (MATLAB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
classdef designProtov3 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
ProjectLabel matlab.ui.control.Label
ArmedLamp matlab.ui.control.Lamp
ArmedLampLabel matlab.ui.control.Label
Room4Label matlab.ui.control.Label
Room3Label matlab.ui.control.Label
Room2Label matlab.ui.control.Label
Room1Label matlab.ui.control.Label
Image4 matlab.ui.control.Image
Image3 matlab.ui.control.Image
Image2 matlab.ui.control.Image
Image1 matlab.ui.control.Image
Room4Lamp_4 matlab.ui.control.Lamp
Room4LampLabel matlab.ui.control.Label
Room3Lamp_3 matlab.ui.control.Lamp
Room3LampLabel matlab.ui.control.Label
Room2Lamp_2 matlab.ui.control.Lamp
Room2LampLabel matlab.ui.control.Label
Room1Lamp_1 matlab.ui.control.Lamp
Room1LampLabel matlab.ui.control.Label
Screen matlab.ui.control.EditField
pb1 matlab.ui.control.Button
pb2 matlab.ui.control.Button
pb3 matlab.ui.control.Button
pbA matlab.ui.control.Button
pb4 matlab.ui.control.Button
pb5 matlab.ui.control.Button
pb6 matlab.ui.control.Button
pbB matlab.ui.control.Button
pb7 matlab.ui.control.Button
pb8 matlab.ui.control.Button
pb9 matlab.ui.control.Button
pbC matlab.ui.control.Button
pbArm matlab.ui.control.Button
pb0 matlab.ui.control.Button
pbDisarm matlab.ui.control.Button
pbD matlab.ui.control.Button
end
properties (Access = public)
% global microcontroller instantiation
MCU
%PIR Alarm States
PIR_1
PIR_2
PIR_3
PIR_4
PIRWord
%webcam initilization
cam
%Original Background images when alarm is armed;
OBim
%Original Background GS image
OBimgs
%original Background segmented images
OBim1
OBim2
OBim3
OBim4
%Motion after image processiong Booleans
MR1
MR2
MR3
MR4
%Image Segmentation variables after image processing
Room1
Room2
Room3
Room4
%Current instance of image
CurrentImg
%default Alarm state
Armed_state = false %Alarm armed state
thresh
cstate1 = false
cstate2 = false
cstate3 = false
cstate4 = false
end
methods (Access = public)
function [c1, c2, c3, c4, c5] = Alarm_state(app, x1)
if (x1 == true)
w = read(app.MCU,4,"char");
c1 = w(1);
c2 = w(2);
c3 = w(3);
c4 = w(4);
end
end
end
methods (Access = public)
% %segment image into 4 sectors
% function [imr1, imr2, imr3, imr4] = Segment_image(app,imgB)
% imr1 = imgB(:,1:160);
% imr2 = imgB(:,161:320);
% imr3 = imgB(:,321:480);
% imr4 = imgB(:,481:640);
%
% end
%Image processing Skeleton function
function [room1motion, room2motion, room3motion, room4motion] = ImageProcessingFunc(app, imgSampled)
%convert to GS
img_gs = rgb2gray(imgSampled);
%subtract both GS images
img_sub = imsubtract(img_gs,app.OBimgs);
% img_adj = imadjust(img_sub);
% imshow(img_adj)
%filter subtraction result
img_filtered = medfilt2(img_sub);
%threshold to convert to logical image
img_Logic = imbinarize(img_filtered,"global");
img_opened = imopen(img_Logic, strel('square',10));
%[app.Room1, app.Room2, app.Room3, app.Room4] = Segment_image(app,img_opened);
imr1 = img_opened(:,1:160);
imr2 = img_opened(:,161:320);
imr3 = img_opened(:,321:480);
imr4 = img_opened(:,481:640);
if sum(imr1(:)) >= app.thresh
room1motion = true;
app.Image1.ImageSource = imgSampled(:,1:160,:);
else
room1motion = false;
end
if sum(imr2(:)) >= app.thresh
room2motion = true;
app.Image2.ImageSource = imgSampled(:,161:320,:);
else
room2motion = false;
end
if sum(imr3(:)) >= app.thresh
room3motion = true;
app.Image3.ImageSource = imgSampled(:,321:480,:);
else
room3motion = false;
end
if sum(imr4(:)) >= app.thresh
room4motion = true;
app.Image4.ImageSource = imgSampled(:,481:640,:);
else
room4motion = false;
end
end
%button tone
function keytone(app)
fs = 4e3;
sound(1,fs);
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
app.MCU = serialport("COM4", 9600, "Timeout",5); %MCU controller
pause(2);
app.cam = webcam('C270 HD WEBCAM');
%threshold
app.thresh = 76800 *0.15;
end
% Button pushed function: pb1
function pb1ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'1');
end
end
% Button pushed function: pb2
function pb2ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'2');
end
end
% Button pushed function: pb3
function pb3ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'3');
end
end
% Button pushed function: pbA
function pbAButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'A');
end
end
% Button pushed function: pb4
function pb4ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'4');
end
end
% Button pushed function: pb5
function pb5ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'5');
end
end
% Button pushed function: pb6
function pb6ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'6');
end
end
% Button pushed function: pbB
function pbBButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'B');
end
end
% Button pushed function: pb7
function pb7ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'7');
end
end
% Button pushed function: pb8
function pb8ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'8');
end
end
% Button pushed function: pb9
function pb9ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'9');
end
end
% Button pushed function: pbC
function pbCButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'C');
end
end
% Button pushed function: pb0
function pb0ButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'0');
end
end
% Button pushed function: pbD
function pbDButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) < 4
app.Screen.Value = append(app.Screen.Value,'D');
end
end
% Button pushed function: pbArm
function pbArmButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) == 4
if app.Screen.Value == "1234"
write(app.MCU,'A\0','int16');
app.Armed_state = true;
%take background image;
app.OBim = snapshot(app.cam);
app.OBimgs = rgb2gray(app.OBim);
app.Screen.Value = '';
pause(5);
while (app.Armed_state == true)
app.ArmedLamp.Color = 'green';
%sets condition to break out of while loop
if app.Armed_state == false
continue;
end
%do camera test
%1.sample the image from the camera
app.CurrentImg = snapshot(app.cam);
%2.feed into image processing function
[app.MR1, app.MR2, app.MR3, app.MR4] = ImageProcessingFunc(app, app.CurrentImg);
if app.MR1 == true
%Send the alarm signal to ON
app.Room1Lamp_1.Color = 'green';
write(app.MCU,'Q\0','int16');
end
if app.MR2 == true
%Send the alarm signal to ON
app.Room2Lamp_2.Color = 'green';
write(app.MCU,'W\0','int16');
end
if app.MR3 == true
%Send the alarm signal to ON
app.Room3Lamp_3.Color = 'green';
write(app.MCU,'E\0','int16');
end
if app.MR4 == true
%Send the alarm signal to ON
app.Room4Lamp_4.Color = 'green';
write(app.MCU,'R\0','int16');
end
%false camera
if app.MR1 == false
%Send the alarm signal to OFF
write(app.MCU,'H\0','int16');
app.Room1Lamp_1.Color = 'red';
end
if app.MR2 == false
%Send the alarm signal to OFF
app.Room2Lamp_2.Color = 'red';
write(app.MCU,'J\0','int16');
end
if app.MR3 == false
%Send the alarm signal to OFF
app.Room3Lamp_3.Color = 'red';
write(app.MCU,'K\0','int16');
end
if app.MR4 == false
%Send the alarm signal to OFF
write(app.MCU,'L\0','int16');
app.Room4Lamp_4.Color = 'red';
end
% [app.PIR_1, app.PIR_2, app.PIR_3, app.PIR_4] = Alarm_state(app, app.Armed_state);
%
% if app.PIR_1 == "U"
% app.Room1Lamp_1.Color = 'green';
% end
% if app.PIR_1 == "u"
% app.Room1Lamp_1.Color = 'red';
% end
%
% if app.PIR_2 == "I"
% app.Room2Lamp_2.Color = 'green';
% end
% if app.PIR_2 == "i"
% app.Room2Lamp_2.Color = 'red';
% end
%
% if app.PIR_3 == "O"
% app.Room3Lamp_3.Color = 'green';
% end
% if app.PIR_3 == "o"
% app.Room3Lamp_3.Color = 'red';
% end
%
% if app.PIR_4 == "P"
% app.Room4Lamp_4.Color = 'green';
% end
% if app.PIR_4 == "p"
% app.Room4Lamp_4.Color = 'red';
% end
%
end
end
if app.Screen.Value ~= "1234"
app.Screen.Value ='';
end
end
end
% Button pushed function: pbDisarm
function pbDisarmButtonPushed(app, event)
keytone(app);
if length(app.Screen.Value) == 4
if app.Screen.Value == "1234"
write(app.MCU,'a\0','int16');
app.Armed_state = false;
app.ArmedLamp.Color = 'red';
app.Image1.ImageSource = '';
app.Image2.ImageSource = '';
app.Image3.ImageSource = '';
app.Image4.ImageSource = '';
end
app.Screen.Value = '';
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 564 485];
app.UIFigure.Name = 'MATLAB App';
% Create pbD
app.pbD = uibutton(app.UIFigure, 'push');
app.pbD.ButtonPushedFcn = createCallbackFcn(app, @pbDButtonPushed, true);
app.pbD.Tag = 'pbd';
app.pbD.FontSize = 18;
app.pbD.FontWeight = 'bold';
app.pbD.Position = [169 168 45 43];
app.pbD.Text = 'D';
% Create pbDisarm
app.pbDisarm = uibutton(app.UIFigure, 'push');
app.pbDisarm.ButtonPushedFcn = createCallbackFcn(app, @pbDisarmButtonPushed, true);
app.pbDisarm.Tag = 'pbdarm';
app.pbDisarm.FontSize = 6;
app.pbDisarm.FontWeight = 'bold';
app.pbDisarm.Position = [124 168 45 43];
app.pbDisarm.Text = 'DISARM';
% Create pb0
app.pb0 = uibutton(app.UIFigure, 'push');
app.pb0.ButtonPushedFcn = createCallbackFcn(app, @pb0ButtonPushed, true);
app.pb0.Tag = 'pb0';
app.pb0.FontSize = 18;
app.pb0.FontWeight = 'bold';
app.pb0.Position = [79 168 45 43];
app.pb0.Text = '0';
% Create pbArm
app.pbArm = uibutton(app.UIFigure, 'push');
app.pbArm.ButtonPushedFcn = createCallbackFcn(app, @pbArmButtonPushed, true);
app.pbArm.Tag = 'pbarm';
app.pbArm.FontSize = 6;
app.pbArm.FontWeight = 'bold';
app.pbArm.Position = [35 168 45 43];
app.pbArm.Text = 'ARM';
% Create pbC
app.pbC = uibutton(app.UIFigure, 'push');
app.pbC.ButtonPushedFcn = createCallbackFcn(app, @pbCButtonPushed, true);
app.pbC.Tag = 'pbc';
app.pbC.FontSize = 18;
app.pbC.FontWeight = 'bold';
app.pbC.Position = [168 210 45 43];
app.pbC.Text = 'C';
% Create pb9
app.pb9 = uibutton(app.UIFigure, 'push');
app.pb9.ButtonPushedFcn = createCallbackFcn(app, @pb9ButtonPushed, true);
app.pb9.Tag = 'pb9';
app.pb9.FontSize = 18;
app.pb9.FontWeight = 'bold';
app.pb9.Position = [123 211 45 43];
app.pb9.Text = '9';
% Create pb8
app.pb8 = uibutton(app.UIFigure, 'push');
app.pb8.ButtonPushedFcn = createCallbackFcn(app, @pb8ButtonPushed, true);
app.pb8.Tag = 'pb8';
app.pb8.FontSize = 18;
app.pb8.FontWeight = 'bold';
app.pb8.Position = [79 211 45 43];
app.pb8.Text = '8';
% Create pb7
app.pb7 = uibutton(app.UIFigure, 'push');
app.pb7.ButtonPushedFcn = createCallbackFcn(app, @pb7ButtonPushed, true);
app.pb7.Tag = 'pb7';
app.pb7.FontSize = 18;
app.pb7.FontWeight = 'bold';
app.pb7.Position = [35 211 45 43];
app.pb7.Text = '7';
% Create pbB
app.pbB = uibutton(app.UIFigure, 'push');
app.pbB.ButtonPushedFcn = createCallbackFcn(app, @pbBButtonPushed, true);
app.pbB.Tag = 'pbb';
app.pbB.FontSize = 18;
app.pbB.FontWeight = 'bold';
app.pbB.Position = [168 252 45 43];
app.pbB.Text = 'B';
% Create pb6
app.pb6 = uibutton(app.UIFigure, 'push');
app.pb6.ButtonPushedFcn = createCallbackFcn(app, @pb6ButtonPushed, true);
app.pb6.Tag = 'pb6';
app.pb6.FontSize = 18;
app.pb6.FontWeight = 'bold';
app.pb6.Position = [123 253 45 43];
app.pb6.Text = '6';
% Create pb5
app.pb5 = uibutton(app.UIFigure, 'push');
app.pb5.ButtonPushedFcn = createCallbackFcn(app, @pb5ButtonPushed, true);
app.pb5.Tag = 'pb5';
app.pb5.FontSize = 18;
app.pb5.FontWeight = 'bold';
app.pb5.Position = [79 253 45 43];
app.pb5.Text = '5';
% Create pb4
app.pb4 = uibutton(app.UIFigure, 'push');
app.pb4.ButtonPushedFcn = createCallbackFcn(app, @pb4ButtonPushed, true);
app.pb4.Tag = 'pb4';
app.pb4.FontSize = 18;
app.pb4.FontWeight = 'bold';
app.pb4.Position = [35 253 45 43];
app.pb4.Text = '4';
% Create pbA
app.pbA = uibutton(app.UIFigure, 'push');
app.pbA.ButtonPushedFcn = createCallbackFcn(app, @pbAButtonPushed, true);
app.pbA.Tag = 'pba';
app.pbA.FontSize = 18;
app.pbA.FontWeight = 'bold';
app.pbA.Position = [168 295 45 43];
app.pbA.Text = 'A';
% Create pb3
app.pb3 = uibutton(app.UIFigure, 'push');
app.pb3.ButtonPushedFcn = createCallbackFcn(app, @pb3ButtonPushed, true);
app.pb3.Tag = 'pb3';
app.pb3.FontSize = 18;
app.pb3.FontWeight = 'bold';
app.pb3.Position = [123 295 45 43];
app.pb3.Text = '3';
% Create pb2
app.pb2 = uibutton(app.UIFigure, 'push');
app.pb2.ButtonPushedFcn = createCallbackFcn(app, @pb2ButtonPushed, true);
app.pb2.Tag = 'pb2';
app.pb2.FontSize = 18;
app.pb2.FontWeight = 'bold';
app.pb2.Position = [79 295 45 43];
app.pb2.Text = '2';
% Create pb1
app.pb1 = uibutton(app.UIFigure, 'push');
app.pb1.ButtonPushedFcn = createCallbackFcn(app, @pb1ButtonPushed, true);
app.pb1.Tag = 'pb1';
app.pb1.FontSize = 18;
app.pb1.FontWeight = 'bold';
app.pb1.Position = [35 295 45 43];
app.pb1.Text = '1';
% Create Screen
app.Screen = uieditfield(app.UIFigure, 'text');
app.Screen.Tag = 'screen';
app.Screen.HorizontalAlignment = 'center';
app.Screen.FontName = 'Consolas';
app.Screen.FontSize = 18;
app.Screen.FontWeight = 'bold';
app.Screen.Placeholder = 'Enter Code';
app.Screen.Position = [35 352 179 42];
% Create Room1LampLabel
app.Room1LampLabel = uilabel(app.UIFigure);
app.Room1LampLabel.HorizontalAlignment = 'right';
app.Room1LampLabel.Position = [37 423 44 22];
app.Room1LampLabel.Text = 'Room1';
% Create Room1Lamp_1
app.Room1Lamp_1 = uilamp(app.UIFigure);
app.Room1Lamp_1.Position = [100 423 20 20];
app.Room1Lamp_1.Color = [1 0 0];
% Create Room2LampLabel
app.Room2LampLabel = uilabel(app.UIFigure);
app.Room2LampLabel.HorizontalAlignment = 'right';
app.Room2LampLabel.Position = [140 422 44 22];
app.Room2LampLabel.Text = 'Room2';
% Create Room2Lamp_2
app.Room2Lamp_2 = uilamp(app.UIFigure);
app.Room2Lamp_2.Position = [203 422 20 20];
app.Room2Lamp_2.Color = [1 0 0];
% Create Room3LampLabel
app.Room3LampLabel = uilabel(app.UIFigure);
app.Room3LampLabel.HorizontalAlignment = 'right';
app.Room3LampLabel.Position = [249 421 44 22];
app.Room3LampLabel.Text = 'Room3';
% Create Room3Lamp_3
app.Room3Lamp_3 = uilamp(app.UIFigure);
app.Room3Lamp_3.Position = [312 421 20 20];
app.Room3Lamp_3.Color = [1 0 0];
% Create Room4LampLabel
app.Room4LampLabel = uilabel(app.UIFigure);
app.Room4LampLabel.HorizontalAlignment = 'right';
app.Room4LampLabel.Position = [346 420 44 22];
app.Room4LampLabel.Text = 'Room4';
% Create Room4Lamp_4
app.Room4Lamp_4 = uilamp(app.UIFigure);
app.Room4Lamp_4.Position = [409 420 20 20];
app.Room4Lamp_4.Color = [1 0 0];
% Create Image1
app.Image1 = uiimage(app.UIFigure);
app.Image1.Position = [259 266 100 100];
% Create Image2
app.Image2 = uiimage(app.UIFigure);
app.Image2.Position = [435 266 100 100];
% Create Image3
app.Image3 = uiimage(app.UIFigure);
app.Image3.Position = [259 112 100 100];
% Create Image4
app.Image4 = uiimage(app.UIFigure);
app.Image4.Position = [435 112 100 100];
% Create Room1Label
app.Room1Label = uilabel(app.UIFigure);
app.Room1Label.Position = [284 372 48 22];
app.Room1Label.Text = 'Room1 ';
% Create Room2Label
app.Room2Label = uilabel(app.UIFigure);
app.Room2Label.Position = [467 372 48 22];
app.Room2Label.Text = 'Room 2';
% Create Room3Label
app.Room3Label = uilabel(app.UIFigure);
app.Room3Label.Position = [289 220 48 22];
app.Room3Label.Text = 'Room 3';
% Create Room4Label
app.Room4Label = uilabel(app.UIFigure);
app.Room4Label.Position = [459 220 51 22];
app.Room4Label.Text = 'Room 4 ';
% Create ArmedLampLabel
app.ArmedLampLabel = uilabel(app.UIFigure);
app.ArmedLampLabel.HorizontalAlignment = 'right';
app.ArmedLampLabel.Position = [35 111 41 22];
app.ArmedLampLabel.Text = 'Armed';
% Create ArmedLamp
app.ArmedLamp = uilamp(app.UIFigure);
app.ArmedLamp.Position = [89 113 22 22];
app.ArmedLamp.Color = [1 0 0];
% Create ProjectLabel
app.ProjectLabel = uilabel(app.UIFigure);
app.ProjectLabel.FontWeight = 'bold';
app.ProjectLabel.Position = [35 25 506 22];
app.ProjectLabel.Text = 'Chinnasamy MD 21905492 - Motion detection using PIR Sensors and Image Processors';
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = designProtov3
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end