Transcript from the "Programming the LCD Screen" Lesson
>> Steve: I believe we've got our LCDs wired up. Again, it was definitely the boss level of all the wiring we've done today, definitely after the fake out of the door switch. Right, yeah, just plug these two cords and it's fine. This was a little bit more complicated because we had to give power to both sides.
[00:00:17] Luckily, where the wiring is complicated, the code is coded easy. So, let's go ahead and look at how we can program this, cool. So, here I have just kind of the playground again cleared out from the previous code. Johnny-five makes all of this suspiciously easy, so I can say a new five.LCD.
[00:00:41] And you do need to tell it what ports those are, in the diagram, the white wires are plugged into. Luckily, they are in sequential order. So we'll just say pins. And we'll give it an array of, mine are plugged into a2. And if you follow the diagram, yours are too.
[00:01:00] a3, a4, a5, a6, a7. The easy way I did it kind of wired it up and start from the last pin and go the other way. But that wouldn't work for the programming. So, I have this new LCD that is ready to go based on the wiring. And for this, you kind of have a cursor that you can like reposition and move.
[00:01:34] So it's useful to think about the LCD as two rows. There is that top row and then there is the bottom row. And that is the one that came in the kit. But obviously not all LCDs are monochrome, and two rows of 16 columns, right? So this API is flexible for all the different kinds of LCDs out there.
[00:01:56] But we're kind of focused on the one that we have available, right? So we can actually print some text to it. And as I put this together, I do want you to start thinking about kind of, again, some of the stuff we talked about. You could have one of these set up and pull in from a third party weather API and just display it.
[00:02:16] This is just what's in the kit, there's also EN screens that you can set up and stuff along those lines, that can be Internet connected, pull in the weather and put it right by your door, right? All sorts of really cool stuff. The really interesting stuff comes when you start overlapping a bunch of stuff on the Internet with this.
[00:02:33] So we basically put the cursor somewhere and you can see through some helpful IntelliSense here that it takes two things, a row and a column of where we wanna put the cursor. I'm gonna start at the very beginning, but you could theoretically start on the 0 row and halfway through the LCD if you wanted to.
[00:02:50] And then we'll just print. We'll print, Hello.
>> Steve: And then on the second row, [INAUDIBLE] you wanna do. Hello?
>> Steve: Which one? What are we doing?
>> Speaker 2: He said 47.
>> Steve: Hello 47 into it. And the other thing you can do, if you've ever used Slack, you have that emoji shorthand.
[00:03:19] They're not emojis per se, but there are a few symbols that you can see in the Johnny-Five documentation, so I'm gonna go with a heart. This is how I feel about all of you at this point, after all of our time together. So I'll put that together and this is really all it takes to be able to print to an LCD screen.
[00:03:38] So I'm gonna fire up this code and then we'll go take a look at it. So I'm still deploying a code, but it should be starting up in about one second, it's running the file. And you can see that it's come to life, my heart didn't work out.
[00:03:53] But you can see exactly what I typed appeared on the LCD. So I mean we still feel a heart in this case. So yeah, we can print whatever we want to this. For our next trick, the one last thing I wanna do is again think about an API integration.
[00:04:11] So I'll give you all a few minutes and what we'll do is if you don't have a Twitter API key, go ahead and get it yourself. If you don't have a Twitter account, you will need one, technically, but otherwise, you can kind of go to the Twitter API section and go get it yourself.
[00:04:28] There's actually four parts to it, I think, a consumer key, a consumer secret, so on and so forth. And if you look in that environment configuration that we saw before, that env.sample,json, you'll see the places to plug all of that in and you can put in each one of those parts.
[00:04:44] If you don't have a Twitter account and you just want to follow along, that's great too. But if you wanna actually pull in something as well, we can get that going. I'll give everyone