1
00:00:05,660 --> 00:00:13,670
Fight in this lecture, we'll show you how to drive the next seven to one night metrics display like

2
00:00:13,820 --> 00:00:20,720
this one here in this demonstration, in which case I have connected four of those individual displays

3
00:00:20,720 --> 00:00:21,820
in a row.

4
00:00:22,640 --> 00:00:31,200
You can see that by just tuning the display over these displays have an input and an output.

5
00:00:31,220 --> 00:00:37,190
So this is where one can connect to the other and then create various configurations.

6
00:00:37,580 --> 00:00:43,280
I've chosen to go for a single row of these displays using for displays one after the other.

7
00:00:43,580 --> 00:00:47,910
But you can also configure it as a rectangle or as a square.

8
00:00:48,800 --> 00:00:51,650
So I'm going to like this one back in.

9
00:00:52,780 --> 00:00:53,090
Right.

10
00:00:53,090 --> 00:00:57,500
I'm going to have to initialize it, not to get the last one to work.

11
00:00:58,370 --> 00:01:07,970
One thing that I do with all of my displays is that I use a sticker to indicate the drive circuit for

12
00:01:07,970 --> 00:01:12,640
the display because typically it's not indicated on the participation of printed on.

13
00:01:13,010 --> 00:01:18,770
And it's an important piece of information to know so that, you know, which driver, which software

14
00:01:18,770 --> 00:01:19,820
driver to use.

15
00:01:20,600 --> 00:01:21,070
All right.

16
00:01:21,080 --> 00:01:29,240
So I begin by having a look at the wiring information and then we'll look at the software side and talk

17
00:01:29,240 --> 00:01:34,880
about the driver that I've found and used and found that it works with this display.

18
00:01:35,180 --> 00:01:36,860
And you that a couple of examples.

19
00:01:36,860 --> 00:01:41,150
In the first example, she had to just display random pixels.

20
00:01:41,660 --> 00:01:46,130
And then in the next example, in the next lecture, she had to display text.

21
00:01:46,130 --> 00:01:51,200
But I'm also going to talk about how to create about graphics primitives like lines and circles.

22
00:01:51,350 --> 00:01:53,980
It's actually very easy with a driver that I found.

23
00:01:54,710 --> 00:01:55,330
All right.

24
00:01:55,760 --> 00:02:00,860
So about the wiring first hand this thing over.

25
00:02:02,240 --> 00:02:04,820
You can have a look at the wiring in conjunction with the software.

26
00:02:04,820 --> 00:02:07,960
Because of the header of my example script.

27
00:02:07,970 --> 00:02:10,160
I've indicated the wiring as well.

28
00:02:10,640 --> 00:02:20,210
So you've got the ground pin which goes to any of the ground pins on the HP to in my case, I have connected

29
00:02:20,210 --> 00:02:23,180
the ground pins, the green jumper wire.

30
00:02:23,360 --> 00:02:26,960
It goes to the ground power rail on the breadboard.

31
00:02:28,780 --> 00:02:41,100
Then we've got this you see this display, it requires five votes, so this is C is the blue wire that

32
00:02:41,170 --> 00:02:48,980
goes here, and then I'm using this long red jumper wire to connect it to the east, whether it is five

33
00:02:49,000 --> 00:02:50,280
or 10 right there.

34
00:02:51,760 --> 00:03:00,080
Next up, we've got the data in PIN now I forgot to mention that this display is using the spy interface.

35
00:03:00,080 --> 00:03:05,560
So data in for the spy interface is the Mausi.

36
00:03:06,710 --> 00:03:11,780
PIN, which is PIN 23 on the E.S.P 32, this pin right here.

37
00:03:11,810 --> 00:03:15,520
I'm using a jumper wire to take that out and connect it to display.

38
00:03:16,340 --> 00:03:20,990
Now we've got the spy clock pin, which is.

39
00:03:22,330 --> 00:03:26,680
Pain 18, it is this one right here.

40
00:03:27,930 --> 00:03:37,200
And finally, we need the SS pin, which is the chip select or spy traditional Parli, it is the sleeve

41
00:03:37,230 --> 00:03:41,160
select for this right here, which you can use any pin, actually.

