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

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] hi this is Lori and this is my homework for Paul McCord's Uno R4 class we're on lesson number five where we're working with binary numbers and our homework is to create a binary counter using our LEDs so I thought I'd just share this program that I have on my screen I think is what most people who are just starting out um learning Arduino and C++ um this is the program you should make something like this one I I actually found my old uh program from when I took uh Paul's Arduino R three classes and this is what I wrote back then I didn't know anything about C++ and and and very little about Arduino at the time and this is the kind of program I put together uh back then for the R3 class and you can see you know just doing everything in the way that Paul showed us and I went through and I just turned on the lights or turned them off to create each of the digits in binary so um if that's how you did it you know you should feel good about that that's exactly um the kind of program that I think Paul expects beginners to be able to to do based on what they've learned so far now I'm going to show uh a little more advanced way of doing it um CU I'm starting to get my uh Arduino programming uh legs back it's been a while and I think I've complained about that in my in my homeworks before and I'm slowly re-remembering all the ways to work with uh uh control structures and C++ so um I tried to do something a little more sophisticated this time um but you know this is how you did it then you did it you did it great so I didn't want to make anybody uh feel feel bad about that or feel like they uh aren't aren't learning what they need to learn um this is the way you would start doing this project if you're a beginner all right no I think we uh have my circuit over here and we've all talked about the setting up of the LEDs I keep changing the colors out because I just like playing around with different colors so I got green in there today um so here's the code that uh I put together this time to do the binary counting um so I'll set up a delay time of a second and then I'm using these four LED pins and then I'm using uh for Loop to set them all up as uh outputs um so just you know using this little array here uh to go through that and a lot of the other more advanced students have been doing this sort of thing too um and then in the void Loop I'm going to Loop through the numbers 0 through 15 uh so I'll call that curve for current number um and we'll stop when we get up to 16 and we'll Advance it using the for Loop and again that's something that Paul hasn't gone through yet so if you're not familiar with for Loops don't worry about it it it'll come um and then I'm I'm making uh a version of Curr number into a bite um so it'll turn it sort of into that binary format and then as I do that then I can Loop through the four places in the binary number um and see whether they're a one or a zero and if it's a one then I'm going to turn on the LED and otherwise it must be a zero and so I will turn that one off and um we'll have the delay time here and keep looping around through the numbers um so yeah that that should that should work pretty well so let's see I think I already have this loaded in so let me uh let me just plug in my Arduino and we'll watch that go and uh I have a little diffuser here so I think it might make this a little easier to see I'm going to look at the screen and see no I don't know anyways that's my little diffuser that I've been trying out and you can watch it count here are the numbers one two three 4 yeah so that works uh that works perfectly now uh I also wanted to do a little bit more because uh I like to I'm not that great at binary so I like to actually show um the digits uh the number that we're on in decimal somewhere and since we have the uh LED uh Matrix here I spent some time uh learning how to use that led Matrix and actually did a a live session as well on it and uh so between that and reading the documentation I've added in uh using the LED so I'll show that code next here's the code to um to include the LED Matrix to put the current um digit in decimal up on on our Matrix here um so include those libraries um this is the same setup of delay time and the LED pin array and set those up also set up the serial begin and begin the use of the Matrix here and then you can see that you know most of it stays pretty similar um we're going to go ahead and um use that read bite uh read bit read I should say bit read function to uh pull off the the place that we want to look at and light or not light our uh LED and then uh this is all the text that's needed to um to put the decimal value on the LED Matrix so it's a lot of just kind of set up and telling you what F to use and then just we're going to start giving it some text and then we're going to give it the current number then we're going to end that and end the draw and then we'll do our delay time um and then uh I wanted to have a little bit of extra time so I'm going to turn all the LEDs off and clear out the Matrix and wait 3 seconds before we start the next count through 0 to 15 so it'll do 0 to 15 then it'll come into this uh last uh area turn everything off and clear the screen wait 3 seconds and then it'll go back up and start the count again all right so got that loaded let's just take a look at what that would look like hoping that that films okay I'm looking up at the monitor yeah I think you can see the digits on the on on the LED Matrix and uh you know that led Matrix is going to be very useful I think as we go through and and connect up sensors and so forth to to our arduinos and we have we have a built-in display U where we can show data and you can scroll text on it too Paul showed us how to do that as well um but in this case I'm just counting through the numbers and showing that so it's nice you can kind of Mount match up the um you know the LEDs with with the with the number all right so that's my homework thanks for great lesson Paul and thank you for watching
Info
Channel: Lori's Homework
Views: 181
Rating: undefined out of 5
Keywords:
Id: -7giNV3fdAw
Channel Id: undefined
Length: 7min 49sec (469 seconds)
Published: Mon Feb 26 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.