ADVANCED ARDUINO | Ahmad Halawi | Skillshare

Playback Speed


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

ADVANCED ARDUINO

teacher avatar Ahmad Halawi

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

21 Lessons (3h 17m)
    • 1. Class Introduction

      5:08
    • 2. Revision Part 1

      5:55
    • 3. Revision Part 2

      9:39
    • 4. Resistors

      10:41
    • 5. Transistors (TIP120)

      17:11
    • 6. Exercice 1 Solution

      6:57
    • 7. Serial Communication

      18:50
    • 8. Exercise 2 Solution

      9:25
    • 9. PMW Signal Concept

      11:57
    • 10. PWM Application

      13:33
    • 11. Relay

      12:30
    • 12. Exercise 3 Solution

      7:53
    • 13. Relays vs Transistors

      4:56
    • 14. Breathing Effect LED

      11:39
    • 15. LCD

      9:38
    • 16. Keypad

      6:13
    • 17. Ultra Sonic Sensor

      7:33
    • 18. Servo Motor

      15:32
    • 19. Exercise 4 Solution

      12:24
    • 20. Project

      4:58
    • 21. Project Solution

      20:21
  • --
  • 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.

52

Students

--

Projects

About This Class

In this class, you will learn how to use and code a variety of components that could be connected to an Arduino, so you need a prior knowledge in this field. Before attending this class, you should just know some basics, for example what is mechatronics and what is an Arduino, how to connect some wires or Leds to an Arduino, no more and no less than that. Concerning the coding part, a very basic knowledge in programming is enough because every statement you may need is explained.

At the end of the course, you will be eligible to use any Arduino between your hands, and to connect components and code them to it. Also you will be capable to make small projects using an Arduino.

This class does not require any software or equipment, unless you want to buy the Arduino UNO, otherwise all the applications are done using an online simulation platform released by Autodesk, called Tinker CAD..

Meet Your Teacher

Teacher Profile Image