42
00:03:41,170 --> 00:03:43,740
And I've used your five for this.

43
00:03:45,490 --> 00:03:46,680
So these are the pin outs.

44
00:03:50,380 --> 00:03:58,840
Having done that, let's check out the software side, so for the software side, I have chosen and

45
00:03:58,840 --> 00:04:02,120
found that it works this library here.

46
00:04:02,380 --> 00:04:05,030
It's called Max 71 nine Thorpey.

47
00:04:05,050 --> 00:04:10,840
Why there's information on where to get it from and also have the information.

48
00:04:10,840 --> 00:04:18,250
Or I should have that information in which I just put it in right now that would give here.

49
00:04:23,110 --> 00:04:25,140
It paste doesn't quite work.

50
00:04:26,130 --> 00:04:26,680
All right.

51
00:04:26,740 --> 00:04:32,580
This is for the max seven two one nine driver library.

52
00:04:32,800 --> 00:04:33,140
All right.

53
00:04:34,230 --> 00:04:37,890
So as you can see, this is not a big library.

54
00:04:37,920 --> 00:04:44,400
Builds on the frame buffer module, which is built into the micro python firmware.

55
00:04:44,730 --> 00:04:52,410
And so it builds onto that and makes it possible to do things such as fill the whole screen with a particular

56
00:04:52,410 --> 00:04:54,630
color, either on or off the black or white.

57
00:04:54,630 --> 00:04:58,470
I guess you would call that you can create individual pixels.

58
00:04:58,700 --> 00:05:02,460
So this is the function that we are using in this demonstration.

59
00:05:02,800 --> 00:05:09,940
You can create horizontal and vertical lines, arbitrary lines from any point to any other point, rectangles

60
00:05:09,940 --> 00:05:11,490
and field rectangles.

61
00:05:11,700 --> 00:05:17,330
Text, which will be using in the next example, can get text to scroll.

62
00:05:17,650 --> 00:05:19,260
I'm not sure what it is.

63
00:05:19,950 --> 00:05:24,270
And then you can initialize the screen, which is also something that we are using.

64
00:05:24,630 --> 00:05:32,190
These are the available functions that this driver library provides us to back into the demonstration

65
00:05:32,190 --> 00:05:32,730
sketch.

66
00:05:33,420 --> 00:05:38,900
In this example, I just wanted to show random pixels so there wasn't much to it.

67
00:05:38,910 --> 00:05:46,650
I have imported the appropriate modules, the library itself and then the pen and spy functions from

68
00:05:46,650 --> 00:05:50,470
the machine module you time so I can put a little bit of sleep.

69
00:05:50,520 --> 00:05:53,340
You can see that happening here 15 milliseconds.

70
00:05:53,670 --> 00:06:00,450
And then I also imported the random module so that I can add a bit of randomness when I am calculating

71
00:06:00,750 --> 00:06:06,630
or actually figuring out which early days or which pixels to turn on.

72
00:06:06,840 --> 00:06:10,680
Other than that, I am creating the spy object here.

73
00:06:11,040 --> 00:06:18,840
This is spy object with the two because the civil nuclear documentation can see that the E.S.P 32 with

74
00:06:18,840 --> 00:06:25,350
this micro python implementation has got to S.P.I hardware interfaces available.

75
00:06:25,650 --> 00:06:28,860
The first one has got ID one and these are the pince.

76
00:06:29,400 --> 00:06:34,110
So this interface 14, 13 and 12 for Clock Mozi and Mizu.

77
00:06:34,350 --> 00:06:42,150
And the second one, which is the one that I'm using, have got these two bios for the three pins of

78
00:06:42,150 --> 00:06:50,220
the interface and I'm using 23 and I'm not using the MISO GPA because I don't need it with this interface.

79
00:06:50,250 --> 00:06:51,560
So one way only.

80
00:06:52,530 --> 00:07:01,290
So I'm using this constructor to create the spy object I'm defining here Jhpiego number five to be my

81
00:07:01,290 --> 00:07:03,090
slave selector or chip select.

82
00:07:03,450 --> 00:07:10,890
And then I'm using this constructor, the eight by eight constructor and much six, eight by eight to

83
00:07:10,890 --> 00:07:18,390
create an object that allows me to control this row of four matrix displays.

