Arduino Firmware Programming With Electronics/Schematics/PCB | Daniel McCarthy | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Arduino Firmware Programming With Electronics/Schematics/PCB

teacher avatar Daniel McCarthy, There is always more to learn

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

22 Lessons (3h 54m)
    • 1. Introduction

      1:22
    • 2. Current Vs Voltage Revised

      4:44
    • 3. What is a breadboard?

      4:07
    • 4. Your first circuit

      12:31
    • 5. Blinking An LED Programmatically

      7:58
    • 6. Resistance And Ohms Law

      8:39
    • 7. Push Button Programming

      11:26
    • 8. DIode's explained

      3:25
    • 9. Arduino Interrupts

      8:44
    • 10. Capacitors Explained

      6:34
    • 11. LCD Screens With Arduino

      13:38
    • 12. Multimeters And How To Use Them

      2:04
    • 13. Arduino Serial Communication

      11:19
    • 14. Potentiometers

      6:19
    • 15. Arduino Analog Reading And Writing

      20:46
    • 16. Basics Of Inductors

      3:43
    • 17. Arduino Whack A Mole Game

      41:18
    • 18. Voltage Regulators

      2:14
    • 19. Installing KiCad Schematic Software

      2:09
    • 20. Creating KiCad Schematic And PCB

      17:57
    • 21. Wiring the PCB

      7:38
    • 22. Creating A Schematic And PCB for Wack A Mole

      35:10
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

119

Students

--

Projects

About This Class

In this course you will learn all about the Arduino board and how to program it. We go through various stages in this course and you are taught all about the basics of electronics and how to program Arduino firmware.

If you have never even picked up a wire in your life then this course is for you, by the end of this course you will have all the experience you need to get a good grade in a university module that's based on Arduino. You will have the experience required to further your education and you will know how to create some really fun little exercises in Arduino.

Not to mention you will also understand the basics of electronics at a fundamental level and have experience with various components such as resistors, LED's, diodes, capacitors and much more.

You are taught all about schematics and how to read and write them, as well as how to create printed circuit boards from these schematics so that you can have your very own circuit board shipped to your home based on your design!

This course also includes a Whack A Mole Game where you are taught how to create your very own little Arduino electronic game using LED's  and push buttons

What you’ll learn

  • All about Arduino and firmware programming
  • Designing Electronic Schematics
  • Designing PCB(Printed Circuit Boards)

Are there any course requirements or prerequisites?

  • Understanding Of Programming At A Basic Level

Who this course is for:

  • Beginner Firmware Developers
  • Beginner's with Electronics
  • People who want to learn how to read and create schematics
  • People who want to learn how to create PCB(Printed Circuit Boards)

Don't forget to checkout the class project!

Meet Your Teacher

Teacher Profile Image

Daniel McCarthy

