introduction to arduino
It looks like this. You can see it looks a lot like the breadboard. It has many holes on this like in the breadboard. These are called as ports. These ports can be controlled by writing. Some simple commands. I will show you some simple commands. Now i am using arduino uno from intel. It is called as edison here is a simple program to blink the inbuilt led – and this is the arduino ide, the play or or arduino coding platform, where you can code the command, where you can code the arduino board. If you type commands here, the arduino board will carry them out, but you should not type ordinary commands. Just like run like that led on led off. You cannot just type like that. It follows a particular follows. A particular lines of it follows a particular script that looks like c, but it is known as the arduino programming language and let us just learn about the five buttons here. They are verify upload, new, open and save in the verify command. You can just check your code before sending it to the arduino board example. Uh. I will just type the board will not understand the commands. There is no such word as like this and verify this. Yes, i knew this would happen. It says invalid suffix on integer constant, like this it this uh. It shows an error message when there is a wrong code and let us just go to the upload button you, the upload button, will send the commands through the electric wires, will send the electric signals to the electric wires.
The commands will be sent to the board and the board will carry them out and uh. We will just see the upload and verify commands when we are. We have already typed the code and we are running it new. When you click on new, it will just create a new project like the like this one. You can just type any code here and you can just make another code, and this is the open button. You can open any files. So when we click on this, it will show this menu open blink fade in build blinker libraries and like that there are many files. You can open them, and these are the example. Files analog read serial bare minimum blink digital like that, and let us go to this open. It will open this file explorer window. Since i am in the traffic folder, it will show the traffic.ino file. You just have to click on that and click on open, but i will cancel because we will not open the file right now, and this is the save option. After clicking on that, okay, it will save the uh. I have already given a name for this test file, so i will show you uh saving method, and it shows like this. Let us just in this has tests. If you save this, that name s is given and let us go to the arduino coding area and learn about the void, setup and void. Loop void setup, put your setup code here to run once if you want to set up the leds and declare the leds as inputs or outputs.
You can just go here and declare them and we will just use the one now for the blinking led circuit that we are doing now, pin mode and a bracket like this. Let us just declare the led that is built in. Why built in? Because we have not yet learned about the ports that are on the arduino board and we will uh just uh use the led that is built in onto the arduino board and use that led that is built in is declared as an output. That means you, you have to send electricity to it that will not send electricity to you and a semicolon. Remember if you dont put a semicolon at the end of each line, then it will show the it will show an error message. Even if you dont put semicolon to at least one line, it will still show you the error message expected uh semicolon at the end of this code and like that and the pin mode command is done and let us go into the void loop. That put your main code here to run repeatedly after you set up the code, you have uh. This is the area where you uh, where you put your main code that will uh run repeatedly. That will run forever until you switch off the laptop or computer or stop the code. Let us just type the commands to blink the inbuilt led digital light. This states the led as on or off, if you put it as led, it is built in okay.
So yes, here it is only d that is built in should be uh should be on. So let us put high or more high means it will switch the led on. If you put low, then it will switch the led off and let us just put the delay command that delays the code for the time given by you, for example, if i put 1000 here, it will just keep the led on for one. Second, how i have written 1000 here, how will the led be on for just one second? That is because this, though this work is done by milliseconds, not seconds, and let us just write a comment to write a comment, just put the slash two times and start writing a comment. One thousand milli seconds is equal to one second, like that. If you want to give guidance to the people who see your code, you have to just write a comment like this, and there is another way of writing comments. I will show the way of the other way of writing comments in the next video and we will put another digital write command now that states the led as off low. I will just put low because the led has to be switched off and another delay command. Let us just copy this because we are doing the same command once again and uh. The first ever arduino code has been done and it is time to send or click on the upload command.
First, we have to check if there are any errors in the code. First, we will have to check if semicolons are put at the every at the end of each line. Semicolon has to be put, semicolon has been put. Yes, each line has been uh given with a semicolon and time to run it. Once i run it, you will be able to see the led. This led is the led blinking. I will point out the led with this pencil because there are so many leds on, because there are three leds on the arduino board. Yes, it is compiling the sketch and the transfer is complete. That means it has read the code and the code has been correct and the electrical signals have been sent to the board and the board is controlling the led blink that is with, and let us see how this code works, pin mode led built in comma output. It is stating the led that is built in as an output. If you state it as an input, nothing will happen because uh it will start taking electricity from that it. It has no electricity at all and nothing will happen and the setup has been completed. Let us go into the void loop, digital right, led that is built in high um. That means the led will will switch on for one second, because delay 1000 command is used and 1000 milliseconds is one. Second digital write command led built in command low.
The led that is built in should be low or you switch off for the and the delay command here will keep the led off for one second and because it is in a void loop. Its the same thing will continue once again. Why is that? Thats? Because we we have put them in a loop switch on switch off switch on switch off. You can see in the you can see in the video that is on the top of the screen. The led is blinking on and off, and on and off and on and off like that, and that is how the arduino works. It is simple to code the inbuilt led than the ports, as you saw that one was the intel edition chip that works like it is connected to the board provided by intel. This looks like this, so our video is completed and let us just see what we will do. The second video i will explain the ports of the arduino uno board. They are, there are three groups of ports, they are login power and digital. You will learn more about them in the next video. As i said, we will explain the circuit diagram of the next of the first project of arduino that we are doing, and i will just show the circuit diagram of the project and i will explain the components required for our new project and we will also learn About uh, a new car, a new command thing like a that is a function.
It is also called a method and from writing functions makes our code easier.