84
00:07:18,390 --> 00:07:25,380
So I'm passing the SBI object, the slate select or CHIP select Tapio.

85
00:07:25,680 --> 00:07:32,820
And then I'm indicating that this is going to be a display with four eight by eight displays in a row.

86
00:07:33,210 --> 00:07:35,010
And that's the display object.

87
00:07:35,670 --> 00:07:40,020
Next, I'm using the full function to turn all of the entities off.

88
00:07:40,050 --> 00:07:48,180
So in effect, I'm painting it black, setting the brightness to five and that's how bright Brightness

89
00:07:48,180 --> 00:07:48,990
five is.

90
00:07:49,110 --> 00:07:52,040
I want to know more of that brightness than what the limits are.

91
00:07:52,410 --> 00:08:01,980
You can just go to the library itself and just search for full brightness or the right part of the word

92
00:08:01,980 --> 00:08:02,460
is enough.

93
00:08:03,090 --> 00:08:10,830
And you can see that the limits are from zero to 15 with Tuffin being the brightest possible setting.

94
00:08:12,640 --> 00:08:19,330
And after that, we are ready to start printing pixels, so we've got a loop that repeats 10 times because

95
00:08:19,330 --> 00:08:25,410
what I want to do is to create 10 randomly little pixels across my screen.

96
00:08:25,870 --> 00:08:31,310
And I do that by calculating a random X and Y position.

97
00:08:31,750 --> 00:08:38,650
So if you look at the pixel function in the driver library right here.

98
00:08:40,650 --> 00:08:48,420
Here it is, you'll see that it requires an X, a Y and optionally a color, which I am passing a color

99
00:08:48,420 --> 00:08:51,240
X Y so that the pixel is turned on.

100
00:08:51,630 --> 00:08:52,950
So here's my color one.

101
00:08:53,370 --> 00:08:55,230
And then for the exposition.

102
00:08:55,890 --> 00:08:57,900
The exposition is this.

103
00:08:59,160 --> 00:09:06,780
So this is pixel number one, so this is pixel number zero index and zero in the x axis and this is

104
00:09:06,780 --> 00:09:07,530
31.

105
00:09:08,280 --> 00:09:12,600
So I'm getting a random number between zero and thirty one.

106
00:09:12,600 --> 00:09:16,710
And I'm doing the same thing for the Y axis vertical.

107
00:09:17,040 --> 00:09:24,030
So this is zero on the Y axis and this is eight on the Y axis.

108
00:09:24,480 --> 00:09:28,490
And then that would give me a random number between zero and eight.

109
00:09:28,680 --> 00:09:32,420
I don't remember if the eight is inclusive.

110
00:09:32,610 --> 00:09:35,730
So if the top end of this range is inclusive.

111
00:09:38,250 --> 00:09:43,320
Having a look at the random module in here, we've got.

112
00:09:45,150 --> 00:09:51,300
The random E.A. function, which is a function that I'm using and you can see that this is returning

113
00:09:51,300 --> 00:09:55,890
a random number between A and B, inclusive of A and B.

114
00:09:58,200 --> 00:10:05,520
So there's the answer to this function is going to return a random number between zero and eight once

115
00:10:05,520 --> 00:10:16,800
I've got my ten random pixels in the buffer of my display and I call the show function to make the numbers

116
00:10:16,800 --> 00:10:26,880
visible, leave them visible for 15 milliseconds, then empty the display display off by writing zero

117
00:10:27,300 --> 00:10:32,460
and then go back and calculate and create the next ten random pixels.

118
00:10:34,390 --> 00:10:37,240
If I comment out this dysfunction.

119
00:10:38,510 --> 00:10:42,680
Can heat control see now to stop execution and then save and upload again?

120
00:10:44,270 --> 00:10:52,070
You see that you get this effect where eventually the display turns all on the wall itself being on.

121
00:10:53,710 --> 00:10:57,400
All right, what about effect as well as quite nice?

122
00:10:59,000 --> 00:11:08,720
All right, so that's how you can use this eight by eight display to randomly display pixels and then

123
00:11:08,720 --> 00:11:09,680
let's have a look in.

124
00:11:09,680 --> 00:11:13,460
The next picture will show you how to display text.
