HW for Paul McWhorter's Uno R4 WiFi Class Lesson 16

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi this is Lori and this is my homework for Lesson 16 in Paul MCC Corner's uh Uno R4 course um in this lesson we've learned about if statements and conditionals and uh we're going to place a red yellow and a green led into our circuit and we'll prompt the user for which one of those uh LED they'd like to turn on they'll type in one of those colors uh I added another LED uh to my circuit to make it fun and uh well let's just see what I did for the homework all right so for this homework uh I have a setup up here uh with the red yellow and green LED and then my uh special LED which is a shaped like a cat it's a little hard to see in the daytime um so I have them connected up into the Uno and with their current limiting resistors and U now we'll kind of focus here on the code um so I'm going to use the LED Matrix and scroll some text so I put a some masking tape over it seems to film a little bit better with that on there um the other thing I'm uh I tried to do in this homework was I tried to create a function for the scrolling text Cu you'll see the the code needed to scroll text is pretty repetitive in the same and I thought I could uh write a function and it would work uh the function I wrote worked partially but then sometimes I get these bus errors and I don't know why and uh I know that the use of the LED Matrix is a little buggy so I didn't want to spend a lot of more time uh trying to figure that out at this point for for the homework so I just decided to put the repetitive uh code in each uh of the conditions that I want to use it in so um but I do recognize it would be better to have that as a function maybe that'll be a challenge for me another day all right so we'll bring in the libraries we need for the LED Matrix um I'm going to use a couple of variables for the color that the user uh enters uh my color will be the the way that the user entered the color and I want to preserve that just kind of challenging myself to think about this a little bit sometimes if you use that two lowercase method you're going to permanently change the string to um lowercase and I thought well maybe you might also want to preserve the way they entered it and uh so I have two variables one is the way they entered it and then my color lowercase LC will be the lowercase version of whatever they entered uh so that was just a little little thinking I did on my part um setting up my Matrix and calling it Matrix I'm going to have a message that will scroll across the screen so there's a string variable for that b rate and the PIN numbers for all the LEDs then we'll set everything up in our void setup and in the loop we'll ask the user to enter the color they want and I I list out their choices we'll wait for their input we'll read that and then we'll copy that uh text into my color LC and lowercase it uh then we'll use that for all our conditionals so we'll start off with an if so let's take a look at Red cuz we're pretty repetitive so if it's red then uh we'll turn the red one on and make sure all the other ones are off we'll print some uh information to the serial Monitor and uh we'll also scroll Red Alert onto the LED Matrix and that's all the code that's needed to to do a scroll and then you can see I I use an else if uh then we look at to for yellow and here with yellow we'll turn yellow on and make sure all the others are off and so forth so it gets as I said pretty repetitive and then green and finally if they type in cat then we'll turn on the cat LED and we'll scroll the message Cats Rule and uh that's that so uh we'll get to the else and this is how I'm using else to uh capture IM balid entries so if you if you don't enter one of those four things then you get an invalid entry and you're told to try again and uh you'll just keep looping through uh so pretty pretty straightforward um so right now it it's running um but I had entered an invalid entry so everything's kind of turned off so let's uh let's restart it and get the prompt on the screen so there's our prompt so let's just try red and we'll do it without any caps and and we can see red alert going by and uh if I do all caps um we should still see red and but you'll see what it prints here is it prints it in the way that the user um entered it so is that necessary I don't know so how about yellow let's see if that works y there goes yellow and how about green and that one worked and uh let's try cat and let's enjoy the cat as he goes through some of his colors um I wish he filmed better he looks a lot better in real life than he does uh does uh on the screen but uh you can see it's a fun uh a fun little LED um they have a lot of different there's Bunches of them out there different shapes and so forth like fun for your uh projects to use them um and then if I entered a color that is not or anything that's not one of those four things like say I thought well maybe cyan was a color you can see that it uh tells me to try again and turns everything off H so that's what I did for my homework and uh thank you for watching a
Info
Channel: Lori's Homework
Views: 97
Rating: undefined out of 5
Keywords:
Id: m9ZJnMYjYao
Channel Id: undefined
Length: 6min 31sec (391 seconds)
Published: Mon Jun 24 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.