1 00:00:00,270 --> 00:00:05,460 Hello and good morning 2 00:00:06,510 --> 00:00:07,890 today I am going to show you 3 00:00:07,890 --> 00:00:11,130 how a real arduino board works. Until 4 00:00:11,130 --> 00:00:13,770 now you've just been programming using a 5 00:00:13,770 --> 00:00:14,670 simulation 6 00:00:16,800 --> 00:00:18,840 but you can see I now have 7 00:00:18,840 --> 00:00:20,970 a real arduino board on the right 8 00:00:20,970 --> 00:00:22,230 side of your screen 9 00:00:24,690 --> 00:00:26,160 it looks similar to the one in 10 00:00:26,160 --> 00:00:27,060 the simulation 11 00:00:29,790 --> 00:00:31,740 here in the upper part we have 12 00:00:31,740 --> 00:00:33,750 the digital connections the same way you've 13 00:00:33,750 --> 00:00:36,930 been using and here we have a 14 00:00:36,930 --> 00:00:39,840 protoboard with three LED already connected 15 00:00:40,230 --> 00:00:41,640 yellow green and red 16 00:00:43,230 --> 00:00:45,090 each one is connected to its own 17 00:00:45,090 --> 00:00:46,950 wire and down here 18 00:00:48,300 --> 00:00:49,890 I have the ground connector 19 00:00:56,340 --> 00:00:58,680 and they are all connected to the 20 00:00:58,680 --> 00:00:59,490 arduino board 21 00:01:02,460 --> 00:01:05,220 so I can connect these three to 22 00:01:05,220 --> 00:01:10,350 connector numbers thirteen twelve and eleven and 23 00:01:10,350 --> 00:01:12,000 then the ground will close the circuit 24 00:01:12,780 --> 00:01:15,120 and the three other connectors will give 25 00:01:15,120 --> 00:01:17,400 or not energy to the protoboard 26 00:01:18,930 --> 00:01:20,610 so now we have everything we need 27 00:01:20,610 --> 00:01:21,630 for the real one 28 00:01:25,470 --> 00:01:27,690 now for the simulation we can connect 29 00:01:27,720 --> 00:01:30,450 everything the same way and I'm going 30 00:01:30,450 --> 00:01:31,410 to do it like this 31 00:01:34,590 --> 00:01:36,270 now I'm going to connect the three 32 00:01:36,270 --> 00:01:38,940 LED these from the library 33 00:01:42,030 --> 00:01:43,230 so click and drag 34 00:01:51,390 --> 00:01:53,190 and we can change the colors to 35 00:01:53,190 --> 00:01:53,700 yellow 36 00:01:56,820 --> 00:01:57,660 and green 37 00:01:59,280 --> 00:02:01,560 and then read and now we need 38 00:02:01,560 --> 00:02:04,440 the three resistors as well all with 39 00:02:04,440 --> 00:02:06,090 two hundred and twenty ohms 40 00:02:09,539 --> 00:02:11,460 and remember that these just get connected 41 00:02:11,460 --> 00:02:13,680 to the cathode or the straight side 42 00:02:13,680 --> 00:02:14,370 of the LED 43 00:02:26,280 --> 00:02:28,410 so now I'm going to connect the 44 00:02:28,410 --> 00:02:31,500 LED the first two thirteen is 45 00:02:31,500 --> 00:02:32,580 going to be the red one 46 00:02:35,460 --> 00:02:37,620 and the next will be the green 47 00:02:37,620 --> 00:02:38,760 one to twelve 48 00:02:39,870 --> 00:02:41,370 and then this one will be yellow 49 00:02:42,960 --> 00:02:44,280 it doesn't matter if they cross each 50 00:02:44,280 --> 00:02:46,380 other they're still connected with each one 51 00:02:46,380 --> 00:02:47,910 crossing above the previous one 52 00:02:49,500 --> 00:02:52,500 and also we will add the ground 53 00:02:52,530 --> 00:02:55,650 to this horizontal line black as always 54 00:03:00,690 --> 00:03:01,590 and then one here 55 00:03:06,330 --> 00:03:07,890 how about if i connect it in 56 00:03:07,890 --> 00:03:09,990 a different way just to see it 57 00:03:10,080 --> 00:03:13,740 more clearly so yellow is actually going 58 00:03:13,740 --> 00:03:14,550 to move here 59 00:03:16,380 --> 00:03:18,930 and then read here so the colors 60 00:03:18,930 --> 00:03:21,810 will change to correspond as well just 61 00:03:21,810 --> 00:03:22,740 so you can see it better 62 00:03:28,680 --> 00:03:30,690 okay now we have all three resistors 63 00:03:30,690 --> 00:03:33,930 connected to ground and the LED are 64 00:03:33,930 --> 00:03:35,100 connected to the wires 65 00:03:43,380 --> 00:03:45,330 now I have the same exact circuit 66 00:03:45,330 --> 00:03:47,340 on the real bored with the same 67 00:03:47,340 --> 00:03:49,920 connections so now we are going to 68 00:03:49,920 --> 00:03:53,760 program the simulation first and we're going 69 00:03:53,760 --> 00:03:55,050 to do it the same way that 70 00:03:55,050 --> 00:03:57,180 we programmed the LED sequence 71 00:03:59,580 --> 00:04:00,750 so we go up to the code 72 00:04:01,440 --> 00:04:05,040 and first we need a thirteen to 73 00:04:05,040 --> 00:04:08,220 be defined as high or on 74 00:04:14,280 --> 00:04:15,750 and then it will wait or continue 75 00:04:15,750 --> 00:04:17,070 shining for one second 76 00:04:20,160 --> 00:04:22,079 and then off or low 77 00:04:25,560 --> 00:04:27,598 and we will duplicate and repeat this 78 00:04:27,598 --> 00:04:31,020 same sequence with twelve and eleven 79 00:04:32,340 --> 00:04:33,930 so just remember you can right click 80 00:04:33,930 --> 00:04:36,240 to duplicate and then change the numbers 81 00:04:45,840 --> 00:04:47,130 eleven and 82 00:04:48,240 --> 00:04:48,660 eleven 83 00:04:49,830 --> 00:04:52,590 ok everything has been programmed properly 84 00:04:53,760 --> 00:04:55,740 we can close this a code box 85 00:04:55,740 --> 00:04:58,020 just to see it better and check 86 00:04:58,020 --> 00:05:00,450 the simulation and it works perfectly 87 00:05:01,860 --> 00:05:04,650 now the idea of simulations is that 88 00:05:05,340 --> 00:05:07,230 they're really useful to check if everything 89 00:05:07,230 --> 00:05:10,260 has been designed properly because sometimes we 90 00:05:10,260 --> 00:05:13,050 make mistakes when we're designing and doing 91 00:05:13,050 --> 00:05:15,690 the simulation before making the real circuit 92 00:05:15,960 --> 00:05:17,340 is always a good idea 93 00:05:18,990 --> 00:05:20,940 now that we know that the simulation 94 00:05:20,970 --> 00:05:23,850 will work how can we program the 95 00:05:23,850 --> 00:05:25,890 real circuit the one we have here 96 00:05:26,100 --> 00:05:28,380 if we want to program it directly 97 00:05:31,860 --> 00:05:34,230 will you need the code which we 98 00:05:34,230 --> 00:05:35,700 know is over here so if you 99 00:05:35,700 --> 00:05:36,870 pull it back up 100 00:05:37,980 --> 00:05:39,810 we don't want the blocks though we 101 00:05:39,810 --> 00:05:41,730 need something else so if you go 102 00:05:41,730 --> 00:05:44,430 to this drop down and we want 103 00:05:44,430 --> 00:05:46,920 to see the text so this text 104 00:05:46,920 --> 00:05:49,470 is the actual code for the program 105 00:05:49,500 --> 00:05:50,520 and this is what we are going 106 00:05:50,520 --> 00:05:52,500 to upload to the real arduino board 107 00:05:52,770 --> 00:05:55,470 so you right click and copy and 108 00:05:55,470 --> 00:05:57,150 we're going to open a new program 109 00:05:57,150 --> 00:05:58,080 called arduino 110 00:05:58,080 --> 00:06:00,420 IDE this is the 111 00:06:00,420 --> 00:06:02,310 software that we use to program the 112 00:06:02,310 --> 00:06:02,970 real board 113 00:06:04,937 --> 00:06:07,050 now I'm going to just delete the 114 00:06:07,050 --> 00:06:09,570 code that appears by default and I 115 00:06:09,570 --> 00:06:11,790 will paste the code that we generated 116 00:06:11,790 --> 00:06:12,780 from the simulator 117 00:06:14,400 --> 00:06:15,720 okay let me repeat that 118 00:06:17,340 --> 00:06:19,440 so here where we code the blocks 119 00:06:19,440 --> 00:06:22,500 are translated into text and this text 120 00:06:22,500 --> 00:06:24,660 is what I have copied and pasted 121 00:06:25,440 --> 00:06:27,900 over here to the arduino IDE 122 00:06:27,900 --> 00:06:29,040 program 123 00:06:30,780 --> 00:06:32,310 so now that I have this program 124 00:06:32,310 --> 00:06:33,810 this is the code I'm going to 125 00:06:33,840 --> 00:06:36,600 upload directly to the real arduino board 126 00:06:38,790 --> 00:06:41,220 so first we need to connect the 127 00:06:41,220 --> 00:06:44,880 arduino board to the computer with this 128 00:06:44,880 --> 00:06:46,380 usb wire can you see it 129 00:06:48,780 --> 00:06:50,400 now I'm going to connect it directly 130 00:06:50,400 --> 00:06:51,330 to the computer 131 00:06:53,910 --> 00:06:55,440 and now you can see the arduino 132 00:06:55,440 --> 00:06:58,680 board has some shining green lights here 133 00:06:59,610 --> 00:07:00,900 and over here so we know it's 134 00:07:00,900 --> 00:07:01,260 on 135 00:07:03,150 --> 00:07:04,590 so now the board is connected to 136 00:07:04,590 --> 00:07:08,069 the computer and I've opened the application 137 00:07:08,100 --> 00:07:10,350 arduino IDE and I'm going to 138 00:07:10,350 --> 00:07:13,500 upload the code to the first thing 139 00:07:13,560 --> 00:07:15,180 is to check that the program is 140 00:07:15,180 --> 00:07:17,760 correct so I click this checkmark and 141 00:07:17,760 --> 00:07:20,370 save it and down here it says 142 00:07:20,370 --> 00:07:22,560 there's no mistakes so it will work 143 00:07:23,250 --> 00:07:25,260 and now i can upload using this 144 00:07:25,320 --> 00:07:25,830 arrow 145 00:07:27,870 --> 00:07:29,910 and now the arduino board will have 146 00:07:29,910 --> 00:07:30,360 the code 147 00:07:32,070 --> 00:07:33,870 and if we look at the board 148 00:07:34,110 --> 00:07:35,850 we can see that the allergies are 149 00:07:35,850 --> 00:07:37,920 shining it looks exactly the same way 150 00:07:37,920 --> 00:07:39,210 that the simulation looks 151 00:07:40,860 --> 00:07:43,560 so to repeat I have programmed the 152 00:07:43,560 --> 00:07:46,380 arduino board using this usb connector to 153 00:07:46,380 --> 00:07:49,800 the computer and using the program arduino 154 00:07:49,800 --> 00:07:50,520 IDE 155 00:07:52,200 --> 00:07:54,270 then I pasted the code 156 00:07:55,710 --> 00:07:57,810 that was generated from the blocks 157 00:07:59,520 --> 00:08:01,500 and they are translated into code and 158 00:08:01,500 --> 00:08:03,390 this is what the program needs to 159 00:08:03,390 --> 00:08:06,330 have so now the real arduino board 160 00:08:06,330 --> 00:08:08,220 works the same way that the simulation 161 00:08:08,220 --> 00:08:08,640 does 162 00:08:11,730 --> 00:08:13,560 now maybe some of you are wondering 163 00:08:13,560 --> 00:08:15,870 or thinking that the computer is controlling 164 00:08:15,870 --> 00:08:17,730 the LED that are shining but 165 00:08:17,730 --> 00:08:20,160 it's not now how can I prove 166 00:08:20,160 --> 00:08:20,400 it 167 00:08:22,980 --> 00:08:27,750 because if we unplug the usb wire 168 00:08:30,600 --> 00:08:34,350 the arduino board would be off because 169 00:08:34,350 --> 00:08:36,390 the computer is providing energy to the 170 00:08:36,390 --> 00:08:39,780 board but what happens if i unplug 171 00:08:39,870 --> 00:08:40,590 this wire 172 00:08:50,940 --> 00:08:52,830 okay so here we can see now 173 00:08:52,830 --> 00:08:54,840 that the board has no energy and 174 00:08:54,840 --> 00:08:55,890 it won't work anymore 175 00:08:56,430 --> 00:08:59,400 but I can provide energy from somewhere 176 00:08:59,400 --> 00:09:00,960 else from a different source 177 00:09:02,250 --> 00:09:03,900 this wire here is coming from a 178 00:09:03,900 --> 00:09:06,180 different source of energy and we can 179 00:09:06,180 --> 00:09:08,760 connect it here and now the arduino 180 00:09:08,760 --> 00:09:10,560 is not connected to the computer any 181 00:09:10,560 --> 00:09:12,240 more but it has it's own source 182 00:09:12,240 --> 00:09:15,060 of energy and again the elegies are 183 00:09:15,060 --> 00:09:16,920 changing so it means that the program 184 00:09:16,920 --> 00:09:18,900 has been uploaded directly to the board 185 00:09:18,900 --> 00:09:21,900 and is stored in its memory okay 186 00:09:22,950 --> 00:09:25,500 so an arduino board is a device 187 00:09:25,500 --> 00:09:27,630 that can be programmed and it can 188 00:09:27,630 --> 00:09:29,160 run any program that you want by 189 00:09:29,160 --> 00:09:31,140 itself the only thing that it needs 190 00:09:31,140 --> 00:09:33,600 is a source of energy now and 191 00:09:33,600 --> 00:09:35,280 you can see that it works and 192 00:09:35,280 --> 00:09:37,560 this is very important because sometimes these 193 00:09:37,560 --> 00:09:39,810 boards are used for robots and they 194 00:09:39,810 --> 00:09:41,610 will control the robot without the help 195 00:09:41,610 --> 00:09:42,480 of any compete 196 00:09:42,480 --> 00:09:45,360 better so I hope this tutorial has 197 00:09:45,360 --> 00:09:47,730 been interesting for you and now you've 198 00:09:47,730 --> 00:09:48,870 seen a real arduino board