Ahmad Halawi

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. Class Introduction: Hello guys, I am halloween and I will be mentoring you. For this force has to be. First of all, I should mention that this course is not for beginners, an advanced course. So you need a prior knowledge to proceed in this course. You should at least know what mechanics, what is Arduino? How to use an Arduino? If you have an Arduino act as a hardware, you should know what are the pins in this Arduino, how to connect it to a lab, to how to connect it to a DC voltage, how to take a signal from it. And if you don't use an Arduino as hardware, you are using Tinkercad online simulation software. You should know how to answer to add, how to login or sign up, how to use the components in there and concerns the coding part, you should at least know how to turn on their laps. Okay, So this is the prior knowledge you need to know to proceed in this course. So this course is not for very beginners in our green, okay? And all these informations I mentioned are available in my first course on Skillshare, introduction to R. Okay, so you can watch my first course, or you can have this knowledge from outside and begin with this course, which is advanced. Are you willing? I will make it basic revision, but it is not sufficient to proceed in this course. If you do not have any prior knowledge, as I said before, then I will talk about transistors, CDA communication, PWM signal relays as ultrasonic sensor, and various exercises approximately about every topic. And I have the final state. There is a project and absolutely a project solution. Concerning the exercises. Nearly every topic of these has an application in a single video or the video. And it will usually of the exercise. So you can test your knowledge, your skills, and what you proceed in this course. Okay, so you do not need to go outside and search for exercises. Everything is included here. Concerning the project. In the project, almost all the components we talked about on, okay? So the project is like exercise or small project to test and compute all the skills you've learned in this course. Okay, so if you saw the project correctly, you have completed this. Here's what to expect at the end of this course. So when you finish this course and when you solve that project correctly, okay? You are eligible to use any Arduino in between your hands or you can do exercises, small projects, you can use the components related to Arduino, not all the components. Let's say here there is an actual group. It is not included in this course. It is a little bit professional and we're here in the advanced level. But you will use FIPS, push buttons, ultrasonic sensors, Let's see, LCD, PWM signal. You will understand their needs and values of PWM signal. So you are eligible and you are capable of using an entrepreneur connected to your PC or using Tinkercad and do any project with this, with these components. Okay, So this is the end of the introduction. And as a summary, I would like to mention that this course is not for beginners. You should have a prior knowledge of Arduino and omega-3. You should have already should know how to use Tinkercad or an Arduino. So at the end of this course, you will be eligible to use Arduino and you will be eligible to develop yourself. And hopefully you will be eligible to do any project related to the opponents I explained in this course. Okay, Hope you enjoyed the introduction and hope you are interested in their course. And thank you. And I want to mention that if you want to talk to me or contact me, you can contact me through my email or under the course in Skillshare. Goodbye, hope to see you in my class. 2. Revision Part 1: Hello everyone. This is our first video in this course. And as I said before, in the previous course. As I said before, you can access this course. You can watch my first course. First of all, I would make that connection. Okay. Next up positive 20, 22, resistance. I press the button. Text. First. I will take an input or an output, which can be used. And as a reminder, don't forget this. And then let's say we want to turn the LED. As you remember, a 1000 milliseconds. Then a simulation of this lesson. I'm just trying to make you remember everything is the same. The same constant. Let's call it x1. Then I'll say eight. Then here. Also, I can. And we make sure all in the same way as we have it. What does that look? Okay, you should get one. So I will tell you something now. It has worked while programming, while doing. The expert holders may make some mistakes. Mistakes are made now directly. See again, let's put it here. So the Edit, and you go and check what is and you fix it. So I read that one does not blame directly. I knew it probably will not happen. So I discovered that I put it in their own field. Now, let one is initiated as the reading. For the same. You are reading the code is. And that's how we have left. I'll stop the simulation. And now I'll stop the video. And in the next video, I will make us more about digital. Digital. And thank you. Goodbye. See you next week. 3. Revision Part 2: In this video. First, because we have so much connecting Lauren's that's more complicated circuits. And circuit. That's why throw as much. Sure, there are a hundred and twenty two hundred and twenty. I would come back. Then it was okay. I would take this first video of this course. Depending on depending on that division, I will explain that and put down. So it wouldn't be able to understand why I put this on the negative side and y. Ok. Now, I'm going to, as always. And at first, I want to assign statements. Which one is output at this input set. Now, I would say, let's call it. Okay? And now when I press the push button, the LED turns on IP packets. Inside the brackets. Digital blood. Which then let's test our code and see if that's working properly. I want to push rest. So the oldest working. Okay, I want some clarification to make my code more professional. I will call okay. I will substitute here. Yeah. Okay. Let's, let's try our code. Let's say I can do another thing. We can remove this statement here. I said once and I will repeat it. When I don't assign statement for the pin is an input. Output is built as I move this block, and then it turns. So that bends here. And I said to keep this statement here to, let's say, to clarify that good. And if you want to change it, put it as an output. Anything else? Okay, So you know, you have this one. Let's just do the idea. I would connect first, sorry. I think as I said, two are opposite from the negative side connected. It's called a push button. Two digits. Which Ben. Okay. Ok. Ok. Ok. Ok. What do you expect when I press this one? Let's see, you have two seconds. I say that when I press it, it will turn out because I had to push back on digital one low. Okay, It turned off. So I have to. Next in the course, in the advanced part, we will start coding a single push button to make it turn on and turn it off. Okay? But this is an address and we will later. Okay, great. I want just to make you remember when I put this single equal, sign a statement to the other variable. So now push button one is equal to that. So now push wasn't one is seven. Okay? When I put equal, equal, I'm making a comparison. So I'm saying if push button, which is seven, which is seven, if it is too high, if it is breast. And another words. So I'm making a comparison. So do this statement on any other statement I wrote here. This is the difference between equal and equal and equal here, the code will not work directly. Turned on. I can't turn because this statement is always true, will always be. This is our second video in this course. It was. Now I will enter, we do. And in the next video or something, you goodbye and see you next week. Thank you. 4. Resistors: Hello guys. This video, I will talk about resistors. It is divided into two parts. The first one, we're using resistors and I will tell you you should use. And in the next part, I will talk about in your lab, this resistor. How many kilo ohms or what should you use it for? Let's begin first form. I have a breadboard. I will connect as usual. As you see. Now. As you see that it is okay. For now. I will make something. So we can see the difference clearly. I put next to each other. I will also change the color. But let's see, 1, 2, 3, orange. So just press too slow. Okay, I will put this form. Let's say this one. And let's learn our key. And just click, Okay, this one is darkness, this one, and this one. Okay? So as you see, there is a limit or there is. We should use, how do we know? I go and demonstrate, first of all, as you know, u equal that distance is. So let's say we want to calculate. So let's see. What is u? U minus v drop is the input voltage from the Arduino. And Vitro. That drop, as you know that it is inside. N1 is ionized so that you have just hit. So let's continue. So minimal as you know, because you are going to use your mouse over R minimum is five volts in vitro. But we will take an average voltage is 0 volts, okay? Over the island. Also, it has a great average from 2000003040. But the most current is 20 milliampere, which is 0. So let's go to the calculator, scientific calculator, but we can calculate this expression here, five minus 0.70. So the answer is 215. Let me try the acid. So is still 15, which is the ideal resistor we should use. The minimum. You should use. So below, is an resistors or less than that appropriate. And we'll explore, let us come here. So this one, which is 500 pounds, 250. So. This is the Verifit. This one has low brightness. This one will explode because it is much lower. So now we know what is the minimum resistance we should use. So this one is create 300. Okay. Now, how do I proceed to the next part of the video where I will explain how can we what is a components that prevent other circuits? And it converts electrical energy into heat. Is heat dissipation. These are the most common shape of this third, you may find, okay, we have bigger or smaller, but this is femoris current with crops. So why these colors are very important to low resistance. So as my name is, you know, me by my name. Let's say this is Joe, This is Alex. How do I know them from their names? Okay, and these resistors are no colors. So I will take an example. Let's see here, each resistor has colors, and these colors determine resistance. So let's say this is a four color, so we have three colors corresponding to that resistance. And one corner for the tolerance. If the first one is known as he did, so Brown. The second one is red or orange head, and the third one is now. So this is one hundred and twenty one, twenty one, okay. One to one. So 121 ohms, as you see here, are a 120 ohms. Okay? The color is gold. Let's see. Where is the hole? So it goes 5% progress. So now we know this resistor. What that is. I will give you another example. This resistor does not have four, others, has 1234. We use this to detect resistance, and this one is also four. Let's see, yellow. So it's four. What is this? Violet, so it's seven. So seven then black for 700. Okay? And the horse more will determine how many zeros after that. So ten to the power one. So let's go for 70. Okay? So it is 4.74.74.7. So this is a way to determine that. At another way, an easy way to use an application or a web. I ended, okay, First of all, I choose Format five months, six months, let's say a quarter boundaries is that let's see this. Okay. This is important is that first color is yellow, and a second color is the third color is black. Is black. And finance car is good. Okay. Is it 47 arms with 5% tolerance? And in this website, you have to find this resistor. If I press. Okay, there is a catalog fourth 1747 hours, 5% donors. Okay? So this was everything. In this video, I give you some tips and tricks how to use resistors. Have to know what is this resistor, how to choose the perfect resistor for your project or for your circuit. Use it in your daily life when using mechatronics. So you don't burn any component. Thank you guys. 5. Transistors (TIP120): Hello everyone, Hope you. It is very important to understand very well what I will speak and talk about it. First of all, as you know, we can use this water. Let me bring this data sheet. We created full 75. That gives us x. So I can connect it this way. I can connect this damage and damage that. Okay? What should I do? Case? We'll use a transistor. It is 120 transistor. First of all, it mean that you remembered, how does it work? We have here. Okay. Give me 1 second. The internal transistor. I think it is clear that this is a connector. I want to put this here. This is supply circuit. I have. I will bring that back. Okay. Maybe it is. Okay. So I connect to the load. And when does that occur? When the signal to the base. So when I get to that, when I cut the voltage, so there is not any. Also the current that flows through this. I separated the high voltage, high current from the Arduino. So now I'm controlling, let's say that the voltage at more than 0.4 amp current that the Arduino can't supply and controlling it on and off high and low 10. So now the Arduino just do not burn because it does not support this voltage. And at the same time, I'm controlling this folder. This is how it works. And now we will go, okay, Not every time we will use water. We will never connect it to the directory. We will connect it. Or a transistor. We will talk about them later on, but now with a 120 and 120 has three legs, as I explained before. So we connect that to the Arduino and we put a resistor in between the wires just to prevent the 128 to be burned, et cetera. We connect the collector to emitter, to two graphs, to the ground of the Arduino and to the ground to that power supply. So we call it a common ground. And we connect the motor to the positive of the postwar. Okay. This one is a diode. I will explain now how it works. I will explain it when we put it in there. So now we know how we should connect with them. And now and start working on. First of all, we have February. As usual. I will connect to the positive direction, positive, positives or negatives, the negatives. And now I will bring that all foreigners. And now that is okay. This 1. First of all, let's put a 120. Okay? First of all, you said that the base is connected to the Arduino throughout it is. I will put the resistor here. Lets say. Okay, 330. And connected to anything on the Arduino connected to pin. Unusually long day, NO. Then we have the image. Center diameter is a common ground. So I will connect the ground and you connect the emitter to the negative. And also I reconnect diameter negative. Okay? Now, I have them often. We said that the positive power supply connected and disconnected. Okay. This one is responsible for okay. I have that. You put the diode, sorry, sorry, sorry, between them. So when the Arduino gives the signal and the flow passes, then the Arduino stops. There is a small flow that does not pass and may damage the motor. So this will pass throughout the day. So this one works, Let's say prevent any damage to the motor. I will put it here. Because that is okay. Usually I connect the positive to the positive. This point. And now we will go to our code. What it does. Let's call it C. How does that work? Nothing will happen. Nothing will happen. Water will not turn because on the basis of that. Okay. So I shouldn't give signal. Let's say for a whole week, when is it? Right? To the base? Always. Let's see what will happen. Simulation. Why? Because the base is always turn signal here. So let's try this. Let's see seconds, three seconds just so just we can see what is happening because the motor to turn on and turn off it needs some time. Then digital 0, 0, 0, 0. Okay. It is for three seconds. For three seconds, then exit. Now, we understood how that works and how we connect them on to that. Now we will do a little bit more challenging application. We will use a push button to turn on that. Sorry. So first of all, I needed push-button. As you know, we always need a resistor connected to the negative or positive. And I will connect it. Now. What do you think we should? All right. Okay. I will give you two seconds to transfer all that. Okay. What do you do now is that we will see that when we press the push button, the amine gives a signal to the base. So first of all, output 11 and 13. Output. There is something missing here. This one. I can see, okay. Now, as you know, right? Then, what will happen? I will open the brackets and I will write my first. Okay, What should I do now? I should write digital dry. So now when I press the push button, a motorway and not directly after starting the simulation, as you see, we start with a simulation that motorists 0, I will push button grades. I think it is clear and you understood it very well. Now, a challenging task, and I will solve it in the next video. I want you, I want you to make them more to. The second part is elimination. Turn on, okay? And when I press the push button, it turns on infinitely. I don't want it to turn off. Just one. I'm pressing the plus button. Okay, let me tell you how you will get digitalWrite to. It is always turned on. If push button. Let's check what will happen now. Look. Let me remove this one. Okay. The motor is turned on. When I press the push button, it turns off. Okay. Okay, let's see what is our problem here. Okay? I know what is a problem. Because there's something missing here, which is that the push button, I said before that reads 100 seconds. So it is reading high, low, high, low, high, low, as what I should put here. So I should stop the simulation. Okay? Okay. This one is responsible for low. Okay? So if it is low, hit me make it clear to understand this very well. Okay, I can use my video and do this verifications. What I prefer to do it in front. So you see how the programmer should, how the programming programmers should pay attention to his mistakes and fix that. And hopefully you will be at my place one day. So now if the push button is not pressed into a push button, the motor is off. Okay, Let's see. Tomato is on. Stress. Well, the second I remove my hand here and the plus button is not rest anymore than water. And, and your task for them as an assignment. And I will put that in the next video. Is that you should program this one. When you press the push button, it will turn off. And thirdly, it will not turn on again. So the RPM should be 0 from one click. Okay? Okay. See you in the next video in the solution of this problem. Goodbye, and thank you. 6. Exercice 1 Solution: Hello again. This is the theme of the previous video. We're challenging exercise. As before. So as you see now. And if the push button, so it is, as you see now. What I do is I want you there is two for this. The first one is like we are at tricky, clever, an infinite. So what does this mean? Here is the Ashoka is high. What does this mean? So when I press Enter, this will enter. We'll do this one. Then we'll enter. You know, that the goal is like that. One statement after. So after this one has red down here, after this one. When we enter, this is an infinity, something that can go to the next step. So when it comes here than here, will not repeat. It entered an infinite loop unless we stop this condition. And then we started. And we'll do the push button. Okay, I'm not pressing more because now entering its will not accept anymore. Okay? This is the first solution of this. Now, I will go to the second. This is more challenging. And I'd like you to use it, not the first one because we will use it. A new variable called i will see that when the audio or let me explain it. First of all, y here gives me the initiation of their quote, one simulation, how the simulation was thought. And this line, as I said before, will be repeated once at the beginning of the quote, and then we will not, will not read this one. Now I push button low. And what does this mean? First of all, when I say push button one equal, equal law and giving one condition to do this line. That was photon is low. Now I'm saying that push button is low. And I asked two conditions. The second condition is, so push button is low and the thermometer is equal to 0 at the beginning. When we change its value, when the push button, I will equal one. So once I press the push button here, the old will enter this loop, this statement. It will turn off the water and then it will change its value to one. Okay? Now, let's continue our code, but with equal one. The code from you, as you know, we don't have an order here. Just at the beginning. Now, the court will repeat from here. It will read this one. The flush button not pressed. Equals 0, equals 0, know anymore. And a will be equal to one to the infinity. There is no, there is not any statement here that can make a equal 1, 0 again. Okay? So let's try this. Okay? We have a problem. Let's see what is the problem. One value required left operand of, okay, look what is the problem? The problem is, I put just one equal and not too close. A mistake. And I pounded. This is how we develop our code after you find them and correct them. So now I am doing the simulation. Now. Y equals 0. This one is because push button one is not pressed and a equals 0. So this is the statement that now when I press the push button, will turn off and then nothing will happen. Water. This is how I want you to solve this problem. This is a clever way, a good way, and if any important way for that next, because you use it in other applications when we are going to start using sensors. And now this is the end of this video. It was just for Simon. Thank you for your attention. See you in the next video. 7. Serial Communication: Hello everyone. In this video, first of communication that every time I come and I will explain them. The supports are responsible for the serial communication, as we call it. Sorry. So we write the quote, jobs. I don't know. What do I want to change something, either behavior or what if I want to turn on or turn off lab. Throughout a clip from one of the roles of the Syrian communication. I can, first of all, before I start and give you examples. These are hard wired USB. So if people can't use these appropriately and vice-versa. So I'm using these ports. And I want to upload equal to 0. For I should. I put them and I'll continue. This is an example of what that is. Okay? Okay, let's say this form. As we all know, we should not forget that. Okay? This is my this is my circuit. Is your task or what I explained. I want that when I send the letter a to the Arduino, LED turns on. And when I send the arginine, valid, and when I send any other letter different than a and B, the letter, and how should I do that? Let's go to that. First of all, as you know, we should defend. And Mr. 11, you are. And also because I will use communication, I should tell the Arduino that I want to use the communication and I should draw this thing. Now. You should memorize the whole like. So. I want to use this serial communication. I should write in the Hudson up. Again, sorry, it is not picking a 109,600. What is this number? This number is frequency of communication, as you know, when there is a signal sequence and I'm using a serial communication at the frequency or she understand mine 1006. And I go to that. Me. As an owner of the Arduino, I want to send the Arduino some informations. So I should write this set. I will say available. So if statement, okay, Great. Okay, now begin to date. Then also, now I'm available. I'm giving you some statements and enter this one. If I'm not giving anything to the Arduino, why should it enter here? It is a waste of time. So if available, creative non-zero. Okay. Constant or an intention I will call it in I can call it what I want a meal, anything. As I said, you should memorize these as before. And push button, one digital push button. All it is the same concept. And then bond, which is an integer, senior. Now, I will use it. If you switch before from Python or C, or C plus, plus, it is great. If you don't know and I will explain it now. Switch statement. What will I switch? The invoice? I will open and close brackets. What that means, just this one. What does this statement mean? What does mean that I'm switching this, which provides me with the output that if I'm comparing white, like I have, as I explained before, a equal equal one is just the one. It can be equal or not equal to one, and it is finished. I don't have to choose one. The switch on limited tools, let's say I will give an example. I would write it in this way. If a equal to one, say if a equals a, a four, etcetera. Okay? So I have an unlimited number of cases, okay? Not just yes or no, a equals a naught equal to one. No. You will see how. So switch inbox. So I'm comparing the end, but this is the first thing I tell. I told the other twin is equal to one. So I should use the word case. I will put the points, two points. And now I will say, Okay, what did I? First of all, I said, this is my first comparison. Is equal. Equal. Yes. So yes, what does will happen? Digitalized 13. So the way we put the statement, make us with that switch. So if invite is equal and that all the Arduino reads this statement digital writer in mind. Then it will read, it will quit the all of the switch statement and go back to the beginning. If I do not write the brain, it will continue to read all the cases. I will tell you. I will give you an example. The second case is it will be digital. I said, okay, and I do not put a break statement here. No matter what the what the case was. A, it will enter here and it will read all the chords below it. So it will, so the LED will turn on and off. And this is not what I'm waiting for. I'm waiting if I give it an a it will turn on. If I'm giving it and stop. I'm not waiting to turn on and off. I should go. And I finished my comparisons. Invite a, B, C, D, etc. I will put what is the default case? First of all, let me write digital. Which one was I spent 11. So I have here is take this one. And this one is okay. What is the default case? Here? I gave the invoice. A and B. What if I wrote, what if I wrote F? What? I don't want to, What does it happen? Does it stop? It enters the default case. So the default case is any character different than what I give to the Arduino to memorise. So what if I give now CD, etc, it will turn off as same as Ksp. Now, let's try. I will quote, I restart the simulation. I will open the serial monitor here. I will put a seller on. And this, my code is quoted as you see when the case is a byte. So that should be turned on. I will, I will let you know that. Let's turn on the red again. And then let's compare with no, there is nothing like so. It will go to that. And as you see, it turned up. Okay. So this is how they monitored the number six. So now I can come with the arguing. Throughout the serial monitor. I send the Arduino some gold and I change its behavior. Or that, or that it works by d. Okay? Now, there is another use for the serial communication. I will show you how. Let's remove this switch and the invoice. As I said before, every time we want to use Serial.begin serial communication, we should write this one. The second way to use communication is duty. As if you know Python or C or any coding language, you know, that is a print statement. In the olivine, you can't use the print statement alone. You should write some code. Here you put what you want to plant, let's say serial.print. Hello. Okay. Let's see what will happen. I'm just waiting for the host thoughts. Okay, What's the problem here? Is that let's see. Okay, hello world, hello, hello world, hello. Let's stop this simulation. Let's put hello world. Backslash. D. I will tell you what is this. Well, if you have a prior knowledge and coding, you will know that backslash is like a tab or many spaces or printed. And you can also know that backslash. And you will see now what will happen. If you don't know. Now. The backslash skip along, okay. As you see now, we can rent whatever we want from the Arduino. This is a simple example. Now how can I use it? I'll give you a small exercise. Let's say I will, I will write a for loop for I equals 0. I smaller than 100, let's say 1000. I equals I plus one. So now you know that I will increment from 0 to 999. Every time it will be added. I will print out. So now I want to track the value of I. So I print Serial.print. Now, I will blend it in this way, but it will not be clear. We'll do some clarifications box that we show you now how it will work. Okay? What is our problem? Okay, We never do a for loop and put here that comma. We remove that and you often directs. This is the statement in the for loop. I is freezing in the whole loop. So start simulation. Okay, I'm waiting. Now. Monitor. This is the value of, it is not clear at all. We'll do some current location. We put n. So when you put an L, n is the same as you put backslash n. Ok. It will skip a line. As you see, I is increasing from 0 to one. This has a value of art. And by this way, I can draw my values, my integers, my increasing values, anything. So I can check whether I have a problem or not. Okay, until now, I think everything is understood. Now. I will give you a small exercise. And I will give you a small exercise. And as usual, I will put the solution in the next video. I want you to put the right where there is the temperature from 0 to 100 Celsius, then the temperature from 0, or the equivalent of literature from 0 to a 100, Celsius and Fahrenheit. And I want a parenthesis here, temperature in Celsius, temperature in 400 and write 0 to a 100 and the equivalent. Okay, I will put the solution in the next video. Thank you for your attention. Thank you for your time. See you in the next video and goodbye. 8. Exercise 2 Solution: Hello everyone. This video that does not leave any connections we communicate and how to use it. I will just repeat what I want. Here. Temperature and pressure. It, I went from 0 to a 100. And vocal version of these apertures empire. So first of all, as we said before, empty line communication, I should draw it began hundreds. Now. Everything is okay, but I want a picture and it should be written just 1, a 105. It's like a table temperature in Celsius temperature and 409, etc. So I would write that in the void setup. Just one part. I think you are familiar with this now. One time. And not like the old glue that repeats. So I would write them. Let's see, I need I finished. I can't pay my talk. My cool. So I said, OK, now let's go to, first of all, I want, I want that to go from 0 to one. Let's see if I can distribute values with decimals. Okay? What is this statement that gives me an infinite number? Precise, but as much as I want, the for loop is best for my kids. For loop then pursued equals 0. Whenever the cell is less equal to a 100, because I need the a 100 to be on the screen. And temperature Celsius plus equal. Okay? Now I will open the brackets, close brackets. What we'll do. First of all, what is that conversion from temperature in Celsius times 9 over 5? The answer is 32, equal temperature. If we write the statement, then I will explain some. Have potential funding and spiritual insets times. Over. We add asked, why did I put some brackets here? Because in C plus, plus the operators of the times and division from left to right. So if I, if I put it here, df, dy, Okay, it will not work properly. First of all, nine, the answer equals 5, etc. So this is not what I write it in proper. We have the operators plus minus the arms up. Last two exit. Okay? So now I hope I did that conversion. Now I want to print. So first of all, friends. I want first of all, under the longest then serial.print. I don't know this space between the two. Now. And now. I will just oh, yes, I will just get some thing now will happen that I don't want it to happen. And we will solve after we see what is that? Well, as you see, that temperature is from 0 to a 100, but I'll just want infinite. But I want it to be repeated. Just one part I will do is simple trick. We learned it before. I would say equally for 100, 100, enter an infinite loop. Why does the court will enter this loop and will never be repeated? Now, as we will see this. Now, I want to see there is deterministic. And just because and everything will be ob simulation. Simulation as you see them. As obsessive. I will close. This was the solution of our exercise. I just want to mention. And this statement here. This statement, as we understand it, it is it is the same. Okay, let me erase all of this is the same. Let's see. I want to add one to this one. I can write equal one. This one is the name of this one. So plus equal 1 Tc plus one. Also, let's say I'm writing DC, DC. I can write TC equal to this. One is the same of this form. I can also see over 2 divided by 2. It is as needed. So now this one and this one is one, and this one. And this one isn't the same. Also for them, waterless minus 4 symbol, any operator. Okay, This one is just to save that on and be clear. So now I've finished my exercise. I will see you in my next video. I will add another exercise on serial communication. I don't think so, but we will see see you in the next video. Thank you for your time and good luck. 9. PMW Signal Concept: Today I will, I will, I will explain concepts. It is analog output. First of all. Before coming to analog output, I want to show you how it works. First of all, yes. I connected the output. Then from the Arduino. It is 500. Wait a moment. Okay? So this is the output for a straight line. And you know that I made, just. Now, I will connect this oscilloscope and this voltmeter to PWM output port. First of all, as you know, we have six PWM output pins, which are 3, 5, 6, 9, 10, 11. I can take a digital or analog signal from these six. I said before, digital is true or false. An analog value. It is not yes or no, 0 or one, it is variable. And these are analog input. Usually connect to them. Sensors, potentiometer at the exit. We will use all of them later on. So now I will connect this one to a PWM output. Let's say 10. Also this one. And now I will connect the grounds Section, reconnected. And then let's see. First of all, we are learning. Now in your hand. It is analogRead before digital. Digital ether to yes or no, 0 or one. You are familiar with this one now and we used it. Now. We are coming to use analog era. We assigned them and we assign the value of the signal. I'll go and explain why I wrote. As you know, the Arduino, hence gifts a fivefold or the analog output. Then this is divided onto a range from 0 to 255. Okay? So five volt refers to 255, 0 volts. So every voltage I need between these two, I want to transform it to 0 255. So let's say I need a 2.5 volts. It refers to approximately 120, let's say 27. Okay. So I can made the rule of home. It is very easy. Five volts to a 165 of any voltage Island. I put it here, so let's say one volt. Okay, so the answer here is one times 255 over five times 255 over four. Okay? So let's say a general rule. It is the voltage times 255 over 5. And I get a signal I should put here. And it gives me the voltage I need. So let's say 50 times 255. So let's say, let's calculate for one volt times 255 over foil. It is. Okay. I put 51 here and I'll start the simulation. Let's see what we have. First of all, we have a 14. We will never have an exact voltage while using PWM signal because it is not a straight line. We will have like here, between 900, 90 millivolts at 1.01 volts. So it is. What about the PWM signal? Is a group of signals, high, low, high, low, high, low. That varies in time. So what is the difference between one hold 234 volt signal, etc. It is the time between the high and low signal and not the magnitude here. Let's see, 20 volts, 345678910, then squares 20 volts. So each square is the signal here is 2.5 volts. That voltmeter does not signal. It will always be 2.5 volts here. But the output is that any device with DIC is not 2.5 volt one volt one. Because as I said before, the difference is here is between the two up and down, or let's say on and off signals that time here. Let's take another example. I put 150, okay, I'll stop there. Okay, If we want to weight the PWM signal to a period of time. So let's say you. Okay? Okay, I just have a correct graph here. Okay? So as you see, now, when we increase the voltage to approximately three volts, the on-time has increased and the time has increased. But let's count this one more time. 1234567, 8, 9, 10, 20 over time. Each square is two volts. And you have here five votes, 2.5452 squares. So it is always five volts. It is always the maximum 2.5 squares, which means five volts. But it was the first is that time of that signal and off. Okay. I will stop here for this video. I will give an example or many examples in the coming videos. But I just want you to understand that the PWM signal, if we are on time and not with the maximum value of the magnitude of the voltage. As you see, it is always five volts. But what I'm taking or what I'm reading is approximately I can change. I can change one more time. Let's put 200. Okay. Let's see what happens. It is always five volts, 2.5 squares. It increases to approximately four volts. But the on-time, on-time and time. That is let's, I want you just to see what happens if we put 255 is the maximum value. What happens? It will became a straight line because it is always on. So as I said, the PWM signal is how much it on and off. So when I have the full value, 265, which is five volts, it is always 100%. So if I have, let's say 127, which is 2.5 volts, which is the value. I have 50 percent on, 50 percent of that. Here. I have 50 percent. And 50 percent of I have as much as as much. When I have, let's say four volts or approximately 200, I have more than 60% on. Let's see how much. If we say five volt is a 100 percent on four. It's four times 100 over five. Let's go to the calculator. Four times a 100 and 400 over five. Okay. 80 percent on. What does it mean? 80 percent on? So I have the own more than that. Okay. So if I have five, so I have 100% on a straight line, on a straight line, this line, and this is the point. Okay? So I think everything is clear now. I can stop the video and I can do an application in the next video where all of you understood very well the concept of PWM signal. Thank you, See you in the next video and goodbye. 10. PWM Application : Hello guys, are doing well. Or exercise. First of all, as you know. And I needed just a small reminder that this is test. It has at least one connected to Mongo method. And the second one is the output of the Fourier. So I drew this one and this one is connected. How does it work? This is distance. So then up here. Okay, so what am I using? That circuit? So I'm using, let's say, 1 third of the total resistance here. This is a 100. Now I'm using 33 ohms. Okay? Let's see. Let's say they're not here. Okay, So now how much resistance using amusing half. Okay, Let's say this is a 1 100th. So I'm using this is the constant. Now let's continue our circuit. I will connect to Penn 11. We should pay attention to connect now. Okay, because we are using. So now I will connect, just forgets. The positive terminal to the positive terminal to the negative. Doesn't matter. And the wiper inputs. Let's connect it to a C10. Okay? Now, the potentiometer value, well, our exercise, that brightness will change that potentiometer resistance. Okay, Let's go now to first of all, we have, we are using dense, so pinMode 11 output. Now, we want to introduce a new integer as the AASHTO. When we use push button as digital inputs. And push button one. Let's see. Now. Let's say I will not say potentiometer, Let's say OK, LA. You can call it whatever you say, LED light and that light. Digital Analog. Now, what do we do? We want to panel it's been 11 in one value, in the value of analogWrite, we use analog. First of all, we introduced that. Then the value, the value is now, the exercise is not ready. Now we will face a problem, but I won't. To make it easier by going step-by-step. So you can know this and you can try to find what is the flow. So start simulation. Okay? I'm increasing edited bit plane is a bit. Okay? Let's see what is there is a problem. Okay, I should tell you something before. We said that the WM output pins here have a value from 0 to a hundred, two hundred fifty. And this value is 0 to 255. Okay? All right. Okay. We have something different for PWM. What is the value? Five volts is divided from 0 to 123, refers to 123 minutes. So the pins here, there are five volt as 123. Okay? Let's take a simple example. I'm giving here is signal of five-fourths. So the arginine reads as 123. It transfers it to the output as 123. But the maximum to the PWM output is 255. Something wrong. You can't do this. We want to transfer the 123 to 255 with the simplest tree. We have two methods. The first one is to do, okay, an equation between these two. We define them, et cetera, and you have an equation, we will not use this now, we may use it later on. Now we will use a function called map. So we will introduce a new integer. And we are mapping word that LED lights. From what to what? Led light is from 0 to 120. We want to transfer at 270. And we do the analog, right? Okay, I already wrote it. Okay, let me just write that equation. Okay? We have here five numbers from this. One is wrong to say. And these two is two. And here I have the range low to high. So usually it comes to 102300202, 165 into general case. We will take specific cases later on. And here what I am, what I am changing this function, I hope. Now let's go to that simulation. Now. We have 0 volts. And so I start increasing the voltage gradually and use the brightness of the LED until the maximum brightness. And now I'm decreasing at 130 million. We could not do in that while using the digital, because digital is either on or off. We don't have that engineers. So now I can increase the brightness, slightly decreased. I want to remove them up now and write it again. As I wrote it before. We had a little resistor problem here. If I start the simulation and look, what will happen, will not turn. Okay? So this is our small exercise concerning input and output. I think you are familiar with the concept now. You understood it. And you are going to do, let's say, more complicated exercises in the next videos. And the host. Before I end my video, I want to solve this, let's say in another way. Okay? So I will go here. I will say the analog, one hundred, ten hundred and twenty-three, which refers to 255. Okay? So if I have a reading here and I want to convert it to 255, I'll do the cross multiplication. Number times 255 over 123, right? So I will write this statement in the code. Okay? So let's say X equal LED light, which is the number here in the range 01023 times 255 over 123. And analogWrite x, I'm sure I will have the same output. Let's see. Okay. It is decreasing gradually until it is turned off. Okay? And now it is gradually until it turns. So I could hear this. Or we can replace with, let's say as we have, as you already wrote 55. So let's see what the problem. Yes, because we didn't wrote here. Okay. Start turned off, an increase gradually, turned on and degrees. So to solve the WM signal, we could use this. Let me go back, okay, this one, the statement. But from my side, as I prefer, I prefer to use in a simple task or problem like this one. Function. That function is easier. And it is, let's say, more important and accurate from this form. But in the later classes, we are obligated to do to use this statements sort of times. But now, for now, I prefer as my advice to use the map function. Goodbye and see you in the next video. 11. Relay: Hello guys. In this video, we'll learn about, as you see, approximately at each, learn about a new component. And after learning about each component alone, where we use author on it. Before I start, I want to make remember, what is a mechanical switch that we use to transfer, to transfer a high current, high voltage, low current, low voltage. So when I'm using, I can conclude a high current, high voltage from an Arduino. And I am not. So let's say I am not combining the high current with the Arduino. Burn it. There are two. How does it work? I have a coin here. This quote is connected to the Arduino. And this lets me, let's say turn on and off or switch circuits. This is why it has a single-pole double-throw. It may be this circuit or this circuit. It is not like single-pole, single-throw relay. So it is just on, oh, no, here I can turn this circuit. I can either search. Okay. And I have a normally closed abnormally, as you remember. This one is nor make rules. So when the coil is energized, this circuit is working and this one is normally open. So when the coil is energized, the circuit is, and when I get a signal here from the Arduino, so when this coil is energized, this circuit will work. Okay, I think everything is clear. Now I'm going to start our application. First of all, I will bring the art board. Okay, Great. Let me first connect the positive, negative, positive. Now. Okay. Now, let's come back around here. That's connected to a positive. I bring to you. What do you think? When do I use this and throw double pole? Why it has these two terminals are connected to one terminal. This is one for normally open, as you see, this is the normally open terminal. This is the normally closed terminal. Okay? And these two are for the coil connected to the army. What do I read? I read the statistics of the high voltage, high current. Okay, so these two corners, for an Ampere's 125 or 40 years, 24 volts. Okay? And that other sheet of you will always find, let's say, two data sheets. One for the high voltage, high current circuit and one for the low voltage, low current circuit, or four. Okay? This is a double row delay, okay? This is for one, for the avoided always has two terminals. And here I have 16 minutes appearing for Single Single Pole. And we have, let me get this one. We will not use it in this course at all. I'm just running. So I want you now to think, why should I use, as I used before, that transistor, it is the same for 3D. We then they're connecting water to an Arduino, as we said. So we connect to. And you prevent the Arduino and the motor to, first of all, let's connect the decoy. Okay, So the coin, it needs a signal from the Arduino. It is an on or off. So we will connect it to a digital pen. That doesn't matter. Okay, we didn't collect it. This is one responsible for the coil, so we'll connect it here. Let's put yellow and the other one connected to them. It doesn't matter. Now. I want to connect them. So how do I call it? Always, I use one for the negative and one folder. I usually use this one. I usually connect this one to connect and I connect the motor. Okay. Okay. I usually connect this one to the positive. Okay? Obviously not the positive of the Arduino. Is this one, this line through? No, it is false. I need a power supply, let's say a nine volt. Okay? I always, I always do a common ground. Now. I want that red line. I will connect this one to the positive. Okay? Then I will connect the motor to the normally open and I connect the ground, what? That common ground. So now I have a closed circuit. Let's see how I have before we agreed that the ground is common. So we don't have a problem with the negative concerning the positive. If the delay now is as it is now, the normally open here, we have the positive, okay, and nothing happens. I energize the call that oil by the Arduino. So the knob here, it is, normally, it is closed now. So I have a nine volt battery. I have here the circuit, it comes here at Enter. And it goes up to the motor, which go to the negatives. So it is a common ground and this is the close. All right? Okay, now let's go to the coding. Okay, let's first of all, how many inputs and outputs? So I have, I have one pin which has been to, and it is an output pin. Okay, I haven't mistake. So let's say digital know. Let's make it a delay before 1000 seconds. Okay? Digital drawing. And he lay 1000 milliseconds soda, I said seconds before, so it's three seconds. Okay, Are you use digital because it is an IEEE, use this example, a delay and then delay just to see that when the motor will turn up here, I will zoom in. Now. I'll start the simulation. Aki. After three seconds, then water should be turned on. Okay. Three seconds. Okay. So when the motor on, it is only when there is. Great. Okay. I think the now everything is clear. Now, we will do a little bit more challenging example. We will update our example. We will use the push button. So when I click the button, the motor will be, first of all, to put the proton, we need a resistor. We connect the resistor to the negative. Then we connect how the black to the positive. I think until now everything is cleared. And connecting wire from the opposite side of the negatives. Where okay, Let's now, Okay. Let's call it. Okay. Well, now, what do we want? We want that the motor turns on. And when does the promoter turns on? When the coil is energized and when the coil is energized, when pin two is high. So digital. Okay, great. Let's try our simulation. We have a problem. Let's see what the problem is. Push button one was not declared in this scope. Okay, we have that here, capital X, as I said before, while we may have some mistakes and we should correct them. Okay? Okay. Let's take all the sphere. Okay. Now I will press the push button, click and hold. The water is turned on. So this is how I'll use it. Now. I want more challenging exercise. It is, let's say an assignment or homework and exercise, I will not solve it in this video, I will do separately. And next video, I want you to make to run the motor and the push button. This is challenging exercise. Try to do it because it is not as much easy as you think, but you can't do it. And we are familiar with how to do it. Okay. Goodbye. See you in the next video. Thank you. 12. Exercise 3 Solution: Hello again guys. First of all, because before going to that direction, I will do more complicated exercise, or let's say I will solve the exercises step-by-step. First of all, I will give you another small, let's say I will put another push button here. I put the resistor. I'll connect this one to the positive I need. Let's see. And I will write the code that when I press this one, the multipliers, I press this one, the motor turns off. So I needed which can be used, I think. Okay, I need a new push button. Okay? As always. And here I will write F push. What will happen to turn off the motors? So quite an energized. All right. I think is good. Let's try it. Okay, Let me just put here on the left. We can put this one on here. Let's put it and it works. Great. Start simulation. Okay? And it turned on or turned off or turned on. Ok. Now let's go to the assigned task. In the exercise I give you, I don't need this second wash bottle. I want the same push button to turn on and off. What should I? First of all, I signed integers. Let's call it a. And I will see that at the beginning is equal to 0. I don't need this slide. So I will say, hi. So I have two conditions to turn on the water that is high. And when this equals 0 at the beginning of the simulation, what will happen if I press this button? So the water will be turned on? How can I tell the Arduino that my motor is on? Okay? I will say that a will be equal to one. So let's say a equals 0. Let's change a to mater state water. It is more homeless. And mortar state, motor state equals 0. And here I won't. Okay, let's read this. First of all, the motor state equals. So at the beginning of the simulation, the motor is turned off. If I press the push button and thermometer is all, go and turn on the motor and tell the Arduino that the motor is on how, by saying that motor state is equal to one. Now, I want to turn them off. What should I do? I want to press the push button and say, OK, and motors state equal, equal one. So to turn on the motor, I have two conditions. First one is to press the push button, and second one is that the motor is already turned on so I can turn off the water if it is already turned off. So the two conditions are, I'll click the plus button and the motor is turned off at what happens here. The motor. So the motor is, I want to tell the Arduino that your motor okay. I think it is clear to turn on the water. I should press the push button and it should be turned off and turn on the motor. I should press the push button and it should be turned on. Okay, I started this relation now, it will not work properly. I will add a line here. It is delay 500 milliseconds, which is 2.5th, and he is delayed 500 milliseconds. Why? Because the push button is in mechanical, Let's say mechanical switch is not fast enough. Million lines per second. So when I press it, the Arduino will enter this loop and this loop and this loop many times in the same, at the same time. And I will not get there. So this one is just to make that to overcome the mechanical problems. Okay, I will start now the simulation, I hope everything is working well. Okay, let's zoom in here and see what would happen. Okay? I press OK, hit OK. Now, this one here is here and the circuit is closed here. Okay, I will press it again. Okay. Aha, we have abroad. It turns on and off alone. Let's see what is that role? Okay. Let's increase the delay here to 1 second. Okay, let's say 1.5 second. I think the code will score. We are always talking about mechanical failures and problems. Okay, it is turned on. Oh, okay, let's see what is the problem. Okay. So I'll just increase all about mechanical. Okay. Now I will turn off trying the same push button. I press press the push button again, it will turn off. So this is the first time exercise. Thank you, and see you in the next video. 13. Relays vs Transistors: Hello guys. As you know in the previous video, I talked about three days and solve the exercise above them. And at the beginning of the course, I talked about transistors. So normally you should ask yourself, these transistors have to use a transistor. In this video, I'll talk about the advantages and disadvantages. And I will give you where and when to use each one of them. First of all, it has many advantages. I will say three or four of the most important. Now he is able to carry high voltage and high current law. So it has a wider range of usage circuits and high current and voltage service. Also, it has a high mechanical, structural reality. So if you are using physics lab or payments that let's say near the spectacle to the electromagnetic waves released by these, let's say experiments. So you can use it safely in noisy and external. The external magnetic also relays cost-effective and you can't find them. I will talk about that is advantages of really are slower than other types of readings as transistors, BJT. So you can't use it when using a PWM. You can use it when using switch circuit, but you can use it. Why using a PWM? Also, it has a larger package size size. So really are used when you are, let's say pig circuits in shape and size. But turning on and off Live, which is very small circuit, very nearly half of the whole circuit. Also electromechanical relays that to have a shorter life because there is a mechanical switch. There is when and when there is a mechanical switch, there is, let's say, some proponents will go wrong, it needs some maintenance. So as a summary, we know that we can use relays in TVs, refrigerators, renters, or camera systems, et cetera. So let's say appliance and big circuits. Okay. What about transistors? Transistors has many advantages over days. To a few of them. First of all, transistors, switching delays. So, and our sign-in looked at its height operation. So we can use transistors. All we should use transistors with PWM signal. There is no physical contexts, mean plus four. So you can use transistors in places where agile explosion or some explosion materials or circuits where there is something that may often fire, so there is no physical contact. So most working, really, sorry, transistors have increased lifetime. And because there is no mechanical switch, as I said before, and they are much smaller than the energy carriers. So it can be used in small, small, small surface. Okay? Imagine with all this one, more wine for no, use a transistor. Small us. Concerning the disadvantages of transistors, they have a high cost because they are much smaller, much faster, so they are costly. And they are, let's say the contact resistance too much or generate too much heat. And sometimes it needs to be used with a fan. So this was it. Somebody about the difference between leaders and transistor? One? This one, this one. Okay, so everything now is explained here. Hope you enjoyed this small video with much formations, much important information to know when we should use this part or this one. Thank you. 14. Breathing Effect LED: This video. Something beautiful as this small exercise independent piece of spice. Yeah. And why? What is given to graduate? So I directly to them, I know I want to turn on graduate. And every time every time we do that, I will update it and make it more or less hot. Okay, let's let's begin. First. Turn on graduate. So first of all, how many pen, pencil I'm using? I'm using 10, 10, 11, 11, 11. Great. Now, as you know, I will write this 1. First. We need an arrow. What is value? Value is something that is increasing gradually. And let's call this x. Okay? How can I get an increase this before, in this course before? So I will use because there are any, let's say number. So n equals 0. So x starts from 0. It goes to how much? A 100. And then, okay. And then I learned that each simulation, and we couldn't very well. I will do some moments to make this value here. That's why every time it increases. Okay, let's go to because this is the end. What is that process that is happening here? X is equal to 0. So at the beginning it is increasing 1, 2, 3, 4, 5, 6, 7, 365. Then the hole is repeated. So 0, 1, 2, 3, 4. Until now. Now, let's add a bit for this. I want that increases gradually. Gradually. So I want it to. What should we do? Let's see. Okay, Now the final value is 265. So what do you think of doing? A second for loop? Okay, where we begin from 265 and go to 0. Let's try it again. Another variable, Y. What is Y? Y is a 165. Y greater than or equal to 0. Y equal 1, y is decreasing and increasing. So to a 100, 264, two hundred, one hundred, sixty one hundred, etc. And now I need another 11. Y. Here is just, we're just giving an example and a 100 milliseconds. Why not? Let's see what would happen. Then at brightness. Wait until the maximum 100. It arrives to the maximum. Then what happened? Started decreasing, decreasing. K greater than the quote is repeated. So now I have an increasing. Then decreasing routes. We call this exercise is the same as a human, is increasing, decreasing and taking out. Okay, so great. Now we will add some, let's say some spice to the exam. How the push button and that the Earth does not, does not start. Just at the push button is pressed. So now we need to connect a push button. I need another. This one is thread. I take from the negative side, let's say to pin 13. Okay, great. Let's see now. And now, N equals 13, okay? This process will start just if I press the push button. Obviously, what do you think? I need an if statement? Bush, land, brackets, brackets. So I put all the processes that let's see what will happen. Nothing is happening. I press push button. So that started going up as broad as then going down. So all that process is done as we now know why. Because what is controlling the process is the Pashto. So this is how I stopped that infinitely repeating loop simulation. And we will update the exercise was to push buttons. When I press the first one, it goes. Okay, let's start to increase the brightness gradually. And when I press the second one, okay, Let's start. Let's see what we will do. So first of all, we have another five and we have n digits. Hi, Just this one would have. So I close the brackets here. I want as a second if statement. Let's see. Okay. Now I will press the plus button. Just I'm waiting for Process 0, 0, 0. Let's see now. Start simulation. Okay, great. Okay, it started increasing. Started increasing. Okay. Now we will press the second button. It started decreasing. So I have that breathing affect LED brightness, controlled by two. This is our video. Here. This is our exercise. You can add as many layers as you want, as many push buttons. You can use a potentiometer. Anything to add, to add more to this exercise. Thank you for your time. See you in the next video and goodbye. 15. LCD: Learned about something completely new. First of all, search for this one. This one. Then this is 16 times. It is built-in. In the thinker got all these connections. So you are not responsible actions, right? And now I will tell you what. This is. What does the columns and rows, three columns and rows. And you can display anything here as numbers or letters. We will use later on in the exercises, let's say to display a temperature. So we have it that purchase. And we want to display it so we can display alerts for our temperature. So now you want to learn about next exam. Let's go for that. When you put this one because you can read them. The whole. First of all, we include the library. If you have a greater knowledge and C plus plus language, you know what does include the library? If you don't have any prior knowledge, we won't need. Now, just know that when you want to use this LCD, you should save this. And now we have this. And here we have mentioned that we are connecting these two ends to the pens. 11, 5, 4, 3, 2. And then we go to the void set up. We should draw it as we are varying. The art that you are connecting. Or two is 16 columns and two rows. And we have LCD. So the first statement is, each time you want. And you mentioned What do you always, when you use this? In this way along, it would be printed on the first line. You can run more than, let's say character. Let's count these obvious factor 7, 8, 9, 10, 11. More than 16 because the maximum of that. Let's see something else. And then we have two nodes. So what do we put? We put the cursor. What does this mean? Does the LCD to jump in on that? Say like the enter in your table, you go down a line. It is, you are tiny. Arduino to panda as if you could jump and start writing. Now, as we said, every time we want to display something that we should use the SED doctrine. Now, why we use parenthesis over 1000. I will show you now. Okay, hello world. Now it will update. Okay? So it is fast here. So this is just the Arduino to count. Okay, So we can count 45678910. Hello. How are you? Okay. So now we know how to ride on the first line. And second one is the job of this, let's say potentiometer here. It controls the brightness of that. Okay? So, and then we increase. Look now are starting to see it. Right there. Now I want to have a positive comment and Helloworld. Okay, Let's have a look. And let's say, let's say volume of thousands as well. All right. Let's see what happen. Yes. So 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, we had more than 16 characters split. So what did I see now on the audio? That pattern, which is 16? Let's stop this video now and do a holistic exercise. Let's say that the Harney or as referring to attempt sensor and the temperature is above, let's say 30. There is an alert on the LCD. Let's first of all, let's say greater than 30. How many characters? 6, 7, 8, 9, 10, 11. Okay? So if my characters, so let's say greater than one. All right, Let's see what we have over. Let's let's add a second. Let's begin. Just to trap. Just to drag. Let's see what would happen. Okay, It's a horny with increasing. Once you see the alert is the first time it's updated directed because the simulation very fast now, okay, 30, 31, 32. Over. Now, we know how to use how to change the comments here. This is our video, ends here, but the usage of the SED will not add here, we'll see it. Maybe that project at the end of this course. You have inactive as temperature sensor and weather. Temperature is 0. Also we can see it in the advanced course. Thank you for everyone. I hope you enjoyed this session. See you in the next session. 16. Keypad: Hello guys. In this video, what is a key fat? It is connected to an odd. And then when we press any button on the keypad has here we have numbers from 0 to nine. We have four letters and symbols. And respond to it as our coding. So firstly, how does it keep at work when I press number one, What does it happen? The keypad to the Arduino by two pens, which are X1 and Y1. Okay? So when I press the R, two signals from X1, Y1, if I press F5 for Arduino, receives signals from x, y to so he button here, and we know each one of them is a push button. Just click it. And push buttons. Flush button give signal to the Arduino pins. So these two are specific to this number. So let's say six, Y3, Y4. And now I will tell you, how can we benefit from using it. We know that the Arduino has 13 prints, digital input, output pins of a, etc. So if we connect push buttons to these events, the maximum number of push buttons 13. Now, by using this one, actually, I can get signals. Let's be 1, 2, 3, 4, and 4 times 4. Or let's see 16 push buttons. My connecting to the Arduino, as you see, orphans, orphans. So by connecting eight bins, I have. This is the major usage of LCD. Has a keypad. Okay. Now let's go to the quick add and see how does it work. Okay. The keypad connected to Arduino, as you, first of all, this circuit is built and this gold is built-in, okay? You do not need to connect anything or to write anything. Okay? As we see, we have here eight pins connected to eight months. We do not need power ground. Because as I said before, these are just push buttons and this watch photons are connected in any way. So we could get 16 output from what? From maintenance. As you see we have here at 0, 1, 2, 3, 4, et cetera, column 1, 2, 3, 4 connected to the pins. All right, let's go through the code. First of all, we include that library. We are not responsible for any of these. All of these are found on Google or on dedicate God. So we are not responsible of these. Let's see, we have here that we have here, how many rows and columns we have 44. The matrix as it is here, 1234843123456789. Okay? Symbol zeros, right? So this is for matrix, as I understand it. Okay? We have here that opens and column here. Let's see. That opens one to four are connected from six to 96789. Protons opens. Konnen pins are connected 1, 2, 3, 4 from 2 to, let's see. This one is for row columns here. Okay? 2, 3, 4, 5 columns. Okay? Here we go again. Now, these are some coding, okay? Who was responsible for this? Now one who is learning coding, Okay? Who is learning Java? As interested in Arduino are not responsible for this. This is not our job. Now we have cdn dot begin. Why? Because we want to see the output. Okay, Avoid do here. We have the whole responsibly when we press any key and you have. Okay, now let's start the simulation. Let's go to Syria, monitored and lead. I will press one. Okay. So the Arduino understand that I addressed one. Every time I press the button. The Arduino understand it. And as I said before, when I press one on Rina understand X1Y1 when I press R to understand. So when I press the Arduino receives a signal on x and y. So let's say x three, column three, and y three is row three. So signal is good. I'm okay. Pin seven. And, and so when an Arduino pins have an N3, so this is an OK. And now I can use this to make some code. I can connect the output. Here. I can connect your module where I press 1, 2, 3 is a motor works. Okay? This is the keypad. We will not have an exercise over this topic because we will do it later on. Just, you should know that we can use it. We can have 16 inputs from eight pins. And thank you. See you in the next video. 17. Ultra Sonic Sensor: Ultrasonic sensors. First of all, these sensors, as you see in all Ultrasonic sensors. And let's go into ultrasonic sensors. We have o and the transmitter. Then that is the ultrasonic sensor, most wavelengths, okay? And if he knows the wavelength, now we've known it hits an object, then it goes back. So the other center, the time that has passed point going. So now he has lambda and then he can get, and now he knows that distance between the ultrasonic and, and by using ultrasonic, we can calculate this or speed. We get that d over t naught. Okay? So now I'll just make a simple comparison. Always the ultrasonic we have limited and as always, a mike transmitter. Like them, like who, who is very good speaker, who gives, who was assassinated. We can also use ultrasonic sensor to detect the speed of the ultrasonic sensor. To detect this is overstated would get this ticket. Now, when I cut, I want to give you some tips and some, let's say, How should I know? I should use and which one is between all of these? As you know, we always go to data sheet and we say we know what is the usage of our sonic sensor. And then we use it or chosen to use it as an ultrasonic sensor module. For a random ultrasonic sensor. This is the definition of the sensor. As you see it. Working voltage, DC fivefold. We can cut it and the whole globe so this suitable to use. Okay. Working frequency max four meters to centimeters. If I haven't project what I need to calculate a distance, four meters, I should not use this one. Okay. Maximum range is four meters. Okay. So I see or I check the data sheet, I checked my program, my project, and then I choose that. I want to share with you an experience I had myself when I was working with FLL legally, we want I use this ultrasonic sensor on that. Oh, it is ultrasonic sensor stores. Okay, let's see here some specifications. It is an ultrasonic sensor. It generates soundwaves at risk there equals et cetera. We know these information. Okay? The measured distance is between 1250 or 100 inches. So I was working on a robot on a table with two meters long and approximately 75 meters wide. This sensor was sufficient on my robot for my users. Two 150 centimeters, which is more than 202 meters, and it is greater than 75 centimeters. So this sensor was suitable for my project. Okay. Let's check other features. Okay. It is accurate plus or minus one centimeters as auto ID built into every three software. So I do not need to install anything to use it with V3, etc. So this is how you choose your ultrasonic, and this is how you know which one to use. Now, let's go to Tinkercad. We will go here, Arduino, We will go down. Okay? Now we go to our code. And as always, these quotes are not responsible. We are interested in art and not a code of the amino to get the signal from an ultrasonic sense. First of all, let's go here we have treatments for the ultrasonic signal. Okay? Some ultrasonic have now acquired required to do, but here, which are emitted. But here, both are connected into one pen, which is connected to the digital input output. If we have two glands, each one I learn and now we have began just to see the values. What is the alternative here we have the ultrasonic centimeter and we have an, we have here some conversions. Now we will see, okay. So we can control the distance. If we go here, is two inches or 254 centimeters here, for 87 centimeters, inches or centimeters. So this is how the ultrasonic. Ok. Now you can detect if we are out of range that is arranged for every ultrasonic. Now or another we are. And whatever the ultrasonic is giving the same answer, which is wrong. Wrong because it's not in that age should be to get that correct. Yes. Okay. As you see, so this is how the ultrasonic simulation also, I will not give exercise over this topic because we'll get an exercise later on. And let see, we will take it in the final project hopefully. And goodbye. See you in the next video. Bye bye. 18. Servo Motor: Today, we will talk about, first of all, let me show yourself. As you see, we have different types of shapes, sizes. Okay. Now let's go and see how does it help. First of all, we should know that, as I said, is our promoter can correct the pulse is given. What is the difference between good and evil? It was this. What is it angled? So it has three sets. We have water, we should know that. How does it we have a command. That command is sent to a driver, okay, that drive it, transform that the angle in the command turn 180 degrees, 100 degrees. Now, we have a driver that transform the 180, which is an angle. Here we will see what is a pause. Then we have the so that the driver is between the controller. And we have here, in our case, that is the Arduino from water. Water from the water. That translates, let's say it is a translation or a conversion from anger to pass. And we have now the US, what is the deposits? So the symbol. He understands this time. So if I want is I should send a one millisecond pulse every 20 milliseconds. If I want 90 degrees, I should send 100 millisecond. Pause. Every 20 milliseconds. I want 180 degrees and etc. So federal converts the angle into this bit of time between the end of the polymer. So psychomotor, understand. Okay, now let's go and see where do we use? Where do we use it? Usually, water is used with high precision movement. Let's say an example at all. So this robot arm, I want that this robot arm has a terrible mater. Mater here and one here because this is 30, 36, 38. So I need high precision, high precision movement of degrees. So one value. So I use it. I have another example. Let's say, you know, what is the CNC machine? Is a machine. Let's see an example. Brand. Okay, if I have a table of what I have or I want to print the shape, so I put it in the machine. So I need not a high precision movement is very, very, very high precision movement. One degree can vary. You can, if you have, let's say. Okay, we are growing a person on table here. It's okay if I put the I here, okay? Everything. So I need very, very, very high precision movement. So as you look at this, okay, just throwing how I use. Now, let's go and start recording. Okay, guys, now, now the ground power that we can connect directly to the RFP, it does not have a high current. So we can connect it without using transistor, other components. So now we have the ground connected here. We have the power. So this is a five volt. Okay? And we have the signal. And the signal is obviously connected to a PWM pin. Let's say the height or the sphere. And now let's go. Okay, let's talk. First of all, we want to include the library of the thermal model so the amino understands what we are using. So hashtag, this is the name of that. This is how we call it. Okay, we are calling it includes water. And now I want to give my water so we run. What is the name? Let's call it myself. Okay. Sandoval Recording. Let's go now to the whole setup. Okay? Now I want to tell in which or at which I am connecting it as like when we say digital input, output, etc. So my sample would have been, okay, we have here. Okay, It is the third. We'll look at that. And I'm on the CDN. But again, what is our example here? What we will start giving the an angle, let's say 100. And I want the circle to turn 180. If I write here, I want this alert exercise now, Serial.begin 9600. Okay? Now I want to start is available. This is available. Okay. Now brackets and you know this, but we used it before. Sorry, I want to skip this line. If cilia that are available, what will happen? That first of all, I want to and said, okay, now, used to lie. But when I write this set of code that are the Arduino characters, not numbers, but now I want numbers. I will say turn 180 degrees, 90 degrees, not ABC as we made before we use it, etc. And here, let's see language and exit data. So now I need numbers, not characters. So I will erase and I will parse. And the I and n is capital. So that equals force in brackets. And now I will say my name of my myCircle, the right one. Let's see if our code is working properly. Here we have the mistake. Let's say what is our mistake? Here? We must. Now, I think everything's great. Why my third month, I will tell you. First of all, let me fix. It will go to 50 degrees, 180 to 180 degrees. I'm writing, let's say a $0.160. It will turn to a 100. So to prevent what happened at the beginning, I will add here in the void setup, okay. So dry. You know, the onset is repeated just one time at the beginning of that. So now I'm telling that every time the cell will goes to 0 when the beginning, and then the work begins. So it has 0, let's say 40 degrees. Okay? It goes to 40 degrees, let's say 140. And now, Okay, I will write a number above 100 to a 125. Sorry, I will go to 200 and see what will happen. The sample had stopped on 180. Why? Because this sample data, this woman has limit range between 0180 degrees. Then if we use this one, Microsoft has limited range between 0 and 180 degrees. So I give it a hundred and eighty. One hundred and eighty, try it again. And it goes to 180. Was everything about several monitors. Now, we will go. And have small example. Let's say we have connected the central motor, do that all of our house. And I won't be opened automatically when I press. Okay, Let's go and try doing this exercise. First of all, I needed a push button. Let's first of all the variables. So our work is and this is our guess. I need, I need ooh, that's connected to the negative, the opposite side to the positive. I take the signal. For this one. I'm I supposed to pet a dog and a PWM pin. I'm not obligated digital copy. So now let's start creating our book. We don't need available. Okay? Now, first of all, let us introduce our new plan, which is the which can we use here than 12? Well, right? And push button. As you remember, that. Now is the push button is pressed, so push button, I will open the brackets. And now, what do you want to happen? Let's say how many degrees to open a door, smoke 180, let's say 120 days. Okay. Yeah. So over 100. So if the push button is high, I need one. We had a 100. Okay, let's see if our code works or we have, okay, What is that mistake? This should be okay. Let's see what would happen when we press the push button. That will allow high door. That opened my eyes. Now, let's add some spice to the example. Let's say we want, okay, no, I will give you this as an exercise and I will do that. Next. I want to lead one lead and one that lead. When the door is closed, like red LED turn on. And when the door is open, that door is closed. Circle 0 degrees. When the door is open, circles 160 degrees. And I want to see you in the next video with the solution of this exercise. Bye-bye. 19. Exercise 4 Solution: First, let's go and see them as the opposite. And now it's at now. Now, let's go and connect. Then 220. And let's see. Now. So now I want to open that. So digital rights, which one is high? At the same time, I want the red LED to be turned off. So did I let me anymore? What was just we did all this just here to write the name of the lab without going back to the old. Now, I want my digital. Alright. Let me turn on red LED. So digitalWrite LED. We shall return. Did you? And we will pass. Put. Any problem? No. Okay. First push button, that door is open. Let's close that second flush button. That door is closed and vetted. Lead our program. If we start simulation of that, we can add the void setup. At the beginning. The elbow is close and outlet is. So digital rights. Head. All right. Let's start the simulation. Okay, at the beginning, that as well. Okay. I want to add something. Because we are nearly at the end of our course. Later on, we will have that project solution. Project and the project solution, right? I think our goal, we should add somebody more or less an hour. Okay. Okay. We should add up you can. Now, as we go through that example concerning that said, I am trying to give as much as I can because this usage of servomotor vary quite widely used and is very, very important. Now, go to a blank page. Okay, Let's start from the beginning. Now. We will draw the circle mater. Let's suppose all we can do something. Okay? Then pi and 3. So this one, let's see. I guess the analogue input we have now. And we want to write the core of the cell. So we started hashtag. So I want to say, okay, we'll keep it. Okay, then we will go here. I want my iPad. What did we connect it? Okay, We connected to three. Right? Now. Let's go and see what we have from the potentiometer. So let's say n. What should we call it? Let's call it angle, angle. Angle. Okay? Now, we want to map from 0 to 180 degrees. I explained before the analog 0, 1, 10, 23. Hello. Math. What we will map 1 thousand, right? And now my pen will work maybe, yes. So cerebral edema, because that potential. Now we will go and fetch as a potentiometer as we have this dense. So the symbol goes to 90 degrees. Now let's see. And I want, this starts from 0. Actually want and should change a positive and negative here. Okay? I should connect this one to the positive. And this one to this one. Okay, This one is here. Now, as far as I go from here, That's great. Now, at the end of our video, this was our exercise. This is our quote, a create, very beautiful output. Now know how to connect, how to control it, and see you in the next video. Thank you. 20. Project: Hi guys. Let's say this is the last video. This project force to approximately every component of what we learned. We included them all. That transistor, that potentiometer, then add water. Okay. So lets say. And now I will tell you, this circuit should do so. Okay? So you try to solve it. And so now you copy this circuit. Do you think you're fat? You're saying? Okay, and what is the output of this? First of all, this should be displayed the point of, let's say from 12 hour 2029. Okay, so 23, 24, 25. This time will be increasing gradually. 12, 13, 14 alone. Do not. There is not any intervention from your side. Okay? So it's like this. What will happen here is that plants are few house, okay? So let's say this house, this mortar represents all their plans. Represents all, let's say, the outside of your house. And this represents all the lighting of your house. What would happen? So when the hour to hour and see. Okay. Then water is turned on and he said he wanted is at 150 degrees and also between 36. So between 12 and 66 VM is our all their funds, our own enter at 160 degree, which means that as our own because sunlight is very much heat and the water 160 degrees outside door is open during the day, you can keep your goal faster 16 or 18 hours. What will be displayed here is 18 hours. Their fans will be turned off because we are not be friends anymore. And that's servomotor goes back to 0 degree, which is the closing of federal laws, which represent all the writings of the house. This LED light is controlled manually, so it doesn't have any relation with you. Manually, with this potential. Okay? This is used because we could not connect directly to the Arduino and put that water could be conducted by x. I will start the simulation. So it is 12 hour. Now, all the hands of the house are turned on and that all is 0. Now, as you see the hours, okay, now we'll go to 16, etc. While the hour is coming, we will see here. Okay, Let's see. We increase gradually, okay. So now and everything will be OK. Now, when it exceeds six PM or 80 machine hours approximately, define turns off. Okay. And now we'll start from the beginning from 12 hour. At this time I want you to see this. Okay? Now, if we decrease, it decreases gradually as you see, then go here. So we are controlling that manually with that potential no matter what the time is. Easy. Okay? So this is the logic you should do your video and try to solve it. And you. Thank you and goodbye. X2 and X3. 21. Project Solution: Now, first of all, let's go and bring the same time. At the same time. So I will connect up as positive. Size. Doesn't matter. Now I want to thank ground and I will go and start them. And now these objects, now I won't. So we will start until 23, which is 11. Sorry. So how will this point? So we said this, when we want something to be, gradually, I use blue for fine. Sorry, no. Start time from 12, smaller than or equal to 24. I open the brackets and all my work for the brackets. Now, I want the NCDs. Let's see here. Okay? And I and II here. So I will try and avoid evil eye. I do not want 1230405060 seconds between each hour an hour. And then I will write new code, which is as this. Just remove it. Now. Let's test our code every time we add something. So if you have a problem, we corrected sorry, 1314. Oh, great. So my time is working properly. This is my clock now. Now I have done that look. Okay. Then next step, we want many time, one and time. And smaller or equal to, let's say. Yes. Then x prime is greater or equal to 0 and smaller or equal to our PM. Okay, I will open and close brackets. And the last time interval is greater than 18 and smaller or equal to 24. And this is the last time as a mater separate motor, sorry, servomotor to represent the LED lights that I think of the house. Let's start. Okay. I will put it here. I need I will put it here. Let's rotate it. Okay. Great. For them. It did for a transistor. Let's get that out. Okay. Do you want to connect them water? Okay. Let's go let's go for it. And that's how we put it. Okay, let's start to connect them stepwise. First of all, we know the base of that is connected to a digital portal. So I will connect it. I will change ordered. Let's not use this one. So we'll do all our application. Then. The collector is usually connected to the negative side of the motor. Okay? Obviously black. I think. Then the positive side of the motor is connected to the nine volt battery. And the amateur has a common ground. And we connect the negative. So this is our graph. Right? Now. We connect the cell. So the power positive. Now this is the ground and the signal. Let's see. Pwm. Okay. Let's change the color of this one of the signal. Let's go ahead now and do some coding before adding. Let's first of all, we want to use Panthers in 13 is what? It is. You are giving more than 10, then more. Great. Now, let's start coding. So the time is between 12 and 15. We said that the modulus represents and in the house. So at this time, the sun is at the middle of the sky and fans to work on high-speed. So now we want that tends to be on time. Okay? Let's continue. Let's name these pins. Okay? And right here I will add fans. So now what I want digit, after six PM, the sun starts to go down. So I need to turn off the digital fans. Let's test our audience. Okay. So now we have two seconds, three seconds. That's why at the fans and the fans aren't. Okay. So this part of my goal working properly. Let's go now and do that. Close or closing of that. Okay. We do not want that all to be closed. It can be open, so there's no motor must be turned to 150 degrees. So first of all, we should include the library. Okay, hashtag, include. Now, we will call it my circle. Now. My pen to Pennzoil. I said, now, how many degrees? A 160 degrees, I think. Great. My Drive. And one hundred and one hundred sixty degrees. And after, which has to be closed automatically. Let's see what will happen. Now. Everything is okay concerning. So what, Why is that all? There is a problem. And this part, let's see what it is. As you see in the code, you do not have anything wrong. But what is the connection here? This who do not connect to the fence? I need to connect the wires directly to it. So it is not the same as it doesn't enter. So I connected. And let's now test our simulation. Okay, that goes directly to 90 degrees and avoids have always, I don't, I won't die. So it begins from 0 degrees. Let's see. Now. Okay. So the plants are turned on and that is four, which is six PM or approximately. And we will see what will happen. So after 18 our clothes and they found would be turned on as you see it. Now. Okay, that all clauses and that pan turn off. I like to build our code in this way. We are not. Professionals, cannot do that project from the first time, right? It all at Exeter. So we should build our code step by step. Okay? Now, the last part of our project is to control the lives of the house, okay? With so many, without any interference of that time. So we want to control their lives, man, with a potential. Let's, first of all, we will put that actually represents all the lights in the house. And I want it potentiometer. I will put a terminal along here. And this one. And I get a 120 thousand parts and connected PWM signal. Okay? Now let's, first of all, we have. So let's try the first one. And then now output. Now my code is out of the for loop. Okay? So let's first LED brightness. What? Led brightness? Analog. Now. Let's say lands 1022000. Now, let's see how it works properly. Concerning the syntax is right or wrong. Let's see. There is something wrong. Let's see what it is. We stopped that. And now this set of code, these three lines are executed one time. Then the Arduino enter the for loop. So it doesn't really exist anymore until it exits the loop. So we want to copy this set of words and we would want to write it first of all, inside. Then inside. Ensure that it is needed every time. Let's see what would happen. Okay? So first of all, the motor is on emphasis on and then it is working. Okay. It eases as I increases and decreases as you see here. As I then go down to the maximum, it turns off. Let's go up to the maximum. That turns on. Let's go. Now. It will decrease gradually as you see it. Then turns off. And now this 24 hour process begins from the beginning. Let's turn that off. Now. Want to turn the brightness. Let's go to full brightness now. Because our full brightness, and we can turn off when we stop the simulation. So thank you for your time. This is the last video of our course. Hopefully you understood everything. If you have any question, you can ask me. Why direct messaging me on Skillshare. See you guys. And as you see, we use all of the components. We learned approximately all of them in our project. So see you later on. Thank you for your time.