1 00:00:02,669 --> 00:00:05,549 We are going to create our first program. 2 00:00:06,549 --> 00:00:09,029 For this we are going to create a new circuit. 3 00:00:14,789 --> 00:00:17,510 Let's drag and drop the Arduino one board. 4 00:00:21,969 --> 00:00:22,510 A LED. 5 00:00:26,760 --> 00:00:30,379 And a resistor that we will change its value to 330. 6 00:00:38,390 --> 00:00:40,070 Also we can turn it. 7 00:00:43,890 --> 00:00:46,049 And connect one end of the LED. 8 00:00:49,640 --> 00:00:50,380 To ground. 9 00:00:50,920 --> 00:00:51,340 Negative. 10 00:00:52,520 --> 00:00:56,799 And the other end of the LED to the resistor and pin number 7. 11 00:00:57,179 --> 00:01:14,120 The Arduino board has 14 digital pins, that can be configured as outputs or inputs, and 6 analog pins which are inputs. 12 00:01:18,260 --> 00:01:24,400 In addition the digital pins with the symbol of a wave, can also be used as analog. 13 00:01:27,930 --> 00:01:35,750 In addition we have this pin which is an earth pin, together with these 2 and 2 pins at 3, 3V and 5V. 14 00:01:35,750 --> 00:01:44,170 An Arduino program is made up of two distinct parts. 15 00:01:50,689 --> 00:02:03,290 The first is the void setup, where we must configure the pins we will use, whether outgoing or incoming. 16 00:02:03,870 --> 00:02:21,020 We will use the command pin mode the pin number, followed by the word output or input, depending on whether it is outgoing or incoming. 17 00:02:21,020 --> 00:02:25,599 The second part of the programs is known as 18 00:02:25,599 --> 00:02:29,080 Void loop or loop 19 00:02:29,080 --> 00:02:32,840 This is the area where we will write the commands 20 00:02:32,840 --> 00:02:37,479 That we want the components connected to the Arduino to run 21 00:02:37,479 --> 00:02:40,699 Among the most important orders are 22 00:02:40,699 --> 00:02:47,509 Digital write followed by the pin number and the words 23 00:02:47,509 --> 00:02:52,919 High and low 24 00:02:52,919 --> 00:02:58,599 High indicates that the pin is energized 25 00:02:58,599 --> 00:03:06,139 and low means that the current has been cut off another of the most commonly used commands is 26 00:03:06,139 --> 00:03:16,650 delay followed by the number that representing milliseconds and is used to generate a stop in 27 00:03:16,650 --> 00:03:23,990 the program or to delay the execution of the following instructions in the case that we want 28 00:03:23,990 --> 00:03:31,430 use one of the digital pins in an analog way we will have the command analog write 29 00:03:32,229 --> 00:03:39,750 with the number of the digital pin to be used as analog input followed by a number between 0 and 30 00:03:39,750 --> 00:03:52,629 255 once the circuit has been assembled with the electronic components we are going to write the 31 00:03:52,629 --> 00:03:58,710 programming that will enable us to that this led is switched on and off to do so click on the code 32 00:03:58,710 --> 00:04:04,550 button we move on to text and let's take advantage of this code which is the default code to write 33 00:04:04,550 --> 00:04:24,569 our program we are going to write the led flashing program in the void setup structure we will 34 00:04:24,569 --> 00:04:31,529 configure the pin through which current flows which is number seven in our circuit and in the 35 00:04:31,529 --> 00:04:36,649 void loop we are going to indicate to the program how to turn this pin on and off. 36 00:04:38,649 --> 00:04:45,769 In the digital write, we will write the pin number 7, and write high on the back, this causes current 37 00:04:45,769 --> 00:04:54,810 to flow through that pin. Then we will write delay 1000 milliseconds, for a delay to occur or to wait 38 00:04:54,810 --> 00:05:02,269 and keep that led lit. Now write again digita write. We will stop the current going out so 39 00:05:02,269 --> 00:05:18,339 write pin number 7 and low. Finishing write a delay of 1 second. We test the code. There we have it. 40 00:05:20,279 --> 00:05:25,040 I hope you enjoyed the exercise. See you soon.