There is always more to learn

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: do you know how to program? And now you want to learn how to program electron ICS? Well, then, this is the course for you in this fantastic beginners course. You'll learn all about how the program out. Do we know you'll learn all about the basics of electron ICS such as resistors, capacitors, voltage regulators pull down resistors, pullup resistors and the list goes on in this cost. We also make a whack a mole game. You know the game where you hit moles with with with a stick of some kind and then the points go up will be making one of those. But don't worry, We're doing all of this in an electronic simulator, so you won't have to go out and buy the parts. However, if you did want to buy the parts and you follow this course, you would have the exact same result as thesis. Immolations are accurate to real life. Unlike other courses, this course also teaches you how to read and write Elektronik schematics. We then convert those schematics to a PCB or printed circuit board. You can then send this to a manufacturer and have your circuit board actually printed out for you and said to you in the mail. This course is great for beginners on. Upon completing this course, you will understand the ferment ALS of programming firm way, and you will also have experience with electron ICS. If you're currently in university and have an Arduino module, then this course will definitely give you all of the experience required to do well. 2. Current Vs Voltage Revised: hello and welcome. And in this very first lecture, you'll learn all about current and voltage. So before we go any further, take a look at this circuit. I will be explaining how this works on all this circuit does is light a lamp. Okay, let's continue. So what is current? Current is the flow of electrons. It is not voltage and it flows best through a conductor. So you can think of current as water flowing through a pipe. Right? That is essentially what current is in a circuit. When we pass current through a circuit, it can generate heat on. If this is done and safely, it can cause components to melt or in some cases, explode. Too much current flowing through a circuit can actually damage components. You always need to be careful how much current is going through your circuits. Let me now explain this video on current that I showed you at the start of this video. Here you have the battery. This symbol represents our battery. All of these lines represent wires on this. This in the right hand corner is a lamp thinking of your lamp at home. That lights up when you plug it in the wall. This is our lamp. Let me show you the video. I'm now going to change the voltage of our battery from 0 to 120 volts and we can see the lamp turns on. See these yellow squares going through the wires? This is a simulation. Okay. The's yellow squares represent the current going through the circuit. You can see it flows like the water and a pipe. Let's not change the voltage to zero. We can see the lamp turns off. So what is a conductor? Conductors of materials that let current passed through them easily. So examples off conductors is copper, and we use conductors and electronic circuits so that they are most efficient. So what is an insulate? Er, while insulated is of the opposite to conductors, they don't allow currents to flow through them very well. So around the wires, usually rubber or plastic. And these are insulate er's on. The whole point of this is so if you put the wire down on a piece of metal, for example, it doesn't destructive circuit because metal is a conductor, right? So by putting and insulate around the wire, it means you can safely pick up the wire without hurting yourself or disrupt in the circuit . And you can place the wire anyway you like without also destructing the circuit insulated are great for this. Do you remember? The insulators are no a silver bullet. If the push of electrons threw away is too great, the rubber on the wire can actually melt which has happened to me before. Let me know. Explain what voltages voltage can be thought off as the pressure in a pipe. It's the push that causes electrons to move through the wire. Causing the current voltage can also result in dangerous circuits. Let me now show you our video example again. But this time I'm going to show you an example on voltage so we can see the voltage has changed to five volts. Notice how the current moves through the circuit, but the lamp doesn't turn on. The lamp doesn't turn on because there isn't enough push. The electrons aren't being pushed fast enough, so the lamp does not light. If we now up the voltage 2 50 volts, we can see the we can see that the current is much stronger and the lamp. It's starting to light up. If we change its 120 volts, we can see that the current appears not to be moving. It is moving. It's just moving so quick that it looks like it isn't moving a tall in our simulation. And you can also see that the lamp is now at its brightest. If we change, the voltage backed is back toe 30. We can see that the lamp has now gone back off, but we can still see the current moving. The reason it isn't lighting with 30 volts is again because there's not enough push through the circuit. So the more voltage there is, the more push. 3. What is a breadboard?: Hello and welcome. Take a look of this circuit you can see on led being lit up from the power of an Arduino. This thing in my hand and I'm holding this white thing. It's called a bread board. I want to explain more about what a bread board is to you today. So a bread board looks like this on what a bread board is. Is it simply a tool for prototyping circuits? There's metal inside the bread board so that you can connect wires, pushing them in on, then forming a circuit. Now, on the outside of the bread board, you'll see this and you'll also see on this side, too. Now, this is for adding power, right? You can see the positive and negative terminals go here on the power runs down, runs downwards, all the way through. All the way down. Now in the middle, you'll see these two rows. Now these two rows are a little different. The power runs across right across, so these ones on the outside run down the power lines down on these ones in the middle of the power runs across. It doesn't run down, each line goes across so you see, power goes, their power goes there, but it doesn't run down. So let me give you a better idea of what I mean. So you see this wire? It has a piece of metal, right? A metal pin we inserted into these holes. Right? So I inserted into here. You can see it fits. It fits. And it just dangles there. Right? It just dangles. Now, what I do is I can take that here, and I can put it in the book by there, you see. And now everything on that line that I that I put that Why into will have current going through it so I can then do something like I can lend you something like this, right? I can grab another wire. I can place it there. So they're in the same line, and then we put in the other waste. It's easier to see. So they're in the same line, right? So what happened is if I plug in A If I plug in a positive terminal there, if I plug in power there, it will go down this line. It'll go through this white wire all the way to here and then through the red wire toe wherever the red wires connected to. So, yeah, that I hope that demonstrates what I'm trying to say when the power runs down here, but only across here. If I move this this red wire and I place it here, the power won't run. The power won't run because everything in the middle doesn't run down. It only runs across. But if I get my white wire again on my place, it on the same line as the red wire again, the power will work because the power runs all the way down here through the white wire to here and then across on through here. That's what bread boards are. They allowed the prototype electron ICS. You can get thes special wires, and you can sense you just plug them in, plug them into the circuit on It's really as simple as that. They're fantastic tool. You don't have to worry if you don't have one of these because we will be doing all of our I work in a simulator. However, the simulator is exactly the same as in real life. Anything you learn the simulator, you can apply on a real bread, But we will be using a virtual bread board which looks just like this part from us all simulated. 4. Your first circuit: hello and welcome in this lecture. We're going to create what I showed you on the bread board in the last video. We're gonna use the Tinker Cat simulator to do this. So just type in tinker cad on Google on your seating cat dot com Just click that and you're gonna want to sign up, right? But I already have. So I'm going to sign in and I'm gonna signing with Google, and then you'll see three D designs. We don't want this. We want circuits. You see circuits down here, Just click circuits. Okay, An impress. Create new circuit. Once you've done that, you should see this blank screen. So the right you'll see components scroll down until you see bread boards. Small. Click it once. Move where you want it to be and click again. This is our virtual bread board. You can use your middle mouse wheel to scroll in on out of the circuit. I'm gonna move my bread board to the left here and I'm Guinness. I'm going to select the Arduino Uno are three. I'm gonna click it once. Ah, left click again to place now, For the time being, we're just gonna power our circuit via the are due e nos five vote port and ground pots here. These parts are very useful for providing power to your circuits. The power comes in through the USB powers. The Arduino on the Arduino gives us a nice five volt output to power our circuits. You could also use the battery. I now want us to zoom back into our circuit. We're gonna left click on the 50 pin. You'll notice this. What is this? This is a wire, a virtual wire. Now, I just want you to bring it down a bit. Left click again just to stop on it. It'll it'll bend the way like this. As you can see, Scroll out with your middle mouse. Well, and we're gonna put this into our plus on the bread board here into the first pin that you see left, click. And there we go, and you'll see this color. And it's currently green. I want to change to Red to represent power. Okay, we do need to connect our negative terminal as well. So here you'll see a ground pin here, right. The negative terminal should always go to the ground pin so less left. Look on ground left leg again. Here, scroll out with middle mouse wheel and we're going to put it into our negative terminal on the Braille board on. We're gonna change the color to black. Okay, So you should see something like this Now on What this is doing is it takes power from the Arduino and it runs the power all the way down this track here. So all the way down the plus all the way down the negative on the middle of the circuit here is not is not powered at all. Okay, so now that you've done that, let's Ah, let's actually put a light admitting die owed in our circuit so that we can light the bulb up. So all you need to do is left Click the led and we're going to put it here. The top far circuit by there. Now, this is an led. When you pass power through it, it lights up. Basically. Now you'll notice two legs on the led. You'll notice a straight leg and the leg to spend now when you buy, these led is in real life. The longer leg usually represents the positive terminal right on. The shorter leg represents the negative terminal. So this is how you need to connect them up now, the actual ah length of the leg here that they're the same length. But you can see that it's bent a little bit, because in the simulated, the leg on the led is bent a little bit. That is a signifier, that we should connect our positive terminal to that leg of the led. So let's just connect that now. And if this is a really circuit, by the way, do not follow what I'm doing right now because you're led will explode. I'm just keeping it simple for the time being. So we're gonna left click there, and we're gonna left, like, here. Okay, so this transfers power from our positive terminal here to this line on our bread board. So it will power this line Only all these other lines will not be powered. Please see the bread ball video to see how power goes through the bread bowl. Because I explain it in detail. Now our negative terminal here, we need to connect that one to this leg. So once again, the negative terminal will line up on this entire line. Okay, So what's gonna happen when we start the simulation, then? I mean, let me explain. The power is gonna come in through the yard. We knew from the computer using the USB five volt is going to come through here. It's gonna come down this entire line, this wire here, the screen wire, it's gonna go through here all the way through this line through our led, causing it to explode in real life. Said has sat down with it in real life. And then it's gonna go beyond the current is going to go through this leg here that straight back up here, and then it's gonna travel all the way back up all the way back into the Arduino ground. So that's just a demonstration. Now I'm gonna press start simulation. You can do this too, and you can see that it has lit up. But it has a symbol of an explosion. The simulator is telling us that if we run this circuit in real life are led will explode. Oh, our smoke up or break, you know, basically will damage the component. I'm now going to show you how you can prevent these LTD's from exploding now. Firstly, why do they explode? Well, we're passing five volts straight into that Eddie D. And that's just too much current. It's just too much current. The led can handle it. It explodes, smokes up breaks. So we need to provide some sort of resistance in our circuit. And there's a little component in electron ICS that is called a resistor for doing just this. Now, we're not going to go too much into resistance on this tutorial. This is essentially just a hello world Tau Electron ICS. But anyway, we will put the resistor there. But you won't really understand how it's working. This will be explained in another lecture. So left click the resistor And what did you were Just gonna place it? Okay, now, currently, this is wrong. It shouldn't be placed like this. If you go to the left here, you'll see this little icon. This means to rotate. Just click it twice or three times three times should do it. Okay, Now drag this and place it by here and delete This wire is well, you can do that by selecting it and pressing the delete key on your keyboard. Okay, If you press start simulation now, it will not work that the led doesn't light up. This is because we no longer have are positive line going into our led. Now just keep things simple. Let's change the color of this wire here to black. Just so we know the vast for our negative terminal. Just keep it simple. Okay? So we're going to do now is we're going to create a wire from our positive to this resistor by here. So let's first off our simulation, and then we're gonna left click here, and we're gonna drop the wire here, and we're gonna change the color to Red. Okay, If we know press start simulation, we see that our led lights up. It's very dim, but it doesn't explode. Now again, what's happening this time is the currents traveling from our computer here for the U. S. B into the Arduino. There's them power coming out of the five volt party of the pin and it travels down our bread board after this wire through here, through here. And then it goes through our resistor, okay? And then it goes up here through here through the led down here and then away back to the Arduino ground. Now very mind. It's important that this I explain the difference between the legs on the led is important . You get it right, Because thes are die odes on dial's only allow current to flow one way. If you was to flip the legs around so that the bent leg, the longer leg is on the negative terminal on the straight legs on the positive, the led will never light. Okay, so I just want to clear that up now, essentially the resistor. It slows down our current right, so that the led doesn't have an insane amount off current passed through it, causing it to explode. Now there's many types of resistance, and you have to pick the right one for the component you're using. This is actually the wrong resistance for an led, which is why it's so dim. I'm just gonna change this resistance to 2 50 and we're gonna change it from the K OMs here to just the arm. Okay. And this is the correct amount. Resistance for this led. So the question you're probably asking is Well, how do you know what resistance to use. On what components? Well, there's a thing called arms law for calculating this, but we'll go Maura into that in detail later on. So, congratulations. This is your hello world led example. I hope you enjoyed this tutorial. You should now have an entity that slipped. And if you perform this exact circuit in real life, you will also see a rial led lighting up. So before we end this tutorial, I've remade our circuit in a simulated. That shows exactly what's going on. Um, now this is Ah, schematic. Run through a simulation. This let me just stop simulation here. This year represents a resistor. This year is our power, and this year's are led. Okay, so the this is how it's drawn on schematics as well. But more on that later, you can see here The positive terminals here is represented by the longer line on the negative tunnels represented by the shorter line. So current flows through here through our 250 on resistor. Throughout led and then back Teoh our negative terminal. So I just run the simulation. You can see what's happening. The currents going through the resistor which slows it down throughout, led back to ground. Now I'm just going to change the resistance value to 10. Something really small. You can now see the current sped up. There's no sped up quite a lot. If I change it to 100 you know, we can still see that it's faster than if it waas 1000 home. You know, 1000 armed resistance. We'll see the allergies barely. Let the current is going very slow. Set that to 10-K home Now you know, the Aditi's barely even on. Put it back to the resistance. A 250 arm. We can see that the alleys Let again. Sophie. That explains how resistors slow down current. But we will go much more in depth on that later on. Okay, thanks for watching this video. 5. Blinking An LED Programmatically: hello and welcome. And in this tutorial, we're going to work on what we made unl ass lecture. But we're going to make it so that led blinks Currently last lecture. We just hooked up the power and ground to the led so that it powers on. Let's not make it so it blinks. We're going to do this programmatically. So let's get to it. Okay, so the first thing we do, let's stop simulation, and I just want you ignore this. Led for now, just scroll in. So they are doing now. Here knows You see this blinking light? Well, this is linked to pin 13 and pin 13 is a great pin to use for making stuff blink. So essentially these Airil digital pins, right? Eso they can output current all the output. No current. That's how it works. I just want you, Teoh, Stop the simulation. Click the Arduino and press code. You'll see all of these blocks. This is kid stuff. You know, You want to learn this properly, So let's change from blocks to text and you'll see a nice little C program here. Okay, so this set up function here is the function that Arduino calls when when the artery nose first turned on on. The responsibility for this function is simply to set up things that are essential for your circuit toe work. So, for example, in this instance, we set digital pin 13 to an output pin. Now some pins input pins so they can receive information. Other pins output pin so they can output information. Now by setting pin 13 output. We're essentially saying we want to be able to output coat to this pin programmatically. So now let's explain this loop function here. What's happening here is Arduino calls this incrementally like very frequently basically on , um inside of here. We do a digital right to pin 30 and we make it high. Now high means current low means no current. Okay, so high means power low means no power. Okay, so what we say here is set pin 13 toe high so that there's electricity that will run out of it. And then here we delay for 1000 milliseconds, which is one second, by the way, and then we turn it off. We said it so low. So and then we wait another one second. So let's just reconfigure our circuits so that it uses pin 13. So it blinks again If we press start simulation, the reason we see this led blinking here is because this is length to pin 13. Okay, we're now gonna make it linked to our real circuit here so that we see our led blinking on the board. All right, stop the simulation. We need to change some wise around. First thing you do. I want you to delete this wire here by selecting it. I'm pressing the delete key. Okay, great. Now we're just gonna press code again here to close this. Okay on. We're gonna scroll in here. We're gonna click pin 30. We're gonna scroll out on we're going to click our resistor here while the same line the resistance on, well, changes to read to represent power. Now, just press start simulation. You now noticed the led blinks. It goes on off, on off, on off. Now that is because of our program. If we go back to code by pressing code, we destroyed right to pin 13 high. We delay a second digital right to 13. Low delay a second. Andi again. Pin 13 is clearly represented on the board on our wire is attached to it. Okay, I hope that makes sense. Let's change it so that there's a delay off five seconds. So just press the code view. Change the one. First unit stopped simulation, press code view change the 1000 here to 5000. Okay, so that'll delay for 5000 milliseconds, which is which is five seconds, guys. Suppressed start simulation. Now we see that it's on. Looks like it's stuck on right? No, after five seconds will go off. There we go. Now is off now another five seconds again. Looks like it's off forever after five seconds is back on. So, you know, that's essentially what we're doing here, right? Andi? Let's change the delay to something very small. Stopped simulation. In fact, this removed the delays entirely on. Did you should see that it looks like it is stuck on constantly, which we do. It looks a little dim because it's constantly putting current, removing current, putting current, removing current constantly, right. So that's why we needed to lay their if we put a delay, a delay here off 1000 like before on then we delay another 1000 here. Then we'll see that it links one small. So you just programmed your very first circuit. So I hope you're proud of yourself there. So once again, let's go over this. The set up function is called when you first turn the Arduino arm. The loop function is called very frequently. Okay. So just to make a good end to this tutorial, let's change the pin. It uses a cape. So I wanted to change in the code. I wanted to change the pin. 2 12 Okay, on just go. 12 high destroy 12. Digital. Right, 12. Okay, so we set the pope. We set the pin 12 to an output pin, which means we're out putting, right? If it's an input pin, we receive current. We receive Ah, higher or low. If it is a output pin, we output to that pin, okay? And we're working with digital pins. Currently, there's analog pins, but we'll get on that at another time. Okay, so you should have changed the pin to 12 now. Okay, Press start simulation. And what 60 led doesn't like any more, and also the led on our Dewey knows no longer lighting. That's because we changed our code to use pin 12. If you now stopped simulation, delete this wire by selecting impressed the delete key on your keyboard. We are going to select pin 12 and put a wire. We're gonna scroll out with the mouse wheel on whether in going to put that there, change it to read. And now you should have a circuit that looks like that. So there's a wire from pin 12 to our resist ah, which then feeds the currents of the led press start simulation. We see it's on off on off. Excellent. So I think you now understand what's going on here, right? We set up a pin for input or output, and then we can write or read from it. Essentially, you haven't looked at reading yet. This is just writing at the moment again. We'll get to that end of the time, so examples of reading, by the way, might be a button press. We might have a button on our board. We might want to see if it's press down, then would read right. So we connect this to a pin just like we've done here, and then would read from the pin, if on now would tell us if there's current going into that pin or not. I either button being pressed down. So, yeah. Congratulations. You've now made an led blink. Good job. 6. Resistance And Ohms Law: hello and welcome. And in this lecture you will learn all about resistance in circuits and arms law. So, firstly, what is resistance? While you can think of resistance as a blockage in a water pipe, slowing the stream of water, it works the same. In circuits. You can create resistance in circuits, so the current isn't as strong on protects the components of of your circuit. So resistance is essential for ensuring safety and circuits on. It's essentially the slowing of current in a part of a circuit. So what I resistors. They are components of a circuit that are made for creating resistance. They slow the current in a part of a circuit. They're also color coded on offer, all different strengths of resistance that is measured in arms. In schematics. Resistors can be drawn like this or like that. Resistors are color coded so that by picking one up, you can easily see the amount of resistance that this resistor provides. Let's take a look at this example and our chart. We can see that the first and second bands have a multiplier on. There's also a tolerance. So let me explain how this works. Using all of these colors here we can work out what the value in alms this resistor is providing. So let's now work out what value this resistor is. We can see brown, green, red and gold. Let's go through this. So if we look in our chart, we can see the brown has a digit of one. So let's mark one. So So we're aware of this, right? We're gonna need to know this later on. We can see our second digit. All the second band is green, which is represented by digit five. Okay, next we see red. Now this is our multiplier. Now we can see that our multiply is 10 to the power of to which is 100. So what we now need to do is calculate the final what? The final one, which is the tolerance We can see that that is gold, which means 5%. Now the tolerance is just a percentage of how accurate this resistor actually is. So for a 5% for a 5% it could be 5% less accurate or fights and more accurate than our resistor value tells us that's all the tolerances. You don't have to worry too much about that. Okay, so now we have 15 and 100. How could we find out the resistor value from that? What we do in equation, we take the first and second band and we append them together. Given us 15 we then multiply this by our multiplier, which is 100 on the answer is 15,000 alms or 1.5 Killer arms. Killer arms is 1000 arms. In case you did not notice already, this symbol represents arms so we can see that this resistor it has a value of 1.5 killer arms or 15,000 arms. So it provides 15,000 arms of resistance. Okay, let me show you a resistance example so you can understand a bit more. What's going on here? Well, here we have a simulated like before. We have a 250 old resistor here, right? Look at the current. Look how fast it moves. Okay, Don't forget that we play it one small fast for 250 ohm resistor in a simulator. Now let's go to the next slide here and now we have a one killer arm resistor. Now observe the speed of the current Notice how much slower the current is for the one k on resistor. For the 1000 old resistor, it is much slower than our 250 on resistor. In the previous video, you see much faster on we go to our one chaos much slower. So the higher the OEM, the more resistance there is in the circuit. Let me now explain arms law So arms law could be used for calculating resistance. Essentially, we can use arms law to calculate the resistor that we need for a particular component such as an led. For example, arms low can also be used for calculating voltage and current so arms laws generally represented by this triangle with V at the top I on the left and are on the right so V means voltage. I means current and are means resistance. Now, knowing just two of these items, we can always calculate the firt the third. If we know V and I, we can calculate our if we know Vienna, we can calculate I So, um so to calculate current, we do voltage divided by resistance calculate voltage. We do. We do current multiplied by resistance to calculate resistance. We do voltage divided by current. Now that you understand all of that, let's Ah, let's go shopping. We're gonna look for a an led online. We're gonna look at its data sheet on. We're gonna calculate the resistor we need to use in the circuit to safely use that led. Obviously, when are really gonna be buying anything here? I just want to show you a real life example. So you understand how to do these things for yourself. So I just found this eBay listing for these LTD's. If we scroll down, we can see here it says the forward voltages 20 million amps. So using this value with arms law, we can calculate the exact resistance value that we need for this circuit toe work safely with an led. Now, if you remember correctly, the resistance is equal. The voltage divided by the current. Okay, so in this case, the current is 20 million amps and our input voltages our choice. So if we want to power our circuit with five volts, then we could just say V equals five. If we wanted to power with 12 volt battery or nine volt battery then, you know, we were put voltage of nine on. Obviously depending how much voltage we have in our circuit determines the resisted we need to use to safely power. This led. So we'll stick with five volts, and we also need to convert from 20 million amps into amps. So to do that, we just go 20 divided by 1000. And that's how many amps that is. Okay, because Milly amps if we divide that by 1000 we get amps again. So what we're gonna do now is we're just going to go five. We can see that, um 20 divide by thousands. $0. 02 So we're just gonna go five, which is voltage divided by amps, which is zero dot c or two on we get a value of 2 50 So we need a resist ah, with the value to 50 for this circuit to safely like that, led without risk exploding it. Now there's another thing called voltage drops on. If we take voltage, drop into account, then we can calculate a more realistic, resisted value. But as this is a beginner's course, I will not be covering that, um if you use this equation like we've done here. Your circuit will be perfectly safe. So let's pretend we now have 10 votes, right? I mean, nine volts is be realistic and nine volt battery. What we then do if we wanted to find out the resistor value, if we wanted to power the certain from nine vote, then we would just do nine divided by zero dot c or two, and we get for 50. So we need to resist the value of 4 50 to safely power the circuit from a nine volt battery . If it is lighting, one led. So as long as you use arms law, you have nothingto worry about. There's also plenty of online arms law calculators, so you don't have to do this manually every time. If you didn't want to. So once again, if we wanted to be able to power and led from a nine volt battery, then we'll need a Fortune 50 on resistor. Sometimes you'll get out values, but there's no resist to fall out value, in which case just used the next resist up 7. Push Button Programming: Hello and welcome. We're now going to create a circuit with a push button that powers on led when it's pressed . After we do that, we're gonna set up the Arduino on make it so we can actually read button presses. That would be pretty cool. Okay, so let's get up our simulator again. So we're just gonna type in Tinker Cad, We're gonna go to circuits, create new circuit. So let's check in a bread board. That's the very first thing I want us to do. Okay? And now we're Let's let's put in our hard. We know we're gonna use it for power again. We're not actually gonna use its code. Just Yep. We could use a battery here, but we'll just power from the Arduino is easier. OK, now let's get in an l e d on and a resist. Ah, put the resist. Ah, by here. This is so the led doesn't explode. Remember, we're going to change the resistance toe arms, this symbol. Well, just to 250 arm. That should be That should be okay. Um, have to see if this was a real circuit. You would make sure that that is definitely the correct resistor, but to 50. Should be fine. Friend led. Okay, so what we're gonna know do We're gonna take this and attach it to the negative terminal. We're changed the white color to black. Okay, so obviously, you know, the positive terminal feeds in here. Lights the led comes down here through the resistor on back to ground the resistor. It doesn't matter if it's on the positive terminal or the negative for this led. It's completely fine, which ever? One. Okay, so the next step is we're going to get a push button in this circuit because we obviously want we want to push the button. And that led comes on. Right, So just click push button here. Now you see this little hole in the board by here? Just place the button just in the centre by their Okay, So just a quick overview, then Terminal one B and Terminal one a are connected journal to be and terminal to a are connected. Okay, but they're not. The terminal to be is not connected. Terminal one be OK. So make sense. Okay. Cool. So, uh, let's create a wire from our positive terminal here to here which is Terminal one A. We're gonna change the color to red now on terminal to be Let's make our wire cross here to here. I will change the code red. Okay, Great. Now what? Now? All we need to do is connect the positive and negative to the five on ground of the Arduino . So just select the five or pin on the Arduino, and we're gonna connect that to the positive on the board. Changed color the red. We're going to select the ground next, and we're going to connect that to the negative. And we're gonna change this to Black. Okay, If you know, press start simulation and you press the button, you'll see the led comes on. Let go the button. 80 goes off. Press the button. 80 goes on, Let go the button. How did he goes off? So how is this working then? While ah, laptop or computer feeds the power to the Arduino power comes down the five vote pin into our boards. Remember, this is entirely electrified. This this entire line. So the power travels down through here. It goes through this red wire on it goes into Terminal one A but the power can't go anywhere because the button is not pushed down on one. The button gets pushed down. It completes the circuit because the metal touches right, allowing the current to flow through. But until our buttons press down, they don't touch. So the power has nowhere to go. Okay, so what happened is it will feed through here. It can't go anywhere, so nothing happens. Soon as you press the button, the metal touches and then the current flows to terminal to be on to a And then what we have then is the power goes through our wire. It goes into our led lighting it on. And then it goes all the way down here through our resister, back to ground and then back to the Arduino is ground. So hopefully that makes sense by pushing the button down the metal touches, completing our circuit. Okay, so that's all well and good. But why don't we spice it up a little bit less? Make it so that so the button gets fed into the Arduino. The Arduino then knows that the buttons being pressed and it can do in action such as blink the led or it could do nothing. It can do what it likes. Let's do that next. So that's a little more complicated. So what we're gonna do is, firstly delete this wire here. Okay? We want to keep our resistor here for the led because we're gonna be reusing this. However, now on Terminal B, instead of feeding into the led, we're gonna feed it into a pin on our Arduino. So just create the wire like this on will go for pin eight pin a could be fine. We can use any of these digital pins, but we'll use Pineda, so we're gonna change that too. Let's go forward, Gray. Just to represent that, it's say, data pin right that this is attached to a data pin. So what's now gonna happen is when you start simulation, you press the button. It will feed the current into pin eight. Now, some think unusual is gonna happen on I'm gonna let it happen so that you can understand why. But anyway, let's go to our code view on. We're going to switch from blocks to text again. So this is the code for the Arduino right now on. We're going to create a new pin mode for pin eights, which is what this wise attached to. We're just gonna go input. So in case you weren't already aware, the Arduino is programmed with C plus plus. Okay, So once you've done that, then I also keep in move fittings. We're gonna use that. Um, So once you've done that, then just delete all of this and we're going to go digital, right? 13 Digital read eight. Okay, now, don't worry. If you don't understand, I'll explain it. Okay? So once you've done that, there's one more thing you need to do. We now need to connect the early D to pin 13. So if we just press the code time again so it goes away, we're going to create a wire from our led all the way. It's a pin 13 and we're gonna change that gray as well. Okay, if you press start simulation. What's this? The led is on. Even though the button hasn't being pressed. Why is that? Well, these digital reads is so sensitive that the slight bit of current that gets leaked, it will detect it. Okay. So even though the button is impressed, it still leaks a little bit of current. So what you can do to get around that is you can put a 10-K resistor here to our negative terminal. If you know, press start simulation and you run that again can now see when you click the button, it comes on when you let go, it goes off. So that now solves our problem. Now remember, terminal to a and terminal to be are connected However it is, this is currently a one k resistor change. It's 10-K and that will ensure that not too much current ends up going to ground when this buttons pressed. Okay, I'm now going to explain to you a bit more about the code involved here, So we set the pin mode for for pin 13 is output pin, which means we can give it a high or low value power or no power. Basically, on we set pin A is an input pin, which means we can receive power or no power and be able to detect if power was given to us or not. That's basically what's going on there. So here we say digital, right, 13. Okay, Now, this expects either a high or low value if it's given the high value the led goes on has power. If it's given a low value, the led goes off. It has no power. Okay, but by passing and ditch to read like we did, did you read? Eight returns high or low. So if there's current going into our pin eight, then this is high. Yeah. So what we can do? Ah, we can change this now to spice it up a little bit. So we're gonna say is we're gonna say if digital read eight equals high, then digital right, 13 high. And we're gonna get rid of this lying down here. So, you know, press start simulation and press the button once, he added, He goes on, it doesn't go off. We can switch it off anymore. I asked the power microcontrollers, right, weaken. Receive input on do particular actions based on what we get. So here we check if the eight pin was pressed. If it's pressed, then we set pin food into high, and we never said it too low again. So it's always on. Not bad. If you want to be smart, then you can do a delay after press stop simulation. First wing do a delay here. Still a for five seconds. 5000 many seconds, and then we can just switch it to low again. If you know, press start simulation. Press the button. 12345 And it's off again. I was a little more than five seconds. I think the simulators are a bit slow. Yeah, if you look at the simulation time, it isn't quite one second is one rial second. It's a bit running a bit slow. The simulation is so that's why we took a little longer than five from five seconds. If that was in a real circuit, it would have took five seconds. So that's not bad. And if you keep this press than the led, will obviously stay on forever if you just hold it down. Because each time it loops back around, um, it will see that it's high again and digital right high. I know after the delay we did to right low, but because there's literally no time at all that it has Ah, in the Low State, the naked. I can't actually see the led going off. So we let go and then you know, five seconds later, that will go off. Okay. So, congratulations. You've now created buttons in your circuit, Hope that made sense. 8. DIode's explained: Hello and welcome. In this lecture, we will discuss all about Di odes. So what? Our diets styles are electric components that allow current to flow in only one direction. They can protect circuits, and they are used in L E D's. Hence the name light admitting diet. L E. D. Now, let me just go over this a little more dialed. Allow current to flow in only one direction. Now, this is true. Up to an extent, one side of the diet has very high resistance. The other side of the diet has very low resistance. Now, obviously, if you pump too much voltage into a circuit, then the current could end up flowing through the other direction, even though it was never supposed to. Okay, lets carry on. So Dial's look like this. This is what they look like on this is what it looks like in a schematic. Um, you usually don't have the a note. Cathode text in a in a schematic, though this is just here to make things much clearer for yourself. You can see that the symbol looks like a shield. Right? So what this means is current can flow this way from left to right. But it can flow from right to left because it's like a shield in the way you see it. That's how they represented. So let me show you a simulation of a diet Example we can see here we have our power. We have our dialled on. We also have a 250 on resistor because passing current loop like that is dangerous. Right? So we do need a resistor, Otherwise wires can melt. All right, last press play. We can see the current flows through the dial through the resister back to ground. It does this quite efficiently. Okay, Now I put the dialled the wrong way around this time. Now watch what happens when we run the simulation. Nothing. The current cannot get through because the current tries to go through. But it said the wrong side of the diet, so the dough does not allow current to pass. Okay, this is ah, dialed on a bread board. Example. So here we have a three volt coin. Battery power comes in, it goes through the dye owed lighting are led right on, then straight through resistor. Back to ground. This is a six on resistor. I had to you put a resistor here because even though the coin battery can safely power led the simulator Waas telling me there was there was a little bit too much current. So we had I I worked out mathematically. We need six on resistor here for this revolt. So again the current comes in it comes through the diet through the early D to ground you knows theologies a different way around this time I rotated it. So that's why that's why you can see that this is the bent leg where the where the positive current goes through and and this is our negative straight foul resist back to ground. So if you turn this die or the other way around the led would not light because diets only allow current to flow in one direction. 9. Arduino Interrupts: Hello and welcome. So I want us to go back to tinker cad dot com and we're going to create a new circuit. Now, what we're gonna be doing in this lecture is we're gonna be using an Arduino interrupt. So what isn't are doing No interrupt. You can set up interrupts in the Arduino. So one certain actions happen. The process er in the Arduino is interrupted on it will immediately execute your function. Such as a blank function, for example. So what I want to do that I want to put a bread board on the canvas. Okay. Great. And now we're just going to quickly set up a little circuit here, Like before. Um, we're also gonna have resist ah, and will change the own 2 to 50 just for now. That will be fine. And we're going to get a push button as just like before. And you're welcome to you. Welcome to change the previous circuit. If you want. I just I'm just going over this again so that people can, you know, test their skills with the repetition. Okay. So, um, what we're gonna do is we're gonna get now. Do we know you know. Okay, Andi, we're gonna put five vote into this terminal in a change that to read. We're gonna put the ground here. We're going to change that to Black. Okay, cool. Andi, we're now going to put our positive terminal here. Change that to read. We're gonna put a 10 killer arm resistor from this terminal to ground because, remember, we want to be able to read a proper value, right? If we don't ground it than things like an electromagnetic radiation from your phone and stuff, it can cause current to go down that wire. And they are doing a will have a false positive. So by grounding it, wish we ensure that doesn't happen. Right? As explained in the button video. Uh, okay, so now we're just going to make a wire from here. We're gonna put it in pin to cause pin two is an interrupt pin we can use pin to to do to do interrupts. Right. So we're gonna put him pin, too. We're gonna change the color to red. Okay. And now we're going to get one from pin 13 here. Onda, we are going to put it all the way down here the wiser, A little messy, and we're gonna put it here. Okay, we're gonna change that. The red so obvious. E pin 13. When the current goes through, go down the wire through our 250 on resistor through the led. And now we need to make a wider ground. So just click that we're just gonna make a black wire to ground like that. Okay? Call you best start simulation. Now, you should see that the led blinks because that's the default code of the Arduino one. We when we load up Tinky Cat. Okay, Okay. We should be ready to stop the programming now. So again, you know, our five all comes in here. Are ground comes in here, feeds the button when you push the button down the metal touches, causing the current to go all the way through here into pin to now. You can use all pins for interrupts. The only pins in the Arduino Uno two and three. They're the only ones that could be used for interrupts. Now, I know at this point you probably don't even know where the interrupt is. But don't worry, we get into it. I want us to go to the co view of the Arduino Uno. We're going to change it to text, and you can see this to fall code again. Well, I want to do now. I want you to go pin mode, and I want you to put in to I just set that to an input pin, get rid of the code in the loop. And here we're also going to say attach, interrupt, digital pin to interrupt, and we're gonna put in to in here. Okay, now, here is the I s Are we're going to just put button under school changed on here. We're just gonna put change. Okay, so we now need to create a function called colder button change to just go avoid button changed. Okay, So what's gonna happen now, then, is whenever the button is pressed or released, the button change will be called. Okay, on one has changed. Weaken, do a particular operation. So here we can go digital, Right? 13 on Go. Did still read too. Okay. If you now press start simulation, press the button, you can see the led goes on. Let go. The idea goes off. So I hope that makes sense. Now, let's make this a little more efficient. Get rid of this. And at the very top off our foul, we're going to say volatile. Um, char state equals low. Okay. And then in button change, we're gonna go state equals state. Now, make sure you put a explanation mark here so that it flips from false to true or flips from true defaults. Um, okay, on then and here we're going to say did still right. And we're going to say 13 on We're gonna pass in state unless our loops. If, you know, press start simulation, we press it again. Comes on, press it. I release it. It goes off. So what's happening here is we attach, interrupt to pin, too. Okay, We tell it, we wanted to call our button changed function whenever the current changes from low to high or high to low, but change then gets cold. We then set our state bearable, um, from false true or from true to false. Essentially, that's what that's what we're doing. By using the explanation mark here on then we just did so right out of state to pin 13 causing the alley to go on or off. So that's exactly what's happening there. So once again, by using the explanation marked like this, it just flips it from false to true or true to false or, in this case, high, too low or load high. So there are a few states we can use. We can use low change, rising and falling. Now, let me explain them a little more. We already know what change does this calls our I s r interrupt service routine. Regardless, if it goes from low to high or high to low Justus, long as there's a change, it will call our function. So when our mode is low, then it gets triggered when the current is low, our interests service for team will get triggered when the current is low. Now rising will make it so When it goes from low to high, it gets triggered. Andi falling will make it trigger when it goes from high to low. So that vast basically interrupts an Arduino. I hope that makes sense. Essentially, what is happening is whenever and interrupt is activated. It actually interrupts whatever the process was doing and it will then call are interpreting Here. Do what it needs to do on, then carry on, executing where it was last doing work. So that's how interrupts work. We interrupt the process, er we call this function and then we jump back to whatever we were doing. That's how that's how in trips work. So there's a reason why we set state here and then did still right in the loop. And the reason is because interests quite heavy, why not Process against Interrupted is essentially stuck in this interrupt routine until it's finished what it needs to do now for more, for more efficient code and on DA, a system that works more efficiently, it makes sense to use interrupts to do very small tasks, such a setting flags and then, during most of the bulky work in the loop itself. 10. Capacitors Explained: hello and welcome. And in this lecture, I'm going to teach you all about capacitors. So, firstly, what is a capacitor? While a capacitor is a century like a mini battery that can go into a circuit it charges extremely fast and releases current when the circuit needs it. So simply put, they store alleged charge. They can be thought of as like, a battery on. They help maintain current in a circuit. What do I mean by they help maintain current in the circuit. Sometimes the current in a circuit can become distorted by having a capacitor helps even it out. So what capacitors look like? Well, you have many types of capacitors, but they can look like this to our left. We have a polarized capacitor to our right. We have a non polarized capacitor. This is the schematic symbols for capacitors. A non polarized capacitor looks like this in a schematic. A polarized capacitor looks like this. So what I passed is used for Well, we use them to restore drops in current caused by power greedy components. As I explained earlier, we can use them to store temporary information. So think of your computers ram for example, capacitors also have many other applications that are unrelated to this course, so polarized pastors should only be used in D C circuits. They must be connected with the correct polarity. So what that means is you have taken to account a node and cathode. You know, the plus terminal and the negative terminal has to go in the right way, a little like are led. If you put the led in the wrong way, it won't like right. It's a little bit like that, apart from if you put this one in the wrong way, it it explodes. So you need to take that into account. So polarized pastors they consume more power than non polarized capacitors, so it's important to keep them to count as well. Onda. And there's an input voltage on on these Polaroids. Capacitors on it must not exceed the maximum limit. If it does, it can catch fire and explode. So this is our polarized capacitor, as seen here with the schematic symbol and what it looks like in real life. So non polarized pastors are a little different. They could be connected in any polarity inside the circuit. So doesn't matter. The way that you put them in. They consume less power than polarized capacitors. And once again, input voltage must not exceed the maximum limit. So I have a simulation of a polarized pastors, so you can see what happens. Let me just explain this a little bit before before I press play. Ah, essentially, when we close this gate here, it completes the circuit, which will cause the battery here to like the led and also charge are capacitor when we turn the power off the batteries now off. But the capacitor releases its energy lighting the led even though the battery isn't on. So let's play that so you can see how that works. So we closed the gate. Onda. What has happened now is the capacitors charged. The led still lit because they because the battery's still connected, let's press play again. And now, if you notice I've now cut the power by cutting the switch, essentially cutting the wire so so the battery can no longer send power to the led. But we still see that the led is on because it's now being fed by our capacity so you can see that it goes on and it slowly dims as the current in the pastor slows down as the voltage drops. So once again, we charge it by closing the switch and then the pass is charged. We could we open the switch again so the batch can't give current, and then the pastor will feed straight into the early D. So I hope that makes sense on polarized capacitors. So I've also set up a polarized pastor in Tinker Cad s so you can see a little bit more of a realistic example. So let me explain what happens. We have a nine volt battery here and before I continue, I haven't used any resisters in this circuit. If you do this circuit in real life, you're led will explode. I avoid its resistance and stuff because I just wanted to just demonstrate how the how the pastor works. I don't confuse you with loads of different components, So here we have a switch. Ah, this When we switch this on, the current can run from the battery, lighting the led and charging the capacitor. When the switch is off, the battery just cannot charge pastor and cannot like the l e. D. There's just no path, right? I looked like in the simulation that I just showed you in the schematic. So if we press play on this, you see, we press the sweats, turning the idea on. We turn the switch off on the led. Still lit because it's now being fed from the current from the capacitor. Even though we've disconnected the battery by turning the switch off, you can see the 80 slowly dims that we press it again. Theeighties Now on a for maximum power. Press it again. Now that passed his feeding the led again. So let me explain how this is working. The current comes in from the nine volt battery here goes to our switch. Then if the if the switches on, then current will proceed to travel through the middle section here the middle pin it goes through our through our diet here and then into the capacitor charging it. Okay, It also travels down here lighting our led. Okay, Now, when you disconnect the power, there's there's no more Cohen traveling from the battery. But the capacitor here will now output current food here. It will try to send current back to our battery here but because we have a dialled, the current can go through. This diet is very important. Without this, it could be bad sorts of the current travels down here from the capacitor, it feeds into our led. Now there's no resistance. So in real life the idea explodes. It's a simulation, so it doesn't, uh It goes down here back into the negative terminal of our capacitor, so I could pass the sort of acts is a temporary battery that was charged from online volt battery. Pretty cool, right? 11. LCD Screens With Arduino: hello and welcome. And in this tutorial, you're going to learn how to write to an LCD display. So first things first go into your components on, we're going to get a bread board. We are going to get another. We know Onda, we are going to search for L C D. In the search box and we'll see this one here, and we're going to just put that there. Okay, Cool. So if you've ever used a vending machine to buy Coca Cola can or something like that, No doubt you've seen one of these and it's said something like, select your selection or something like that, Right? Well, we're gonna program this today just to write Hello world. So that should be pretty interesting. Now, if you look up my second tap here, I've got the liquid crystal library on the Arduino. Documents opened up, So ah, to get to this page, just go to Google and type liquid crystal Arduino Onda. When you find the are doing adult cc reference here to the liquid crystal, this is the correct one all you can just do what I say and you'll have the same result. I'm just teaching you how to learn these things for yourself, in case you come across anything in the future that you need to learn. Okay, So if we click on the constructor here on this function, we can see it tells you what it accepts, and it explains a little bit about what goes on. So in case, you know, aware already the liquid this is a liquid crystal library for Arduino. It basically contains code that rights to our LCD display so that we don't have to manually talk with the pins so you can see here. What happens is we We include the liquid crystal had a foul, we create new liquid crystal, and we pass a bunch of pins into the constructor here. Right? This is C plus plus. And if we look at the document here, it tells you what these pins do. So this should be the RS pin. And if we go back to earth to our simulator, we can see the r s been here. Right? So it tells you where to put these pins. Basically, this is the enable pin, Celeste E. And then we have our data pins. Okay? And if you read the document. You'll you'll realize there's there's different ways toe interface with this liquid crystal . Um, so that's quite handy to know. Now, if we take a look here, then what they're saying what this example code is saying. It's saying that the RS is pin 12. It is saying that the odd w how many pins is there? Hold on. 12345671234567 123456 Okay, Is this constructor here? Okay, so they're calling. So what they're saying is, pin 12 is the are Espen pin 11 is the r w pin pin 10 is the enable pin and then fought pin 543 and two on these air Arduino pins. By the way, pin 543 and two Arduino pins. Ah, the LCD de 45 to 67 pins and again if we scroll in weaken c d 45 d 67. So in this case, what it's saying is is um, for example, um, by here it's saying that we want to attach the the D for pin on the else display to Arduino pin 10 so I hope that makes sense. And then, obviously, once we have it all connected, we can We can call LCD begin, which will then Macy start the LCD. And that sets up how many rows and columns there are as well, by the way. And then we just print hello, world. So if we just press back a minute when we go to begin, we can see that the Sanctus here is the number of columns on the number of rows. So that's why you see 16 on day one. Because what that means is it means 16 columns on one row. Okay. All right. Let's, um let's now actually start hooking this thing up for ourselves, Okay? So just go back to the actual simulator here, and we are going to do a few things first. Now, VCC is power, so we obviously need to power this LCD display, right? G n d is ground. So we need to ground it as well. The visi the V zero pin controls brightness on the display. So if this is grounded, then the screen is as bright as it can possibly be. If there's current going through this, then it will light Ah, the LCD display depending on how much current it gets. Um, so that's quite handy, because you can actually control the brightness of your screen if you're clever about using this pin. Okay. Um, so, uh, yeah, let's start hooking these pins up then. So what we're gonna do were first gonna actually power the LCD display. So we're going to need to put a resistor in here, and we're also gonna need to hook up vcc ground on these two early deepens. So follow my lead. The first thing we're gonna do is make a wire. Ah, from VCC to here. Okay. And we're going to change the color to red. Now. Just do a wire from ground to the negative terminal. That's gonna be black. Okay, so here you'll see an ode and cathode. We need to link thes up to the terminals as well. But we need a resistor on ah, on an ode here. Right, Because it will explode if we don't. So just put a one k resistor, um, from this pin, and we're gonna want to put it into the positive terminal here, okay? And then from your Katha, just put that into negative. And this is a one k resistor right now. U za one k resistor. Okay, so we're now gonna want to hook up a three volts to the positive terminal off the bread board, and we want to hook up grounds to the negative. We're using 3.3 volts here because we don't want to damage the display. If the display can handle fight five volts, that could be very bad for us. So we'll use Ah, we use 33.3 volts here. Just be safe. Andi, If we know press start simulation, we can see that the else he displays a little bit let. So that means that we've done that successfully. Now you see the V zero pen. You need to ground that otherwise you're not going to see any text you output. Because remember, I explained that one Vesey was grounded, the screens at its brightest. But when it is, um, when it has some current running through it, then then we don't actually see anything on the screen. And if it's not connected, you know there's all sorts of, like, a let traumatic waves. You know that the actual current will be undetermined, and it will cause the value here to be, you know, be frequently high and low and have cause all sorts of problems. You might not even see your text. So ground V zero. Okay, excellent. Now we're ready to be clever about this. Let's go back to this documentation and we're going to go for the same constructors these guys do. So there's 3123456 at seven pins s. So, what we see here we see 123456 sets of this constructor. Okay, so we want to hook up the RS pin, the r w the enable pin and D four through seven. Okay, so we'll start with the RS spins. OK, so if we click the RS spin here and we're just gonna put at the top of the ball by there and we're gonna change the color toe white, I tell White is a little hard to see. Let's go for a blue. Just so it's clear. And we're also using our r w pin. So we're gonna do the same for that on. We just put it in these pins just to keep the wires neat. because it's gonna be hard for you to see otherwise. And then we need to do our enable pin. And we're just gonna do the same for all of these, right? And then we have our data pens D four through seven. So we're gonna go to D four here, put that there. We can put this is an orange to represent data pins if you want. That's fine. And we know that's d through seven. So we don't need to check the spec again. Okay. Excellent. So, ah, to make this easy on ourselves, we're gonna pick up a pink up in this high enough and just work downwards. Eso will stop in 12. I'm a work downwards. Okay, so what, we're gonna do them? We're gonna go from RRS pin here, and we're gonna put that in 12. Enable pen goes to 11 goes to 10 go some nine goes to a goes to seven and finally goes to six. Okay, great. So if we press start simulation All right, That's good. It lights. That's okay. So, um yeah, we need to ground these extra pins here, so just click them, and we're just going to ground them because they are no longer required. The LCD display has many different types of configurations, which is why we see so many different constructors here. And we've chose this configuration. The same is the example code here. Okay, so if we know, scroll out and we go to the co view of our Arduino change from blocks to text, We're gonna include the liquid crystal library. Andi We're then going to go liquid crystal LCD, and we essentially going to just provide all of these pins that we've done. So we're just gonna go 12 because we know they're in order, because we made sure that so 12 11 10 9 87 and six when we should have 12345677 pins. That's correct. Okay, if you now get rid of this stuff in the loop here and we give it to this pin mode fitting output in the set up when I was going to go LCD dot Begin 16 columns. One row, LCD dot Print. Hello, world. If you now press start simulation, okay? And it doesn't work. And the reason is is, um, work is because we actually to five vote not a 3.3. So let's just delete the 3.3 wire and from the five vote feed that into the on dumb. Yeah, I guess this display needs a five volt. We pressed our simulation. We should know. See, Hello, World. So, congratulations. That's how you output to an LCD display. And if we go back to the liquid crystal on, we press the back button. We can see all of the functions here so you can clear the display with clear. You can change the curse or of the display. Which column row it should write to. There's a lot. There's a lot you can do. You can blink. Complaint the display you can scroll through display. It's a very, very powerful library for interfacing with an LCD display. So congratulations. If you link up a real display the same way as you've done here, you will be able tow right text to it. No problem. So our congratulations. That is how you use an LCD display on once again. The else to display in the simulator requires five volt, not 3.3. Be sure to check your display specifications before attaching a five volt 12. Multimeters And How To Use Them: hello and welcome. And in this lecture you're going to learn all about multi meters and how to use them. So multimedia's they used to measure voltage current and resistance. Now you can think of a multi mita as a D bugger. In software development, you can use multi meters to figure out certain voltages in your circuit. You can figure out the resistance on more so multimedia's look like this for generally a device that has two pegs plugged into it. You use thes pegs to take your reading with the red peg being the plus terminal on the black head being the negative terminal. This is a circuit example on Tinky Cad of US measure. In the voltage of a nine volt battery, you can see we connect the plus terminal. So the plus germinal of the multi meter and we connect the negative terminal of the negative terminal of the multi meter, and we then select the voltage option on the multi meter and it gives us nine volts. This is another multi meter voltage reading that shows more about how to use it properly. You can see here we have a nine volt battery and we have a resistor in our circuit Now the current comes in it, it gets reduced and then goes through the led. Now, because we use the resistor, it doesn't explode. But if we use a multimedia to check both of these led terminals, weaken C two volts which confirms that the resistor lowered the current because voltage is just the difference in charge between two points. This is us measuring the current with our multimedia, we see 25.6 million amps. This is us using the multimedia to measure the resistance of wherever one killer armed resistance. What's the value we see one killer on? So all you need to know about multi meters is they're essentially just the deep the d bugger of electron ICS, and they're very useful for determining certain things. 13. Arduino Serial Communication: we're now going to discuss Syria. Communication with Arduino Serial communication without do we know allows you to plug the Arduino into your computer on talk with your computer so your Arduino and your computer can talk with each other. This is amazing because it means you could, saying commands from your computer, such as Blink and then and then the led that they are doing is powering will start blinking , for example. It allows the argument to receive commands from a computer and also give commands to a computer. So Syracuse vacation is amazing. So, firstly, a little bit of history. Before we had USB, we had this Rs 232 ports. Now the Arduino works off the same protocol. However, when you plug your Arduino into your computer, it downloads a special driver that allows you to talk over a cuma cation to face. But all of the logic goes through a USB wire. Okay, so it simulates the Thea Comport, basically. So what is a calm part? While back when USB wasn't so serious, we had these things called com ports so you would connector, for example, come one at a speed of 9600 for example. And then you be able to talk with whatever that the device waas over. Overcome one. Now today, things are done with the U. S. B. Things have done a lot differently entirely. Different protocol. Altogether, however, the Arduino works off communication ports. However, the Arduino works off communication ports and there's a driver that gets installed on your computer. When you plug the USB of the Arduino into your computer, the driver gets installed on axis, kind of like an interface between the old style comports and USB, which is why it works. But nevertheless, we still use the old style protocol of comports. So now that you know that we can start, we can start with this. Now. Party is fantastic client that could be used to connect the service SS Hey, judge, tell net on serial parts. If you're using a real Arduino device, I suggest using putty to connect to a serial pot. Now, the reason being is because you will need it to follow this lecture. Now there are many different comports. Your your one might not become one. You can find these in device manager should you go to device magic you'll be able to figure out which part it is because it will tell you. Okay, Windows device Magic now. Anyway, since we're doing it from the simulator, you can follow my lead on. We won't have to worry too much about figuring out which comport this is. OK, so all I want to do is always Bernard. We know, you know, in the middle of the canvas. We don't need to do anything else. We just need to code it now because it's connected to our virtual computer through this virtual USB, right? So just go to Cove. You switch from blocks to text and all we're gonna do is we're gonna give it of all the code in the loop on in the set up. We're going to say serial dot Begin 9600 Now, this is our speed, Remember? Back in putty, it says, What's the speed by here? Right. We both clients need to be aware what the speed is or will not work properly. It will not work correctly. So by putting 9600 speed here on 9006 years speed here they are in sync now in our loop I just wanted to go serial dot Print Ln for print line. Hello, World explanation Mark. Now, just press start simulation and we're gonna press the serum monitor and you see a bunch of hello world coming out. You see that? Now, if this was a really device, your cereal monitor would be putty well in in this example. So you would select your communications port. It might become seven. For example, Come to come one anything, you press open and then you'll see a certain similar interface to the one we see in our simulator. Here, you'll be able to send messages on dsi them out, put it. If any of you ever used Telnet before, then you know exactly the type of interface you'll see here. It'll just be every keystroke you type, What will get sent to the Arduino? Okay. Okay. So yeah, that vast Basie, how? Use the serial monitor. Now, let's let's do something a little clever. Let's make it so if we receive a command from our computer to blink, then will blink. So just cloak close the cove. You were gonna set up a simple circuit again. Just a simple led, okay. And Ah, we'll work with that. So have a resistor here. Now we're going to change its its value to 250 arms. So just change from killer on the arm. Just change 2 to 50 and we're gonna get our five up. It's going to go into our plus terminal here, and we're gonna get our ground. It's gonna go there, just change the colors. So it's a little more clear. And now we're gonna get out led. And that the the an ode goes, Where are resistor is it can also go on the cathode. To be honest, doesn't really make a difference, But we're just gonna put it here and from pin 30 Now, over here, we're gonna click from a data pin 13 here, and we're just gonna click here. Okay, So what will happen now is data. I'll change that to a nisi color. Few guys orange or even yellow. Let's go for yellow, says clearer. So will happen is the current will go from pin 13 down here throughout led and then back to ground causing are led to light. So now from here the cathode, Then let's just make a wire to ground they're changed out to black. Okay, Nice. And now, if you go if you press start simulation, you'll see the aid doesn't flash because there's no current going up in 13. So let's just switch to the Arduino is Cove you again? And we're just going to say pin mode in the set up, By the way, pin mode, 13 outputs. Okay, so now that you've said that output pin in the loop was just gonna say digital right, 13 high, this is just a test. We did everything right on. We can see the led is lit, so that battle works fine. So what we're gonna now do is we're gonna We're gonna make it. So we read a command from the Arduino, And if the command is to blink, then will blink the led. So what we do, then let's create a new function called Blink. Okay, Andi, in our blink function, we're gonna do a digital right pin 30. So he said the high on we're gonna delay for one second, and then we're gonna digital right pin footing low, and then we're gonna delay for one second. Now, this might be a bit of a slow blink. You might want to do 500 milliseconds, which will be a faster blink half second, basically. Okay. And now in here, we're gonna do a for loop, and we're gonna We're gonna blink it on and off five times. Okay? Yes, a close your for loop by there. And now what I want to do is I wanted to just call blink in our loop, and we'll just see if it works. Press start simulation. We can see that it now blinks. See? See that on our farm? Off on. Off on off. So that's all good. Okay, great. So now let's read a command from our computer that says, Shall we blink or not? And and if we get the command, blink will call our blank function just like we've called it here. So Garrett of serial dot Print Lime. Hello, world. And we're just going to say if serial dot reid string equals blink equals equals blank, I should say. Then we will call our blink function. So if we now press, that starts simulation now and we go to our serial monitor, so just type blink, and then press send and we can now see our led has started blinking. I know they appeared to be a delay then. That's because the simulation time is not in real time. So, yeah, we can see that that blinked. And now it's stopped thinking. Have we know type? Blink again? Presenter. It'll probably be instantaneous for you guys, but yeah, you can see that it now blinks again. So we're receiving commands from our computer to affect the actual circuit. Because the Arduino receives the blink command it calls its blank function. Which digital rights high, low, high, low, high, low, high, low. Five times. So that's pretty cool, right? So I know this is a simulator, but in real life you would connect through the serial port here, and then you were tight blink. You press enter and then you're really and then you'll realize we know would stop blinking pin 13. So if I go to my Arduino reference here, you know you can see the serial interface here. It tells you everything it can do. It can check if there's available data in in the in the stream. Ah, it can flush the stream. It composite floats introduced peek into the stream, re bites reach strings on the reason I'm showing you this documentation because I want I want you to realize that you can learn so much by these references. So if you if you ever unsure about anything, look into the reference or drop me a message, that's completely fine. I'll help you out even if it's not in the course our happily help you out. No problem. Ah, so, yeah, the congratulations. You've learned how to do seo communication in Arduino, which is fantastic because you could write little programs in maybe python or C Ah, the actually talk with the comport right on talk with your Arduino. So I don't know if you know c sharp or see or something like that. You could make a graphical user interface with a button that says Blink. And there you could click the button and it would actually make your your real circuit led Blink as pretty cool, right? Um, so, yeah, it is using the old technology of Rs 23 to see a communication and oversee. You know, that is old fashioned, but still, this all about learning USB protocols far, far more difficult, but you'll notice you don't plug in those giant, bulky wires into ports like this on. Instead, you have just wsb, right? You just plug it in. Like I said, That's because the Arduino downloads a driver which can interface between the two. So that's how you can still talk with the legacy protocol. But anyway, yeah, I hope you enjoyed this lecture on take care. 14. Potentiometers: Hello and welcome in this lecture, we're going to discuss all about potentially. Ah, mater's. So before I explain where a potential mother is, it's better. I just show you. I just wanted to add a bread board to your canvas on Tinga. Cad Here on scroll up in. You'll see a potential murder. Also, Just add that into the board as well. Now I just went oppressed South simulation. I turned this style. What does I remind you off your car? Radio? Well, then you would be right. This is a potentially ometer on essentially what potential murders are there? Variable resistors. So what this means is the potential Amit is a resistor on. When you move this style, its value changes its resistance value changes. So you know, if this was a one killer on resistor, you know you could adjust it from zero resistance to one killer on resistance on these. If this is fantastic because it means you can control brightness of l E ds, it means you can control the value, go into an analog pin on an Arduino which will discuss more later on. So yes, Let's begin. We're going to check. We're gonna make it so we can change the brightness of an led. That should be pretty fun. So now you go potentially ometer in the circuit. We're gonna hook it up correctly. So I just wanted to make a wire stopped simulation first. So you won't be Adjust this when you make a wire from here. Terminal one to your positive terminal here, and we're gonna do the same with the negative. So I wipe it here. The current will go from here to our led, which we're about to ride now. Eso that's added led into our circuit Onda. We are going to add a three and 60 on resistor here to the positive terminal of the led. We're just gonna change this from killer on arm change that to 3 60 Remember is represented by these symbols KK on here. And this is on right, So, um yeah, OK, great. So now what we're gonna do is from our wiper. We're gonna make a wire from here to our resistor, and then finally from our cathode on our led, we're going to make a wire from here. So the negative terminal on the bread bod. Now, if we finally add a nine volt battery here on we put the positive terminal to positive on the bread board Change code red and we do this thing for our negative terminal. And if you now start the simulation, you can see the led is really dimmed. Turn the dial and it gets further dimmed. But if you turn it all the way to the left is at its brightest. Now you can see are potentially ometer has a bit too much resistance. So let's change the resistance value so there's a bit more realistic. So we're gonna change our resistance from 250 killer arm toe one killer on. I just pressed start simulation analyses. That is brightest. If you move this, it's slowly dims until you get to the other end turning back to the left and now it gets brighter again. Turn it back to the right. Slow lead dims. Okay. Now, if you wanted to be making even more, um, sensitive, then you could change it from from one killer on to 500 arms. We try that now put it all the way to the left. One sees brag about it to the table to the right get slowly dimmed until at the very end, and it's not even let anymore, so you can adjust these values to make it more realistic. Um, how you wanted to be. So if you want this when it's all the way left, be the brightest and then in the middle and it's like half let, then you you can adjust the values of the resistor that the potential ometer resistor to do that, or if this is really circuit than you would obviously have to make sure you buy the right one. That by the right potential ometer that has the correct resistance you're looking for. But you have ask potential mothers, guys and thes things are fantastic because we can basically pass the cone from our wiper here toe to an analog pin on the Arduino, which I'll show you guys soon on. Then we can read a value on Do something, depending on the value we received, right, so it's just very, very powerful. So just to go over how these air working them, um, this resist ah changes value, depending on where this dialogue is actually pointing at, so that that's exactly how it's working so matter of fact, we get a multimedia If I put a multimedia here now so I can show you a little better. And I'm gonna attach the positive here. I test the negative here. We're gonna start simulation. We can see. Currently it is 8.93 volts in here turned the dial. Now it's five volts. Keep turning. It now is two. Now it's one you see, Notice how the values changing the same for the current, you see. So that's how it works. It's just a resistor that changes value. That's that's all that is going on here. It changes value depending where you moved this style on. When it changes value, it slows the current based on what this value is. So this is all the way to the left. Fast way I led is the brightest. We put it to the middle. The vaults commander here becomes 3.82 volts, which is why I led is more dim because it goes through this resistance, slows it down even more. And then, you know, that's why the energy sodium we put it all the way to the right. Here we can see is barely lit now. Why? Because 1.44 volts is coming out of our wiper here. So I hope that explains what potential models are there simply variable resistors. 15. Arduino Analog Reading And Writing: hello and welcome. And in this lecture, I'm going to show you how to work with analog in our tweener. Okay, so the very first thing I wanted to do is get a bread board, place it on your canvas on also get an Arduino and place it on your canvas. Great. Now let's go to the code section, and we're gonna change from blocks to text. Okay, So first things first. Let's take a look at these analog pins. The's a pins are analog, right? So a a five a four a three a two a one a zero. It allows us to read data being passed to us. So let's take a look at how that works. We're gonna receive a value from a zero onda output that value on the serial monitor. So the first thing I want us to do is just get rid of everything in the loop here on Dhere . We're going to say, Give it, give it to this as well. And here on the set up, we're going to say pin mode, a zero in putt, okay. And now on our loop, all I want you to do it's say analog. Read a zero on this value is gonna be starting inches to just say V intravenous was analog . Read a zero. If we take a look at the art win a reference of analog read. It says that it returns a reading from 0 to 1023 or from 0 to 4095 depending on the resolution of analog to digital converter. So, essentially, when the current comes in, the Arduino will decide on a value to give to you to represent the reading of the current to represent the curtain current that is coming into that pin. So that's basically what that means. Essentially, these digital converters, they have a resolution essentially, and they can either be from 0 to 1023 or 0 to 4095. Now, if we go back to our circuit on what we're gonna do is we're gonna turn on cereal minder serial begin 9600. Okay. And now we're just gonna say in here, Sirio, our print Ellen on. We're just gonna pass him V and just press start simulation. Got a serial monitor. We can see a bunch of values being shown to us Why is that? Because Pin a zero is not connected to anything. So it's picking up electromagnetic interference while I was simulating it a magnetic interference. But in real life, it would be picking up magnetic interference. So what, you need to do them? Let's ground the A zero just for a second, so you can see we're gonna make our wire from a zero to ground on. We're just gonna start simulation. And now you see a bunch of Sears. I put it gender sent. Ah, Now we're gonna make a wire from a zero. We're gonna give you this wife first, and then we're gonna make a wife from a 0 to 5 volts, and then we will start simulation. Now you see 1023. So you know, 1023 is the maximum value for our resolution on the Arduino. No. Here on pen a zero. So never I've explained that. Let's make this a little bit more interesting. Let's delete this wire. Onda. We are going to get a potential murder again, and we're gonna put it on our circuit. We're going to just make a why. Wire from five volts here to the plus terminal of our bread bod, and we're gonna do the same for ground. Okay, now potentially ometer. Let's hook it up. Terminal one to the positive terminal two to the negative. And we're gonna put the wiper to a zero a zero pin and we're just gonna change the color Teoh Yellow. So it's nice and bright clear. Okay, if we know press start simulation, go back to our co view on our serial murder. You can see the outputs currently 1023 turn the dial. And now look at 389 Keep turning it 184 Now it's zero. Send it all the way back so you can see the potential ometer because it's a variable resistor. It's limiting the current, causing the Arduino to give us a different value each time we read our analog pin, so that's pretty cool. So why don't we do something clever now? Why don't we get four? Led is here, and depending how far along the value is will determine which led is a let that could be from best to that. Okay, so let's start by adding led is to our circuit. So we're gonna add one led here. Gonna add another led here and, you know, change the colors If you want that, you know that that's all fine. I think we'll go for red, Orange on and green. So I sat another led here on I think I think I want 1/4 led as well and will change that one to blue. Okay, cool. So I know. I know. There's a slight misalignment there. Let's just put out there call. All right, so we're gonna add add some resistance here. So before we can do that, we're gonna have to put these. Led is one step backwards. My, my bad. Just moving one step backward. So we have enough space to place a resistor. So we're gonna place to resist here, too. Negative. So from the cathode, we're gonna have a resisted going into the negative, because remember, I told you before, it doesn't matter if the resisters on on the on the an odor or the cathode. Right? So we're gonna put it on the cathode here. We're going to change the resistance of are resistant to 50 home on. We're gonna press control, see on control V. Just so we can copy and paste that. And then we're just gonna go control V Control V. There we go. So the next step, then, is Teoh Hook up the an odes to the digital pins. So we're gonna just move this. I'll bring it down a bit. Andi, we're gonna move. What? We're gonna actually create some wise years. So? So, from our red led here, we're going to go from the an ode Straight to Digital Seven. And again from A from an ode here. We're gonna go straight to digital six from our own out here straight to digital fight. So we just took in these led Zep started. So pins from the an order The blue here straight to digital fall. Okay, cool. So we go back to the cove, you Now we need to set up the actual pins, so we're going to go pin mode seven. It was output on what was the other pin again? 765 on four. Okay, so we're gonna go pin mode six because I put pin mode five because output pin modes for equals output. Andi Now, if we did still right in here, it is to write seven high. It's still right. Six high. And I'm just doing this to check to check that all the pins are lying correctly. It's best to test this stuff first so that you don't run into problems later on. So we're going to start the simulation on upon starting simulation. We can actually see they don't like, which is why you test things first. Why don't they like? Because I forgot to connect the ground. So just connect the ground here. So the bread board change color the black. Have we run that again? We can see they all light up fine. So that is that is all good. So just just just to remind you, connect the wire from ground toe this ground terminal because the positive and negative terminals on the top of the bread board here do not link with the ones at the bottom by here. Okay. Suppress Start simulation again. We're basically gonna do is depending where you turn. This potential ometer will determine which led is a led. So this all the way to the right there will be led. It's halfway. Only half will be let on. So that is what we're gonna do here. Okay, So what's next to do then, is to figure out what 1023 divided by four is. So we just get up our calculator. 1023 divided by four is 256 weaken, rounded up 256. Okay, so now that we now have the value of 2 56 we can now check for offsets and light Certain ladies, if these offsets are present now, we just start the simulation again. We can see 1023 when it's in this position, all the way to the left. When it's all the way to the right, we get a zero that's important to note. So let's start. Then we're gonna go into code, and we're going to say if 1023 minus V is above or equal one, this is for our first led then digital rights. Seven high. Now this codes a bit a bit bad. I've done this on purpose because I don't know the experience levels you you guys haven't seen yet, so I can show you this way, and then we're gonna tidy it up. So we're going to say digital right here. Seven low. So we have an if statement here that checks if 1023 minus our value is above or equal one. If it is, then we set led. Seven are red led to high. Otherwise we set it too low. And let's start the simulation. We can see that the led When it's here, it's It's off. If we if we move it even this slight spit up the red led comes on. Okay, Excellent. So now back to tidying this up. We can convert this into one line. This is what it should look like. Digital, right? Seven for pin 7 1023 minus fee above or equal one. And now you can get rid of all of that if statement. So what this says is, um if 1023 minus fee, that's the first thing we do. So let's pretend V is ah on of 500. So we do. 1023 minus 500. Okay. And then we have 5 to 3. Is that value above Rico One? Yes, it is. So a true is replaced here. Now. If it isn't, then a false is replaced here. Now, I might be clear for you to put in extra expression around there just to keep it clean up, but yeah, that that's how you can do without an if statement is much cleanup, you would go a step further and used used some sort of definition or Denham here for these literal numbers, but we're not going to do that. Okay? So, back to our equation. If we did 1023 divided by four because we have four ladies, we get 255 rounded to 256 So So, yeah, we can't when are ready to do the next bed. So what we can say here is digital, right? Six pin sex, which is the yellow orange jelly deep. We're gonna go 1023 minus V on. Why do we do 1023 minus feet? Because 1023 is all the way to the left by here, right? If if all the way to the left was zero then we had started zero. But because of the way we've placed the potential, ometer 1023 is all the way to the left, which is why we have two minus it from our value, right? Subtracted from my value. No. Anyway, so here. Then we say 1023 above or equal to 56 Because remember we Ah, we rounded it up. Right? So we're gonna work from 256 Phanom Eso if you know, start simulation. I want you to move your 10 Chlamydia. Keep going on now. You can see the yellows lit up. Notice how, after we've gone 1/4 of the way the yellow lights up as a reason for that. Okay, so Ah, let's now do another digital, right? It's still right. Five on. We're going to say 256 plus two five sex. Just fight 12. 1023 minus V above or equal 5 12 And now, if you know, press start simulation, we can see we go 1/4 of the way Yellows on after half way the green zone. Onda. If we now do another one here digital right, four and we're going to say 5 12 plus 2 +56 We got +768 So just for 768 there. And how great we can see when it's 3/4 of the way. They're all that half way than the blue goes off. And so on. Now notice. How are red comes on. One is above zero. Why don't we change it then? So when it's 1/4 of the way the red comes on, so yeah, that that's not too bad to do. All we do is this becomes 256 This becomes 5 12 This becomes 768 and now we have to recalculate the final value. So 768 plus 2 +56 is 1024. So obviously we have to for 1023 here, guys. Because if you remember, I rounded up earlier. Well, now let's just round it down again because we only have 1023 possible values. Um, from analog reading, You know, first start simulation can now see the when we move this up, the led is don't come on. When we pass 1/4 of the way we can see that it's still doesn't come on Now. The reason for this is because our potential mothers resistance value is not 1020 feet, which is the problem. So if we change this toe arms, the resistance value. We put 1023 in here and now we start simulation. We can see that as soon as we go over the quarter Mark, The red led comes on. Go over the half mark The yellow led go over the 3/4 mark, the green led Finally at the bottom, the blue led. Okay, so you can see that it's not completely accurate. If you want to make this more accurate, What we can do is we can say Ah, in our printer print l and V By here we can say 1023 minus V. That's where we can say. And now if we know press start simulation and we move up 10 Shaman is the bottom. We'll see zero because it's kind of flipped it around Islamic sense, because 1020 threes of the start all the way to the left here. So, by doing 1023 miners fee, it kind of flips it right. So if we move this up to 1/4 of the way, we get 1064 So you know, you could manually change this value here toe 1064. As a matter of fact, let's get up a no pad. I will make some notes for ourselves. So 1064 Okay. And then if you did it this way, by the way, it doesn't matter which which potential murder resistance you have, then because we can always read the analog readings on, see what they are. Quarter of the way and so on. Okay, so if we now put that into the middle, we get 512. So the middle ones, right? If we now go to the right, we get 839. Okay? And now if we now go all the way to the bottom, we get 1023. Okay, So these are the values. We need them for a more realistic approach for our 1023 on potential murder resistance. So it will be different for you if you didn't change the resistance. So what we're gonna say here, then we're gonna say 164 Ah, 5 12 Which we've done 839 on 1023. We know stopped simulation. It should be much more accurate. Now. We move that all the way. The left we can see. No led is on moving a quart The way red led comes on halfway yellow led 3/4. Green led 4/4. Then all the ladies. So that's how it works, guys. That's how the analog reading works. So it's pretty need, right? You can see we can play around with this moving around and it's like a little disco. It's pretty cool. Not bad at all. You do all sorts of clever stuff with this. Like if the last led has to come on the first a d goes off, you can You can make it really interesting project out of this. OK, so we take a look of these analog pins again, you can see the represented by a at the beginning. You can't use analog reading without digital pins. It doesn't work. You can, however, digital right with our digital pins. So let me show you what I mean. We're going to get rid of our analog reads here, and we're going to get rid of our digital rights here because I just want to show you this right. Make it feel free to clone the project. if you didn't want to lose all of that, you can press control Z to get that back as well if you just deleted it. All right, So we're just gonna go analog, right? Okay. And we're gonna pass in pin seven, which is a red led on. We're just gonna put 5 12 in here, Okay? If we now stop simulation, you can see the led is let now change this to 10. Stop simulation. You can see you can't even see the led Let anymore. You can't even see it let anymore because our analog value is so low. If you do 1023 it will be at its brightest. See now less control z again just to bring back our analog read on. We're going to give it a did these digital rights again. And at this time, we're gonna say analog, right? Seven, which is the red led? We're just gonna pass him V and I just start simulation, and you can see the ladies off. That's because remember, all the way to the right zero. We haven't done our 1023 minus feet, so if you just turn this half way to the left. You'll see that it's now sort of on turn it a little bit to the right again and see it goes , it dims again. To Noel, the way to the left now is for power. So you know, that's how you work with analog in Arduino. They're fantastic. You can do all sorts of amazing stuff with Arduino circuits Wouldn't be the same without the baby toe analog Riedel. Right? Eso It's a fantastic feature of the Arduino Eso Yeah, hope. Hopefully that tutorial made sense. Any questions, please let me know. 16. Basics Of Inductors: hello and welcome. And in this lecture you're going to learn about induct er's. So what are induct Er's in? Doctors are metal coils. They look like this. They store energy in magnetic fields when electric current flows through them. They also resist changes in current. So in doctors look like this in real life, all they essentially are is wire wrapped into a coil. To our right, we have a schematic. This is a symbol off on induct herb. I hear thes swirls. They can also be represented like this, and also with just three terms. So in doctors store energy in the form of magnetic fields, they are coils. They store energy while resisting changes in current, which I'll explain more in a moment they are valued in Henry's, the more inducted since the more energy conductors construe or and the longer it takes to build the magnetic field. So what I mean by that is the higher the Henry value to represent the inducting sof, the induct er, the more energy that inducted in store on, the longer it takes for it to build its magnetic field. Basically so much like you have different resistor values, you have different Henry values which represent in doctors. So now let me show you this in Dr Simulation. So before we continue, this is our battery. Our power source. We have a one killer arm resistor here on a one Henry in Doctor, we haven't led on a 240 almond resistor for that led as well. So I want killer on resistor Here is so when there's no power going to the circuit the led congee let from our induct er it can receive power from our inducted, right? If we did know resistor here, then as soon as we close the switch here to power it with the battery, the current goes straight the ground because there would be very little resistance if there was just a wire without a resistance. Okay, so let's start the simulation so you can see what happens. So right before I go any further, we've just closed the switch. So current is now flowing from my battery. It is going through. Our in Dr Empowering are led. Now there's five volts in this battery. Right on. Look how very dim the led is. This is because the induct is resisting the current, but it commonly resisted so much. Look what's happened. The led is now fully bright. Let's try that again. So we'll restart the simulation. We put that down. Look how dim it is, right? We continue the simulation. We can see the current speeds up and up and up as the inducted just can't hold it any longer. Right? And then the led comes on brighter and brighter. So that is what I mean when I say that they resist current. They are building their magnetic fields. While they do this. Andi eventually will be able to power the led from the energy stored. Notice how have switched off the switch. Cutting the power from the battery. But the A d still, um, induct is essentially store energy. Let's see this one small we turn the sweat. Shaun powering the battery. The led is now fully lit on. We're now gonna open this switch cut in the power from the battery so the led can only be powered by this in Doctor, Let's now resume. We can see the eighties now powered by the induct er, the 80 slowly dims as the inducted loses energy 17. Arduino Whack A Mole Game: Hello and welcome. It is finally time to take those skills you have learned throughout this course and create some sort of gain by creating an Arduino game. Really test your ability on it Tests what you have gained from this course. So the first thing I want us to do rather than grabbing Arduino in a bread board, we're going to search for L C D. And you'll see this starter kit down here. Just click it, Andi, place it anywhere you like. Now we kind of cheated here because we already know how to interface with an LCD screen. It doesn't make sense for us to do all that circuitry again, right? So I just such LCD place it there. If you are making the circuit in real life, pause the video, see how everything's connected or rewatch the LCD tutorial. Okay, so once you've got to start Kit, just press start simulation and we should see hello world out. Put it on. Ah, that is that is completely fine. There's no no issue at all. Okay, so let's change the circuit a little bit before we do anything else. For starters, less. Let's ground V zero. So just delete this purple wire and we're gonna ground it. Just change that to Black. And I just run the simulation again. Make sure it all works and it works. Fine. Let's also delete this potentially ometer. And the reason we're doing this is just a simple fire circuit. A bit, right? So it's a little more simple. We don't need the evade, adjust brightness and stuff like that. Um, okay, so once you've done that, we can start making our games. So what are we making? We're gonna make wack a mole. Now, in case you didn't know what wacka more waas it is an old classical game where you have is a real life game. You have a bat and you have to hit the rabbits as they pop out of the hole. Or it could be something else. Doesn't have three rabbits. You get the idea right? You only get points if you hit the rabbit when it pops out. If it pops back down, you hit it and you miss you don't get any points. That's how the game works. I've just got Google images up. So if we look at this guy No, It's how he has the bat and he's hitting the moles. That is the game. Basically, Um Okay, so now that you're aware that we can start making this thing, So firstly, let's see how many Arduino pins we have left. We have one, 2345678 9 10 11 12 thing for we have plenty. Absolute plenty. That's no problem at all. Okay, so just to keep the circuitry a little simple, we're not gonna work on this bread board, because this was for the L C. This is for the LCD, right? So what we're gonna do is we're gonna just drag it up just to get it out of the way, and we're gonna drag out LCD screen up a swell. We can even place it over this. So it's less confusing for you if you wish. Just start simulation to make sure it still works. It does. That's no problem. Okay, so we're gonna need another bread board, um, on this is gonna have our actual whack a mole game on. So we're now going to rotate are rare board. Just so it looks like that. Okay, on just move are doing the down a bit because we're gonna use it in a second. Just move closer to our second bread board. And now we're gonna add a push button to the bottom of the circuit by here, and you'll notice that terminal one B and terminal to be are connected. We do not want this. We need to rotate this button. Please re watch the button video if you're confused because everything's explained in there . Now we see Terminal one A connected now, and Terminal one be connected. That is completely fine. OK, so what we're gonna do now is we're gonna make a line from our power. So this side of the button on, we're gonna change the color to red. Okay, We're now going to make a line from some of the one be here to pin six on the Arduino, and we should probably make that line a little cleaner as well. All the way to pin six. And we're gonna change the color to Brown. We're going to use a brown to represent all of these buttons just to keep things simple. Okay, so the next step is to go to co view Onda. We're just going to go in our set up and we're going to say pin modes 13 outputs, pin modes, six input. Have you remember Pin 13 is attached to this little Eddie D on the Arduino board. So even though pin fitting isn't connected to anything if we cause it to flash Ah, are we saying current into pin Fuding while it's an output pin will see the little led on this board. Come on. Okay, so that's all fine. Before we continue any further, I want us to make a wire from five volts here on the Arduino to the positive terminal on our bread board. Just change the color red. Excellent. So what I want us to do now is I want us together to the code in the loop on. We're just going to say just all right. 13 did still read six. And if we just press start simulation, we can see our led light is on now. This was just a quick test to refresh your memory. If you remember correctly, without a pull down resistor or pull up resistor in this circuit with our button, the electromagnetic interference will cause the wire toe. Have some current flowing through it. Sometimes you know things like your telephone. You know, things like your mobile phone, the electromagnetic ways they can be picked up by the circuit. Right? So you can solve this problem by using a resistor as shown in the button video. However, I haven't used one here on purpose because I wanted to show you something else that are doing now has. So before I continue, you know how in our button tutorial we had a tank along resistor going to ground from our button toe to prevent that electromagnetic interference. While that was called a pull down resistor because it was pulling to ground or a negative terminal. Now pullup resistor is where you pull to our positive terminal. That's what the differences now, the reason I haven't done any resistor here. It's because Arduino has pullup resistors built into its circuitry. So we got about co view on see pin mode six input. Just change it to pin mode six input under scroll pull up Now that will configure this pin to use its pullup resistor. So what we can now do is if we just close the cove, you a second and we make a wire from ground here to our ground on our bread board. Change color the black. And now you see, you see how we can never wire going from our positive terminal to the button just to lead it. And we're gonna make a wire from our negative terminal to the button instead, and we'll change the collector black. Now, if you press start simulation, you can see the buttons on Now push the button. And now the led goes off. Let go the button again. Now the led zone. Push the button. Now the led is off. So that is how the pullup resistor works, Right? We provide a ground to a button or the negative terminal rather than the positive terminal . So obviously what this now means is is if we want to like the led When the button is pressed, we need to check that slow instead. So we can just use a explanation mark here to flip from true to false or hide alot. And in that work, fine. If we press start simulation now, press the button. See, the 80 now comes on on the board by here like let go the button 80 goes off Okay, so that's easier to understand. You also have to remember that simulation doesn't necessarily run in real time. Which is why there appears to be some lag. Okay, so now you understand the pullup resistors. We can actually start making this a bit more interesting. So I actually going to make an led on this circuit now, on when the eighties on, you're supposed to press the button. If you don't press the button, you lose. So let's grabbing a d, and we're just gonna place it on our circuit, and we're gonna need to rotate it. Because, remember, we've rotate the bread boards, so this means this entire lines electrified. So we're just gonna have to rotate it just a little bit like that and just put it like like this. Okay, so when that 80 goes on, we need to press this button. That's the whack A mole game. Celeste creative resists Ah, from our cathode, and we're gonna rotate it so that it goes to ground. And what's gonna have to move our led just to the right a bit There. Just keep it a bit cleaner. We're gonna change the resistance value to 250 on. That should be fine. Okay, Excellence, What we now need to do is we need to hook up the led to our do we know, and we're gonna use the analog pins just to keep this as simple as possible. So we're gonna use analog zero. Why? So why Why does this make it simple? A. Because it's all on the same line. Look, So it's just easier to to understand. And we're also gonna change the color here to, um, talkies Or actually, a better color might be purple. So I added, these will use purple wise. I know we have a purple wire there, but we can exclude that one. Okay, cool. So what we now need to do then is we need to like this led, and then we delay and then check if they press this button. That is essentially what we do here. Okay, so let's go back to the cove. You on our pin modes 13 output. We no longer need that, cause I've demonstrated this example now so you can delete that, Andi. Instead, we're going to say pin mode a zero output. Okay. On in our loop where we do this to write 13. It is to read six. We no longer need that either. So we can delete that too. Okay, so the very first thing we need to do is we need to set up there be to generate random numbers in our circuit because it'll be a bit rubbish. If if if it was very predictable, what was gonna happen in the game, right? So when are set up function, just say random seed, and we're just gonna say analog, read a five. Now, just press start simulation to make sure that compiles that compose. Fine. So firstly, we need to generate random numbers, as I've already said. And when generating random numbers, you use a seed that you passed a random number generator. This could be the system time. It could be anything, right? Andi, The most important thing is is the seed is unique. Otherwise you get very predictable random numbers. So what we do here? We say random seed analog read a five on because a five isn't connected to anything. It's getting a lot of electromagnetic interference and noise. So it works really great for a ah seed for a random number generator Okay, so this obviously means we can't use the A five pin, Otherwise, it will no longer be getting noise and no longer be random. Right? Eso Let's just stop serial murder just for a moment at 9600 bits because we want to just see if our random number generator works. So just in our loop were going to say cereal star print. Ellen. I mean, you can just watch watch what I'm doing, but it's just you follow because best to make sure that everything's correct before we do anything else, right? So serial dot print Ln and we're going to say random and we're gonna just do 100. So I should generate a number from 0 to 100 just for starts simulation, and we should see a bunch of random numbers coming out like I see here. If you see this, then Ah, that is great. You've done this successfully and we can continue. If you see the same number coming out all the time, then you need Teoh, take another. Look at what you've done here. Make sure a five is not connected. Okay, Great. We no longer need the serial model for this time being. So I'm just gonna delete the serial begin and the serial print line just to keep the code of it clean. Okay, Now, before we get too complicated, I'm just going to write some simple code. I want you to follow along, so you get the idea, and then we'll clean the code up a little bit. So is a bit more cleaner. So the very first thing we're gonna do is we're gonna just light our led. So we're gonna say digital rights and we're going to say a zero high. And now we're just going to delay for two seconds and we're gonna turn off our led again on then we are going to do an if statement and we're gonna read from our button the button that should be pressed, by the way. And we're going to say if digital read six equals low, you can also just used the explanation mark to flip from high to low. That works, too. I didn't do this to keep it simple. If you will. Then this was successful, right? So then if it's successful, then we we obviously updated score or something like that. But What? We haven't got to that stage yet. If that button was pressed down whilst the led stops lighting, then then it was obviously correct that they worked the correct mold. Right? So in here, we can just say LCD. It's our print. Ellen, you hit the mole else LCD. Our print. Alan, you failed, right? Obviously, this is very simple. Will be cleaning this up, making it better. Making more efficient. But I just wanted to get the rough idea of how this is working on. We also want to just clear the display by here as well. LCD Dark, clear. Okay. Lets no press start simulation. We see the led. Come on. We don't press the button. So it says I failed. Let's just restart that per start stimulation again. We hold the button now and it says you hit the mold. That's the rough idea. However, please bear in mind that when I initially made this circuit, there was a bug in Tinker Cad, which meant this led didn't come on. Now to fix this, just move the 80 around and then move it back again. If you encounter a similar issue as I did, this is Ah, software error in Tinker Cod. Okay, so let's try that again. We press start simulation, we're gonna hold the button. And then I said, You hit the mold. Let go on now. It says you failed. So all appears to be fine. It would be nice to have a bit of a scoreboard as well. I know the led never appears to turn off. This is to be expected because it's the only led on the circuit. When this is done, it will randomize between them if that makes sense and it will pick the correct one to use . Okay, so there is one thing that you might not have noticed here. It says you failed. And you see these two squares? They don't look too good. What is that? That is our carriage return a new lying? Because I used print lm Let's just use print instead. Um, and then that will go away. So we just use print. That should be absolutely fine. Now press start simulation. I'm wait. Now it says you failed call. Excellent. Let's continue. Okay. So before we go any further, it's time to clean up the circuit because we want to make this a sufficient as possible. So first we're going to create a structure. OK, so we're just going to say struck mole, okay? And all the structure isn't see, it's just a place to store multiple variables of that makes sense. And we can think of Java in a class. Think of Java classes without methods. That's basically what a structure is right for you. For those from a Java background, this is C C plus plus, So we're gonna struck mole and on our mole is basically gonna have two pins. It's gonna have an led pin and a button pin. So we're just gonna go into in Georgia led pin in Georgia button pin, and that's all we're gonna need to do for that. Andi, we're now gonna have to define a molar. A soul we're gonna do is we're going to say Struck Mole and we're just gonna say, mole array. And then we're gonna open up on liberate brackets here and we're just gonna put one, and then we're gonna say equals I want to do a little curly braces and we're gonna do some curly braces again. And we're just going to say dot led pin equals acey Rowe. And then we're just gonna do it coming by here. And we're going to say dot But in pin equal six. And we got a semi colon by here just to keep it nice. And for Matic clean, we're gonna just put the new line by here. Right? So we see that. So I was saying, Here is we have a mole array that has one mole Andi led pin of that mole is a zero on the button pin of that Moelis six. Let's just press start simulation to make sure that compiles Fine. We can see that compose fine without problems. Okay, cool. Now, just above struck more, we're gonna say hashtag defying total moles one. And then we're gonna change our one here to total moles. So we create a molar A of the total moles, which is one. Okay, so just to clarify, this is an array. And here we initialize the structure in element zero of that a rake. That's why we do dot early, deep in to reference this variable dog button pin to reference this variable. I hope that makes sense. Let's now create a new function. It's going to return void on. It's just gonna be called use under scroll mole and it's gonna accept a pointer to a mole on all the Pointer is it just points to a variable. That's all it is. Think of Java objects if if you use Java if use Java, it's a little like that, not quite the same thing. But that's the best way I can describe it for someone who hasn't done see before. But it's not quite the same. Um, but don't worry, just follow along. And if you have any questions, ask me. So I use more function is basically going to do everything we didn't here. We're just gonna copy it and we're gonna paste it in here instead. This is just keep it clean, right? So did still write a zero. This is our early deep in. So rather than just to write a zero, we're gonna change this to ditch, to write mole really deep in Okay. And then we delay and then we turn the led off again. So we're going to say just the right mole led pin low, and then we clear our LCD screen on. Then we did to read the input pin the button pin. So in here, we're just going to say mole button pen history, mole, mole, button pin equals low. Okay, great. So in our loop, we're now going to generate a random number, and this will be the mold we choose to use. So we're gonna say intra jet are for a random equals random, And then we're gonna say total moles minus one. Now why? Minus one? Because where access and by index and remember, indexes always started zero. Right. So while this will do this will generate, this will generate a random number between zero and zero. Um, which makes sense because we'll always get zero. Right, because we only have one mold, so there's only one more to choose from. So that best correct. Now that will contain our index. Right? So when I'm going to say, struck mole, ask a risk for pointer, we're creating a point of right now. A mole equals and percent to get the address mole and a scroll array. Uh, so what this will do is generates a random number, and then we pull the address off the mole in our in our ray, okay? And that will give us a pointer on the point of just points to things right. So that will give us at the address in memory of the mold that we've chosen. OK, once we have the address of that mole, we can pass that address to the use more function which can then access that moulds memory . I hope that makes sense. OK, so the next step is simple. We go use under scroll mo and we just passed in the most simple Is that so you press start simulation on Just wait a few seconds now says you failed so you can see that it's turned on the correct led is done Everything right on now adding new moles is really simple because all we have to do is add to this array. If we want a new mole, we just add to this array. It's that simple. No more. No more complicated code. It is. It is now Ah, efficient, which is what matters. I know for you guys, you out from a C background these points is and a raise and stuff like this, it is going to confuse you. However, this is a electron ICS Arduino programming course are not a C program costs. So I hope that you understood this stuff, these pointers and a race. If you didn't, please drop me a message. And I'll be more than happy to help explain any issues that you are having. Simply put, all you need to remember is this An percent here gets the address of variables. The address of variables could be used to assign pointers values. Pointers can then point to memory as all you need to be aware off. So all this is saying is we want to access the mole with the index variable are That's what we're saying here. And then we call use more, which passes them all to it. Okay, so hopefully that makes sense. Okay, let's now create our second mole. So we're gonna close the cove. You here? We're going to put a button justice before, and you guys can copy and paste this, but I'm just gonna do it again just to keep things easy for you all. So there's our button there. We're gonna hook the button from ground, and we're gonna use this ground this time to the first button. The change card, black And then from here, we are going to make a wire all the way. It's a pin seven will go for pin seven this time changed color to brown to represent is a button pin on. Before I forget, we need to hook up the terminals here with the tunnels here. So from the positive here, just attach it this way so that they're connected and we're gonna do one from the negative as well so that they're connected and they'll share power then. Right? Okay. Nice express. Start simulation. City led. Still comes on. There's no circuitry problems there, so Fine. Okay, so we now hooked upon you. Buttons pin seven. We now need led for this button. So we're gonna press the led on. We're gonna rotate it. This timing irritated this way. Okay, Andi, we need to resist a here that goes to ground, and we're going to change the resistance value to 250 homes, just like the other one over here. And I finally we need to choose a very deep in. Remember, we said we're going to use a pins for this. So we're going to curate from Ah, a note here all the way to a one, and we just can change cars of purple. Okay, so we now have the circuitry for our second mole, but we need to add it in the programming. So if we got a code, we're gonna add a new one here. We're gonna go comma, open up. The curly's again dot led pin equals on our 80 pin is a one, and we're gonna say Doc button pin equals seven, and we're just gonna close, which can close it with another curly brace there. Okay, so we know press start simulation. And there was a compiler. What went wrong? Too many initialization. Our total malls is one we need to change it to. So just changed almost two to press start simulation on now. You should see them flick randomly between the two. So we see it says you failed on you'll notice. Unfortunately, only one of the ideas actually comes on. And the reason for this is because I made a mistake in the random call by here. It shouldn't be a minus one here because the random function it actually looks for a number between zero on the number you provided, not from zero to the number you provided, if that makes sense. So if we just give it to the minus one here for the total moles and we then start the simulation, you will see that both led is now appear to come on. They swapped between each other completely randomly now. One other thing I wanted to point out. You'll notice. It's saying we hit the mall even though we didn't press it. Why is that? It's because we haven't enabled the pin mode for that pin yet. And we haven't said it as a pull up like we like we're supposed to. So if we go pin modes seven input pull up. Okay. If you now press start simulation again, we can see that it now works. Just told me I failed because I didn't click it. So we hold that hold this one causes on. You hit the mo and it says you failed because it shows the same one again. So just press that And then this one's Come on, hold the hold. The button. It says you hit the mold and this one comes on. You hit the mole, right? It swaps randomly between them every two seconds. Now you might feel like there's a bit of a glitch, because it keeps saying you because, like, holds, you failed and then, like, the screen doesn't clear, so it is quite misleading. Confusing, Right. So what we'll do instead go to code our screen clear here. It shouldn't be here anymore. We're gonna put it at the rate top of the function. Okay, so then it'll clear it every time it comes back around. So then you don't see you failed from the previous failed attempt. If that makes sense on you know what? We'll do something a little better. Rather than just clearing, the screen will show a score or something. But we'll get to that right. So down here now, we also want to delay just another 1500 seconds or two seconds or whatever you have whatever you want it to be. We will change these values to make it a bit more fun later on. But we just want a bit of a delay so you can see the message, and then it will clear it right on. You know, you can also put the LCD clear at the bottom here. Just after the delay. You know you can do what you want, but we'll just clear at the top here. I think for now. So when the best start simulation, we can see that the screens cleared and now it says you failed and now it's gone and this is you failed, you see. So now there's now because it clears it. Now it's more clear what's going on. So it's swaps between these, right? It's now on this. Led. It says you fail because you didn't click the mall. It's back on this. Led says you fail because you didn't click. The mall is choosing this Ellie Dearlove right now. You see, you failed and it says you failed, right? You failed. That is basically what is happening now. And it is picking this one to the right. You didn't click it. You failed clicks that one again. You didn't click it. You failed. So it's like whack a mole now, right? So we press this button now, the next one that comes on there, This one Hold it. You hit the mold, click it again because it's pop back up. The same one can park pop up twice. Can it. This one's on. Hold the button. You hit the mall, so I hope you get the idea. You hit them. All right. Great. So it's starting to look more realistic. Works we didn't hit on time. You failed. So, obviously, rather than just clearing the screen, we're gonna clear the screen. Show a score that may expect more sense, right? If you want to be more more strategic about this, you can also add lives. If that's if that's really what you want to do. Okay, We're now going to actually create a scoring system. And if you really wanted to, you could make it so the same mold doesn't pop up. Um, if it gets randomly chosen again for the second time without picking someone else. But in my opinion, that just makes the game a little too easy, right? Anyway, back to the story. So what we need to do that we need to score system. So if we just scroll up and at the very top of our set up function here, just send in the molar A. We're going to say interest your total score. Okay, Now we're not set up. We can set that to zero. Ah, or Weaken said 20 here. It doesn't rid really matter. Although, to be honest, I think it's cleaner to set it here. So we're just gonna set it here, right? And we're gonna get rid off. This LCD LCD print makes you keep the Elsie begin. Okay, so that sets our total Scored a zero when we come on now, we clear the LCD display here. Okay? Now, what I want us to do is I want us to print LCD dot print on dhere. We're just going to simply say school colon plus string. Total score. Okay, so now that will print our total score every time that the else D gets cleared for the next situation. Now, this is so important that you want you when you do. Plus, here, you can't just do plus total score. You know that this is C and C plus Plus, it doesn't work like that, right? That will not work. And that will not go well for you. So best not to try that. What you need to do is undefined behaviour. Really. It'll it'll It'll it'll plus to the pointer on and your your text will be malformed. Don't try it. So what we do here? We do. Plus string. Total score and string. Here. This is a class. Okay. This is a class Onda. Um, the constructor in this string class wanted upset. Say Introgen. It'll converted to a string. OK, on the string Makes use of operator overloading for this to be possible. OK, so if we now press start simulation we've seen see score zero. Okay. And then it says you failed. Now notice how the text comes off the screen here. This isn't good. Is that we need to clear the LCD screen again. Just after here. Okay. And then that should solve that problem. If you start simulation now, you see school zero. You failed on that. Says score zero again. Okay, great. So what we now need to do is one you've hit the most successfully, we just increase our skull, So that's really simple. We just go total score, and we do plus equals one. And if you failed, I guess we could also deck Ament your score. Right. So if we start simulation now and C school zero. You failed school minus one. You failed, right? So you could have a minor score here. Punishes you for failing. So you you hit the mole and I was his school minus one. Hit the mall again. Now it says school zero, right? Hit the mall again. You hit the mole. Score one. Hit the mall again. Hit the mall score too. And it likes to pick the left one a lot, doesn't it? But this is the random number Generator, guys, it can. It can re picked the ice. Pick the one on the right. Hold that you hit the mall. Score five. So you get the idea, right? Let's add another two moles to the game. So they're add another two miles to the game will just do what we did before. We're going to add a push button. We're gonna rotate it. So that term to be and to a together and terminal one A and one beer together, we're gonna connect from ground. So the button by there and then from here to pin eight and this will be our button pin on. We're gonna change that the brown just to make it clear. Okay, great. Now we're gonna add a new led. We're going to rotate it. Gonna have a Tunisian 40 on resistor to ground change the value of the resistance to 200 not 240 arm. So I 250 arm Andi from a two pin. So the a node of the led We're gonna change that to purple to represent the led Pim on. There we go. That is our third more. We can now set that up, go back to co view, and just by here we're gonna create a new mo dourly deep in is equal to a two because I saw a deep in stop button pin equals pen eight. Okay. And we're gonna need to change. Told most 23 Close the cove. You start simulation, and we're just gonna wait just to make sure that led Eventually goes on. It is going on, you know the system, but it's gone on. It's quite a lot of current being thrown around this circuit, so you may want to reduce the resistor values have a brighter led, but that is completely up to you. The concept remains to say so we're gonna add a new push button, rotated. We're going to create a wire from here to ground change car the black. We're gonna create a another wire from here, all the way to Penn. Nine. We have changed the car, the brown. Now we're gonna add and led to the circuit. We're gonna rotate it. We're gonna have a 250 on resistor from here to ground. Change the resistance to 2050 arm. Now we're going to create a wire from here all the way to a three when I change it to purple. Okay, we're gonna go back to our co view. We're gonna add a new led. We're gonna add a new mold to our to our game. So we go led pin equals a three button pin, equals nine and feel free to format this a little better. And if we now start simulation, we see Santic. Sarah. Because too many initialize is I forgot to change totals to four. So do that start simulation. Now we can see that I did these arm We hold the button and he says I hit the mold school One value the zone. We hold the button. You hit the mole, Scott to its back on again. Hit it again. You hit the mold. Score three on this one's on now and there we go. I can see that one's own. That one is the brightest hit the mole. I now have a score. Seven. Right now, a score of eight on thistles It you've made your whack a mole game. So it's like the real thing apart from apart from you Don't hit it with a bat. You press the button, Andi, Instead of a mole popping out, you were just talking to Natalie. Date on Before I forget. We also need to set the pin modes to input pull ups. For those can't forget about that. That's so important. So we go pin a and put pull up on we go pin nine inputs pull up, and then that should make sure that that all works as expected. And it doesn't float. In other words, doesn't pick up electromagnetic waves. So, uh, yet we can see that this this game works perfectly fine, as expected. Um, so you guys asl like a little task yourself? You can ah, just this game. Maybe make it so it speeds up over time, see what you can do to improve this 18. Voltage Regulators: Hello and welcome. We're now going to discuss voltage regulators. So, firstly, what is a voltage regulator? While essentially they taken input Voltage, let's just say nine volts and they converted to a lower voltage such a Z five volts. And this is fantastic because if you were to put nine volts into a microcontroller, you would break the component, it would actually be damaged. So if you're dealing with higher voltages, then you can use voltage regulators to bring them down to a steady voltage, which are then mean that you can powers components such as microcontrollers safely. So you do have to be cautious with voltage regulators because they can't take a huge voltage. They have maximum voltage inputs that they can take. And if you exceed that, the newest damage in your circuit or worst case scenario, you risk danger to yourself and others. So voltage regulators, they look like this you have. This is a big one. That's a small one. They do the same thing. They accept an input, which will be your nine volts or 12 volts or whatever makes you chip specifications, always to make sure it can handle the input, voltage and then you know, if this is a five regulator, it would output a five volts on the output pin here. So obviously that's our grounds of that site that connects to our negative terminal input pin will connect to our nine or 12 volts or whatever, and then our output pin would have the steady five votes coming out of it. So this is what it looks like on the schematic. This is how you draw it on the schematic. I'm not going to show you a simulation of ah, voltage regulator on Tinga. Cad. So you can see we have a five volt regulator here where we're passing in a nine volt battery, and we're using a multimedia to see the value that comes out. So let's take a look. Let's play the simulation. Okay? So you can see that five volts comes out. So we start with nine. Vote. The regulator brings it down to a steady five faults. So that's faulted regulators. I hope you enjoyed this tutorial 19. Installing KiCad Schematic Software: hello and welcome. And in this lecture, we're going to install K iChat. Now, what is K iChat Que Icat is a fantastic tool that allows us to create schematics and then convert them to PCB so that they can be printed by companies on a circuit board. They then send us the circuit board on. We can then solder in all of the components if you take a look at your computers. Mother board, this was, ah, likely a PCB design that was printed by a company. The manufacturers would then solder in all of the components for that board in the next few lectures. While you're gonna learn is how to do this, you're gonna learn how to create schematics, convert them to PCB on, then have them printed out. So let's begin. Let's install K I cad. So we searched for K. I can't download and we'll use the 1st 1 here. Select your operating system. Mine is windows on. I'm going to use 64 bit. Save the file now. This is quite a large foul, so I'll come back to the video as soon as this is done. Okay, My downloads. Now done. I'm now going to run the installer Wednesday Installers run. You'll be prompted with this set up page. Simply press next. All of these should be selected. Press next, select your destination folder. I suggest keeping it at its default presses stole. After some time, the installer will be completed. Now that the set of is complete simply press finish. If we know navigate to K I cad, we can see Best match. Just run it. You have successfully installed K I, cad. 20. Creating KiCad Schematic And PCB: It's now time for you. Decorate your very first schematic. Now, before we continue, please remember that in a lot of the lectures I showed you the schematic symbols for what we were talking about. I did that purposefully. So you had a reference if you got confused. Okay, let's stop by creating a new project. Go to file new project. I'm going to create the project on my desktop, but I'm first going to create a new directory. I'll name it. Project. Simply press open on now type project and then save. We now have the start of our project. You'll notice two files Project R K iChat, PCB and Project SCH. We really want to focus on the dot sch fall. So double click that this is your schematic. You can see down here. We have some information. We can write some comments in case you wanted to print out the schematic any point in time . Okay, so what do we make? First, let's just make a very simple circuit that has an led in a battery. Seems simple enough. Go to the right hand corner and you will see this icon that says place symbol. Just click it once. Now click your schematic. You'll see. Will import loads a symbol? Libraries. It only has to do this one's. Now you'll see that it will ask you to choose a symbol in the filter type battery on. We will select the single cell press. OK, Now select anywhere on your schematic and just left Click. You should now be a deism into your schematic. Using the scroll wheel on your mouse. You can now see this battery cell. Let's attach something to it. A wire you can see here. This green wire is for placing wires. Click the green wire ones you can now left, like once in the battery and drag. This draws our wire. Now that you know how to draw the wire just right, click and press cancel. We're gonna need to assign a blueprint for this battery cell. Click your mouse icon the select the select item icon one small right click on the battery cell. Go to properties, Edit properties. Now all you need to currently worry about is the footprint. Collect the footprint. You'll see this library option. Just click the library option Now click battery at the top left by here Now, this is the type of battery holder were going toe want. So you know, you can see there's a lot to choose from, and it's important to choose the right one. Because when we come to print the circuit board, if you wants to contact a supplier, if they print out the wrong dimensions, you're gonna be in trouble. So just to elect the top one up here and go to view three D viewer So this is what that looks like. Okay, Now, obviously, when you convert it to a PCB and you know, you print circuit board, they're not gonna fiddle the components in for you. It will be printed with the holes that you see on the back, right? And then you would essentially solder this component onto the board when it arrives. So it's just important to state that right? So that's what I want. Looks like, have a look of the next one down. Three D viewer. Okay, so we can see that that one doesn't have a three d model to look at. Take a look at this one as well. Can see again. It's a nice place for you to solve something in. Let's take a look at this one. Okay, so you get the idea. Now, let's just stick with this one. The bulge in B X Z 036 and we're just gonna double click it. You'll see the footprint is now that and this is your first schematic tutorial. So we're not gonna go too in depth on it in this lecture. Just the basics. We not it, Adam led to the circuit. Click on the place symbol again. Left Click on the schematic search for led. And you will see this 1st 1 light admitting diet. This one will be absolutely fine. Just press OK, now we're gonna place it here. We're going to go to the move tool again, and then we're going to right click. We're gonna go toe orientation, rotate clockwise, and we're just gonna do that again. Because remember, this is a light, um, in in dia. And if you remember, this little shield here means that the positive current can come in this way. Okay, We're now going to draw a wire to our led just from here to their nicely done. And now we're now going to draw a wire from here back to the other end of the battery, and we're not going to bother with a resistor here. I just want to teach you the basics. If you now right, click on the led and we're gonna go to properties at it Properties. So justice before click the footprint and click the library symbol. And then what I want you to do is I want you to scroll all the way down the footprint library to U c l e d T h t and we're gonna go for the l e d d 3.0 millimeter. As you now press view three d viewer, you can see that it looks like that, which is exactly what we wanted because we can solder on led in here, right? There's gonna be no issue with that at all. So just close the three de Vere for the time being on, once you've closed the three d viewer, we are going to accept this one. So just double click led D three does years you 30.0 millimeter and just press OK, OK, now go to file and save because we want to make sure that all of this is saved. We're now going to click this look symbol up here, you'll see. Run PCB new toe layout printed circuit board. Just click that you'll see this window Pop up and then you'll see this looks symbol here, update PCB from schematic. Just press that this dialogue will then pop up. Just press and rotates. Um, press update PCB Now you're going to see an error if you didn't follow statutory a properly . So ensure that all fit footprints are set. Press close now and they'll ask you to place it somewhere, right? So it's just place it here, and if we zoom in, we can now see the PCB layout. Now you can provide this term manufacturer and they will basically print out circuit boards with holes in s so that you can solder in your components much like a mother board that doesn't have any components on. Now, let me show you something clever. Click View three D viewer and this is your circuit. How it's gonna look so you can see this is your circuit board. Here is where the battery goes that you sold her on Aunt. Here is your led that you saw the wrong and oversee when she sold it to your left. You plug in the battery and, you know, underneath the board. You can't see it here on this treaty model. But underneath the board here, there'll be loads of connections connecting over components up while connecting are led to the battery. Basically, And when you put the battery in here, it will power on that led. So that is how you ah, create a schematic in K iChat. Okay, let's make this more interesting. Now, here on Amazon, I see a plug that converts a C current into a 12 volt DC power supply. Right? So wherever we connect that lead to 12 volts goes into it, let's change our circuits so that it can accept something like this being plugged into it to power the led. Obviously, we'll have to take arms law into account and will need to have a resistor. Um, because 12 volts is the led is not gonna end nicely. Okay, So, back to our schematic. Okay, let's just close out of this PCB view. We don't need that right now. We don't need to save the changes cause we're gonna regenerate it anyway. And just open up your schematic again. So it looks like this We're gonna press the place symbol again and just place just place it by here for now on, we're just gonna type in barrel in here and we're gonna look for the barrel Jack on. We're just going to select this one and press, OK? And we're just gonna place in the circuit what we're now going to dio We're gonna remove our cell battery cause we don't need it anymore. So go to the select item, select the battery and right click on press delete. Now drag the barrel Jack down a little bit. We're gonna select our wire and we're going to connect the positive terminal here represented by number one to our wire on no amp in two to ground. Would you see a If we now press this symbol again, run PCB new and we press update PCB from schematic annotate you will see an era. That's because no footprint is assigned. I wanted to let you know this just so you're aware close out of the PCB new program we're going to right click again and we're going to go to edit properties and we're gonna select a footprint, scroll through and look for connector barrel. Jack Onda. We can use brow Jack horizontal If you know, press view three D viewer, you can see that's how it's gonna look when the circuit board sent to you. Now, let's just do a quick Google search for bile Jack, so you can see and understand this. Okay, so we take a look here, then you can see that. You know, it kind of looks like that, right? So you have three pins on this thing 123 right? And then plugs into their Now we go back to the schematic. You see here three pens. So, uh, yeah, hope that makes sense is pretty self explanatory. It's just fitting the correct shape, you know, fitting it in, soldering it on. Um okay, so yeah, we can select that one. Let's just close out of this. Go back, Teoh. Care I cad on, We're gonna double click back, pal. Jack. Horizontal press. OK, if you now go to, um run piece of bean You again on just press update PCB from schematic press update. PCB once press clothes now you need to place this on the on the canvas here. Just place it there. You can see there is good of you three d viewer and you can see that's how your circuit board will look when it sent to you. So you know, this is pretty simple board. We basically solder on the balle Jack onto these three pence here on. Then the led will explode because there's no resistance. Eso without have resisted. Now let's close out of this And let's also close out of this. Don't don't don't bother saving the changes. There's no point, Onda. We're not gonna add in a led here. Now we know there's 12 vaults coming into this thing, so you know, we're gonna need to perform arms, Lord to calculate the correct resistor. But we're just going to use an online tour to do it for us because I have already explained to you how to do arms law manually. So let's head to Google on. We're just going to search for arms. Hello and homes. Look, calculator, I should say, and you'll see arms low calculator here. This is a really nice tool because, you know, I mean, I know it's simple math, but it's just easier just to slam it into here. Right? So what do we know? What we know? I am Pavol Tages. 12 volts from the Amazon adapter that I showed you earlier. So just 12 volts. The current of the led is in mediums, and it's is 2020. Suppress. Calculate. We need a 600 ohm resistor for this circuit to run safely. So, you know, make a note. If if you wanted to make this into a real circuit, make a note of that. Right? Okay, so back to our project and we're just going to go back to place. Symbol left, click. We're gonna filter here. We're going to search for resistor on. Let's just scroll through here. We see resistor here, right? This one will be fine. Just press, OK? We're gonna place this in the circuit. We're going to right click, and we're going to go toe orientation, rotate clockwise, gonna go back to select item, and we're gonna just drag it down and we're gonna need to delete that wire. Right? That why has to go click the wire symbol. Just press, delete, note. And now let's make a wire from here to the resistor instead, I'm from here to the led. Because, remember, it doesn't matter where the resisted goes. It could go here or can go here so it can go. It can go by here on the way back to ground or or by here on the positive terminal. It doesn't. It doesn't matter, Right? Just as long as just as long as it is in the path of the led. Okay, let's right click on our resistant. We're gonna go to properties at it. Properties going over the footprint. And this is the one you want resisted. Tht Onda. We can go with this one here, right? If you press view three d viewer, you see, it looks like that. So, you know, we can see that the resist to comply gin there all nice and fine as long as it fits. Guys. Right. We're looking for holes that fit nicely here. That that looks fine. If we take a look at that one, that one will probably be ok to. There's less room between the holes. That's fine, right? It doesn't matter. But you can see you know, there's all different types you can have here. You can have this one. You know, just pick, pick, pick one that you thinks applicable to you. And, you know, you can go with it like you know, this one's quite nice, right? I like this one, right? Because then I don't have to bend the resistor when I'm sold ing in because there isn't enough room. So I'm actually going to go with this one because I quite like this one, right? So we're gonna double click on a press, OK? If you now go to run PCB new toe layout like before, we're gonna update PCB from schematic annotate update PCB successful. Click there. Say we can see that saw PCB. We're gonna go to view three d viewer and there we go. That's what it looks like, right? Not bad. Right? So if you ordered this, you would solder in the barrel Jack into here and you could plug in the 12 volt Andi. Yes. So long is that is a 600 on resistor. I think we said it would. It would run perfectly fine. Obviously, if you put in a really low very resistant, you're really deal probably explode. So, you know, just do the calculations do the math right down the figures and you won't go wrong. Okay, so let's just close out of that now. Because you know what that looks like. Let's just, ah, change here. We're going to right click, and we're just gonna go to properties at a value. We're just going to do our 600 just to represent a resistor of 600 homes. Right? Um, feel free to put the arm symbol if you wanted, but yes. So that is kind of the first tutorial to these schematics. One thing I wanted to note. If you see a circle in the wire, this means they're connected. So let me just give you a really quick example. Um, so I can draw it from here. Fight, draw from here. Um and I did that right. And I drove from here to there. You know, you can see these circles of being generated right. This states that the wiser connected together. That's what that's what this means. They cross over each other. Basically. Eso That's just another thing I wanted to show you before we go any further. 21. Wiring the PCB: Hello and welcome. This lecture covers a little bit more on PCB. In the last lecture, we did generate a PCB, but it wasn't wired up. So obviously if you waas Teoh get that printed then you know Well, it's no wide up, so it wouldn't even work, right? Eso I'm going to cover that in this tutorial. So back to our old pal Jack. Circuit them. Firstly, some warnings. The adapter that I showed you on Amazon 12 all adapter. This circuit is designed for that. If you was to put a lot more voltage into this pal Jack, it could be very dangerous for the circuit. So that's just a warning. You need to make sure the only plug in 12 volts into this pal Jack. If you wanted to support more than that, you're gonna have to calculate another resist a value for this. Led based on the vaulted. You want to put into this battle, Jack? Now, you could use a voltage regulator here with a maximum input voltage of 35 volts. Eso that song was to plug something in here with very high voltage. You know, 35 volts or lower, it should bring it down to a steady voltage for this circuit. Eso You can use the voltage regulator for that. But I recommend only put in 12 Walton here because with the current circuit, if you put more in that, it could be dangerous. So just make sure you're aware that Okay? So, back to the tutorial. You see this run PCB new toe layout. We're gonna click that again. And now we have our circuit like we have before, right? And I think this paste is from last time. If you see nothing here, just press this button update PCB from schematic and then it will give you the option to click it to paste it into this PCB again, right? This that this file. So, um, what we're now going to do is we're gonna draw some wires. Firstly, if you got a view in three D viewer, you can see that's where looks like currently, but there's no connections, right? So we're gonna add that now it's this close out of three D viewer. Um, what we're gonna do is we're going to select the ad filled zones Icahn by here, and we're going to make sure that this red. One of the top is selected, writes this little arrow to represent that. And once we're aware of that, we're gonna actually start drawing our components. Now, firstly, we go back to this schematic. We can see the brow, Jack. One and two, right? You see that? OK, good. Let's go back to the PCB. We see one into there so we can see that pin One is for the positive. Pinter's for the negative, right? So obviously, that is how we need to line them up. So you can see these little white lines that show you how How you should draw this. Right. So we're gonna draw from Penn one here. Make sure make sure this one selected again the red one and sorry. We're gonna press X first, Okay? And then we're gonna draw when you left Click. And we're gonna draw pin to here if it isn't working, you know, press X once and then, you know, left click here and then just, you know, um, moved the wire down toe number to buy here off are resistant, right? Right. Now you see, By hear them. This one needs to go to our led because again. If we look around schematic, you know, we can see that we go from him one of the barrel Jack to r resistor. And I'm from our resist to the addi di. So to do that, we're going to make a connection from here. Andi, we're going to go to pin to like that on now. You can make connection from 1 to 2, right, which will complete the circuit like this. There you go. Ah, you press view and three d viewer. Can I see that? It's lined up right, So we can see when the battle Jack's plugged in here and they plug in the power. You know, the current will come down here through our resistor down here into our led and then to ground so we can see, you know, we can see that that will work quite nicely now. What if you want to draw some copper on the back of the board just to make it a bit more simpler to draw the circuit will actually had to do that. Just close this this press control Z so it gets rid of that line to ground. Right? And I just left click on this green one here. Right? And now click number one on click number two. And now press view three D viewer again on what's this? We don't see our line as because it is on the bottom of the circuit, you see, So that's how you can do that. So that's a fairly useful tool, right? Because now there's a couple wise underneath here going to there. So you know, you should bear that in mind, because that's pretty useful. Okay, so that is how you do that on. Um I'm now going to show you how you can export this on then, uh, send it to a PCB manufacturer so they will print the board for you. Right? So we're gonna close three D viewer. We're gonna go to foul, and we're gonna save this PCB. We now need to export this PCB so that we can give it to the manufacturers. So what we do is we got a file plot, generate drill files, and I will give you an output folder just just to dot forward slash for local directory, press, generate, drill foul. There we go. Enclose that now. Now, press plot and it will make a bunch of files for you. Press clothes. Now go to your foul browser and head to your project directory. You'll see all of these files. Just select them all all of the G B R and D R L files on just right click and just to send to compressed, zipped folder, and you'll just see that as it father. And now that's all good. Okay, head to Google and search for PCB. Gerbe, the u uh, and you'll see the one from PCB way dot com. Just click that and it says, Upload your Gerber and Jill files to render your boards. So we're just testing. This works now, right? Said to your project directory, and we're gonna upload our zip fall. And if everything went well, you should see a three D model of your board right by here, and you can see the bottom of it as well. And we can see that that looks like it's all fine. So when we buy this, the book comes to us and then we just solder in the parts. Basically, we have to buy the parts separately, swore by an led the led gets sold its here, Um the battle jacket saw that here, Right to resist, to get sold it here. So you get the idea, right? And then you can basically order this schematic from these guys or from another company. And then it comes through the post. You need to buy some solder on a soldering I and and then you can solder all the components together. 22. Creating A Schematic And PCB for Wack A Mole: Hello and welcome. So you may remember our old circuit we made here. Um, let's make a schematic for this part of the circuit. Just this part by here, Right? See, the resisters led these buttons. Let's make a schematic for that. Right? So we're just gonna go back to K I cat and we're going to create a new project on on our desktop again. Would you were going to just call this led just led project? That will be fine. Onda. We can see that's created led folder for us on. Just go to your schematic. Just take a look at thesis circuit again. We can see that it has four resistors. Four led some four buttons and we can see that the button itself connects to ground. Okay, that's all. Fine case. The first things. First click the place symbol and placed symbol on the circuit. It's gonna have to load all the symbol libraries again because this is a new project. I just typing here CEO. And because we're looking for ah, connector here. Right. So, um, let's go for 88 female. Here we are. I just press OK, and we're just gonna play stop by there. Okay, so these represent these will represent our our pins by here. Right? You see, e c A. Zero a one a two, a three. And then we have 6789 Right. They'll represent those pins on. Let me show you an image of what this actually represents in real life. Okay, so let's just move this just so it's a little bit out of the way. Um, okay, call. Um and now we're now gonna add Led by here. Okay, on. We're gonna add a resistor as well. Now, let me just check back on the circuit. We see the resistor connects to ground. Okay, That's okay. Best find. So we're going to do then we're gonna draw a wire from here. So there, Andi, if we take a look here we have 12345678 We have eight pins, but we also have a ground which does need to be included as well, guys. So we're gonna need to make another pin here. Teoh, do that Suggest right. Click here. Go to properties. Edit properties on. Just change from here. The lively reference to a nine female on what's gonna change the value to nine female as well. I just press OK, Okay. So there we go. Now, that's a lot better, because now we have nine pins. Right? So one of these can represent the ground. And I know I've drawn that to pin to let's just delete their wives because it be better if we just drive from pin one. Right? So just drag this down a bit on. We're gonna draw a wire from pin one. There you go. On what we're now going to do, we're going to create a resistor by going to place symbol again. We're gonna search for resistor. Andante are just It should be that one. This one? Yeah. Resistor represented by r double click put out there. We're gonna rotate it clockwise, okay? And we're just gonna drag that place it there, OK? And then this will go to our ground at that point as well. So just can make a wire on. It's a bit messy, so I'm gonna try that again. Gonna make a wire from pin nine here on. I know you're probably wondering what all of these pin nine things are. Right. Um so I'm going to show you that because, you know, I want you to understand what we're doing here. So So in case you didn't notice already, we're making something like this, right? You know, like on your Arduino people can. Just pushing the wires onto these things much like we did on our circuit. We pushed it into the inter d d d seven d eight on dso on. We are basically drawn one of those in the schematic so that we have one of those to push the wise into. Okay, let's just go and right click on the resist properties Edit value Onda. We're just gonna put a 250 armed by there. Now, we don't need a pin for the positive terminal because we can see we're not using it, right. It doesn't look like we're using it at tall eso. We get all the power from the Arduino, so that's completely fine. So we only need the nine pins like I've done already. Okay, We now need to assign footprints like like before, So just right click on your led, go to properties, edit properties on. We're gonna change the footprint here, and we're just going to scroll down for dia th t Andi, It's not that one led tht and we're gonna use the l e d d 3.0 millimeter again. Just double click on once again. Let's just get a view through the viewer to make sure. Yeah, there's a nice little l e d cor. Okay, we're gonna close that. We're just going to double click it to assign it. I'm just press, OK, We're under the same for the resistor Edit properties Footprint. Now we're gonna look for resisting here. Eso resisted. T hates t and we're gonna look at that one. There can I was okay, but I look for this one. Just keep going until you find the one that looks like ours, - okay ? And I'm gonna go for this one, right? I mean, it doesn't matter too much which one you pick, so long as there's not so long as there's enough room for you to actually solder on the resistor when you actually buy the circuit board. If you went to go buy right, So I'm gonna use this one. That will be fine, OK? And now our last thing we need to do at the time being is set our footprint for these connectors. So we're just going to right Click first. Cancel it If you draw tools or make sure the my stools on we're going to Right Click properties Edit properties when you click Footprints on and this will do just fine. So I have found that one. It is Thebe the pins connected pin socket. Ah, 1.0 millimeter. And it's this one Here pin socket, one x 09 p. One dogs User Mm. Vertical. Make sure that you pick a footprint that has the same number of holes as we have pens on our old project. Right? So if three d view here, we can count these. 123456789 So that is Ah, that's correct. So we can use that one his press OK on. If we now go and do run peace, be new again so we can see a proper three D model and just press update PCB from schematic press update PCB press clothes And now we're gonna place it here. Okay, just go to view three d viewer on. We can see it looks like that. So that's kind of what we wanted because that they are plugging the pins in here. Onda, we can work with what we have. We can now close this and don't need to save it either. So obviously, to keep things a little easier for you to read, it's best we label the wire here. Right, So just right. Click on the wire by here on pin one and just go add label. Andi, we can just call this. Let's go back to this. Let's go back to the circuit a minute. What is our very first? Ah, led here. Where's the connected? A zero. We can just call it led. Zero. So we're just gonna go led zero nice and simple. OK, so we're ready to carry on here now writes we use our select or here on, and we're just gonna Whoops. We're just gonna left click and just select these. Right? Unjust. Make sure that you don't extend a drag them Just do control. See? And then just type control. V said pace it and we're just going to make another one here. Right on. We're gonna change the label to led one, and we're going to right click on the resistor added value. And they're still 250. That's a cake has drawn over over each other a little bit there. But never mind us find Let's carry on. So then we're gonna control the again. Andi, we're gonna do again. Place it here again. And now we're gonna change the label to 83. And they were gonna do the same. One small led four, and we can see that these lines aren't connected. So we're gonna go toe our line tour, and we're just going to do see if we can connect them up. There might be a little tricky because Okay, Yeah, it's a little tricky. What we're gonna do is we're gonna delete this wire here like that, Okay, By selecting it with the mouse tour and impressing your delete key when I'm gonna go back to the wire, we're just gonna connect all of these up, Okay? Just like that. Okay. May need to delete the wire again if it makes it a bit difficult for us later on. Okay. If we then go to run peace, be new again and then we're gonna go update PCB from schematic update PCB now we're gonna put it here. Okay? We're gonna go to view three d viewer. Okay, that's looking a lot better. So you can see, you know, we have 1234 And we have four ladies. We have our little pin lay out there as well. Not bad. Not bad. Okay, so we're gonna close this schematic view again on Let's just save the changes this time. It's fine, Onda, we no need to add the buttons. So if we go back to our circuit, we can see there is four buttons. No way to the buttons connect to again. They connect to ground on also connect to these positive pins here. So we go back to schematic. Now that we know that, um, we can see this plenty of pins because you made sure that to begin with, we're going to go to our place symbol again. And this time we're just going to place symbol on. We're gonna look for button. Andi s w push will be completely fine. Just press okay on that. And you can see the schematic is getting a bit ugly so we can spread things out If you wanted to a za matter of fact, yes, we'll do that. We'll put it down here instead. And we'll delete the wire to Graham for now. Just like that, to keep it clean. So what? We're gonna do them? We are going to make a wire. We're going to connect this to our ground. Penn nine on. We're gonna connect from here. It's a pin five, which will be our first button pin. Now, just right. Click on the push button. Make sure the mouse select item tool is selected. Right. Click on the push button. Go to properties at it. Properties. We're gonna sign a footprint here. So we're gonna look for a button switch. And I found the push six millimeter by here. If we got a view three d view and you can see it looks like that, right? That's how we know it's the right one. So just double click that press, Okay? Other than the footprint is now assigned, Andi, if we now just attach this wire back to ground again, just complete the circuit. We'll clean this up a bit. You know, in a short while, on when I was just going to check that this looks OK. so just go to run piece being you again. Andi, we're going to go to view three d viewer and we can see nothing because I forgot to run. Update PCB from schematic PSA Collect that press annotate on. You can see it's now gonna tow ask you toe place this component, right? That it's just created from our schematics. Just left click where you want it I'll just put it there Got a view through the view again And there we are We can see our button there and again Nothing's wide up yet because we haven't made the wire the wiring Okay, so we can close out of that. And, um yeah, let's finish these buttons. So back to the selectable, we're going to delete this wired. Keep things clean For the time being, we are going toe copy our push button by selecting it with selectable Andi, we're just gonna go control C Control V. And now you can see we have the push button again. They saves us from having to ride the blueprint a second time, and we're just going to pace it in there. Okay, Andi, Then we are going to connect that one to pin sex. But we're also going to delete this wife the time being. Keep it clean. Okay? Why? It's a nine to ground. Are Gramp in on? We're just going to make a wire from here to pin six. And I could look a bit idea. And you can easily do that by moving the wise around. So I've created 3rd 1 here. We're gonna make another wire from here to pin seven and our Final one Control V again. And we'll label all this shortly. We're gonna make another wire from here. Pin eights. Okay. Excellent. And now we're ready to actually ground everything. One small. So using this, we're gonna make a wire down here all the way here to our ladies, and then we're going to make a wire from here. Cross CIA to ground. Notice how these don't have a dot. If we go back to selector, they don't have a dot here. Right? That means the wire goes over it. They're not connected. When we see the dot like this, the wise connected. So that's how you can tell that this push button isn't connected to line six on dumb A with the other ones, right? If there was a circle here would mean they're connected. We're back to the White Tour. We're gonna move this one down here. There we go. On this one as well. I'm finally this one, Andi. That should be it. I think so. Yeah. Looks like there's no need to use any pull down or pull up resistors R push button. Because remember, we configure the yard. We know Teoh do that for us. Now, let's just fallen sakes. We don't lose anything. We're now going to go to run piece being you again. Andi, we're going to go and press update PCB from schematic and to take and in perceptive Ah, PCB press close. It's not gonna ask where you want to place these buttons. Just place him there and we can move all of this around. Says look tidy as well. Good of you three d viewer. And there we are. We can see all of that now. Now, obviously, we want to reposition this so that the ladies are above the button, right? Like they are in our circuit. So we're gonna move that around and wired all up in the moment. Okay? Lets start moving things around. So selector select all Andi, we're gonna start with the first switch here. We're going to select it, and we're just gonna drag it over here for the time being on. It's going to be messy while we do this. Originally on we see our diet. We are looking for the 1st 1 here D one and we're just gonna put out there. You might have dragged the label out by accident like I did, If that's the case, just ragged back above the other day like that. And now if we just drag that a little bit more and try their alignment, Okay, we got a view three d viewer now. Yeah, we can see that. Are switches directly below are led. Rights is cleaner. So we're gonna want to remove our resistor for that as well. So just grab. I resist to the same way you just did. We're gonna drag that. We're just gonna place the resist Ah, by the It's got a view three d viewer on. There we go. We can see that. That's all nice and done. Now, that's good. OK, so we're going to do the same for our second led. So we're gonna move our second led here right by there. We're gonna get our second switch. We're gonna move it by here, just like that, and we're gonna move out. Resist. Ah, just over. He s is with the other one. Okay, let's get a view. Three D viewer CS. Now it's now a line like that. The led zehr Little unaligned. So you might want to play with the positioning to get a perfect. There you go. That's fine. Well, it's a little It's a little out, but it'll do. So we're now going to get this led Andi tell Before we do that, let's just move. The resist is over here. Just so it's a little easier for us because they are a little in the way, right? Smooth them all the way over there. So they're just a lying with each other, right? I'm just gonna move them back a bit as well. I'm just gonna go view three D viewer. Yeah. Oh, yeah, That's OK. That's not bad. Might be a to move this resisted down just a little bit. Yeah, cool. Not bad. Not bad. So we're now going to move this dialled up a bit. This one up a bit on again, We're gonna We're gonna get searches here and also D four should be in front of the three just like that. So we're gonna grab the button for D three in a place that there now, the button for Defour. Place that there. Okay, on our press view. Three D three de Vere. And look at that Acela cleaner. Right. So then the idea is one of when we've connected all that this happened. You buy this board. The idea is you can come along and plug in this. Connect him. Maybe a bit small. My have to find one's big, bigger maybe. Might be okay. Anyway, the idea is, you plug the wire into your artery non and plug it into here. Right? Um, from from the top in downwards on, then it will power the circuit. So obviously here we connect him to the bread board. Right? But instead of doing that, you connect from the Arduino pin directly to the pen here and in the second should run the same, if that makes sense. Okay. Let's just take a look to see if there's any bigger ones than than these pins. Because these buttons they look, they look very large compared to this pin set. Right? Let's just make sure we done that, right. Let's close this and we're going back to Schematic. We're going to close out of this, but we're gonna save it. Save it, guys. Um, back to the schematic, and then I'm gonna write We're gonna click our move tool. Can a right click on here properties at it Properties, and then we're gonna see the footprint. Browse for that again. Andi. Yes? I found the 2.54 millimeter Ah, pin socket here. And we click on this 12.54 millimeter Vertigo. This one should be big enough. So if we just double click that to change our footprint on, we're going to go back to Grumpy Speed. New on. And we're going to press that button again. Update peace be from schematic, but make sure update footprints is checked. Okay, Now, press update PCB on. You should see it changes. And I got a view through the viewer. Can I see? That's much more realistic. Right? Excellent. So let's put a little label for ourselves. We're gonna go to the text tool here on. We're just going to go W a m for Joakim. Oh, module espresso. Kay place of their got a view three d viewer are wack a mole modules. So that looks pretty cool. Right on, da. We're gonna go back to the select tight until it's gonna reposition that. Okay, not bad. Okay, so let's just close out of this. A second on we're gonna save. We just want to finish comment in these lines, right? So just add some labels to these lines so we can just call that button one butts into but three on and so on button for right on. Then he, uh, g nd for ground on it is a bit messy, So feel free. Teoh. Make those labels a little over here instead by right clicking. Add label further over this way instead. If we now press Ah, run peace. Be new again. We now press update peace be from schematic. Make sure update footprints is selected. Update PCB scroll in and you can see there's little labels on here, right? Says cleaner cleaner because you can see what's going on. Much understandable. Okay, just press file and save because we're now gonna wire this all up. Okay, so we're now going to draw these wise on. So let's start with the ground. So just press the green one by here, Right? Andi, these early desire connected. You can see how it's connected by the lines, right? Just press X as well. Make sure that Thea right tracks is selected. We're gonna click here, here, just connect them all up, right? Just like that on. You know, it's telling you how they connected. If you look at this right, just connect them all together. And this one goes to Graham, right? The ground pin. And we labeled it all for ourselves. Okay, Just press view three d viewer, when it's on the board over as he can see the circuitry by here, right? Arguably not the best, but but that's OK. The beginnings. Tutorial. Okay, great. So let's switch back from our green one here to our red one for the front of the board. Andi from led zero, we're going to draw to our first die out. And then from here. So here, you see, it's showing you how this is connected with white lines. If you get confused. Just check the schematic and compare it to what you're doing here. Right, Onda, it'll be easier to understand. So now, Dia to show that led one should connect today to as well. So what we're gonna do is we are going to again select a lady one on. We just select led one like that. And now we're going to make a wire from here, and we can see it stunned to complain. That's because the coppers in the way from here it's shielded. So what we can do is we go back to our most store here. We just select the green one here, saying it makes it under the board, and I just click here. There we go. Nice and easy. Now from our dial three again with the green ones selected because we're gonna have a bit of trouble with. With this circuitry, we may have to move components around. But anyway, from led 33 here, Teoh led through there. Now press here. So there. And it is starting to look a bit ugly, but we're trying to position the components very close together, so it's a little tricky to get right And there's also a type of here. You're welcome to correct it. If you want d zero led 0 81 then we go straight. Led three So we can rename. That led to If you wanted, that's up to you anyway. Back to hear them, Eddie d four. As a matter of fact, once we finished, this will go back and re label that properly eso by here than led four Should go to D four eso we can create another wire and I'm from here. So there, Okay, suppress View press three d viewer turned it upside down so you can see that that's mostly connected for the ladies. At least we need to do the buttons. So let's switch back to our rare one for the time being, we can manage that now. So we're going to go and click button one on. You know, it disables everything because it knows where you need to line up, right, So lets you tells you where the line up. So we're gonna go to button one here. Now, remember, these two terminals are connected, so we don't actually have to make any more copper that we we probably didn't have stood for the ground either. But that's okay. We've done it now. So from button to here, you can see what stands. Struggles. So let's go back to the copper. That's under the board. The green one, But in to buy. Here. There you go. Now we're gonna try Button three. Okay? Finally, Button for which were really stunned struggle with So, um, where we can get around in that way. No, we come. We'll have to switch back to the red one again. Just go back to this one. We'll switch to the red ones. Were on the front of the board again, are just from here. So there. And I think that is it. If we go to view three D viewer Yeah, there's ah, wack A mole module. Seems like it's all, uh, connected up all. All fine. Okay, so let's no fix that type of So to fix that typo, let's just close out of this. We're gonna file Save this close out of that now. Andi, we're just gonna change. Led the label here. We're gonna go at it. We're just gonna do led to We're gonna add at 83. Okay, Go back to hia Run piece being you update. Peace be from schematic. Update. PCB close on. You can now see it's updated correctly. We got a view three D viewer. There we go. No problemo. That's Ah, that's really good. Okay, we now one applaud it. So just go to file plots. It's gonna ask for an output directory. But first things first. Generate the drill files. Click generate, Joe files dot forward slash press generate Joe Fall press clothes. Now the output director should be set. Adopt forward slash If it isn't, said it. Press plot. Close that. Now go into the directory. Select all of the G B our files and the d r L files. Right click send to compress sip folder on. You can now upload this to the PCB manufacturers and they will print that board for you. So if you wanted to take this a little further, you could look for an LCD footprint on. Actually put that in there as well and change the pin count here and actually also hook in our LCD display. But to keep things simple because this is the beginner's course. I have only shown this part off our circuit being made into a PCB, however, lose using the skills you have learned. It shouldn't be too much more difficult for you to take what you've now learned on design that circuit with the LCD. So that's a bit of a change for you. If you wanted to do that with just this module, you could disable the LCD screen on would still have a whack a mole game, however, wouldn't it wouldn't be able to display you a score. That would be the only difference. But you could get creative and hook it up to a buzzer if you wanted to, and it could buzz when you're out, there's all sorts of really cool things you can do with the's digital components.