0:00:00.000,0:00:10.000 [MUSIC] 0:00:12.482,0:00:16.137 Hi everyone, my name is Patrick, and I'm a[br]web developer from Sydney. 0:00:16.137,0:00:21.142 I've recently been looking into using[br]JavaScript to control devices such as 0:00:21.142,0:00:24.068 Arduinos, the Elite Emotion, Ninja Blocks 0:00:24.068,0:00:27.090 and hopefully very soon this, Pebble[br]watch. 0:00:28.880,0:00:31.456 Today I'm gonna be going over the 0:00:31.456,0:00:35.860 absolute basics of controlling an Arduino[br]using Node. 0:00:35.860,0:00:37.650 We're gonna cover connecting up to a 0:00:37.650,0:00:40.072 computer, getting Node to communicate with[br]the 0:00:40.072,0:00:44.699 Arduino, and hopefully, by the very end,[br]blinking this LED light on and off. 0:00:46.020,0:00:48.770 I'll be sticking to absolute basics here,[br]so we're 0:00:48.770,0:00:51.595 not going to be doing anything too[br]advanced, hopefully. 0:00:51.595,0:00:54.880 In future tutorials, I'll go over this and[br]it gets a little bit more complicated. 0:00:54.880,0:00:58.610 But, for this one, we're gonna show you[br]how to get started. 0:00:58.610,0:01:01.600 So, let's do that and get started. 0:01:01.600,0:01:02.575 What is an Arduino? 0:01:02.575,0:01:05.570 A lot of people have read the name online,[br]or they've heard it 0:01:05.570,0:01:08.790 mentioned, but they've never actually seen[br]one in action, so this is it. 0:01:09.810,0:01:12.288 It's a single board micro-controller[br]that's 0:01:12.288,0:01:15.130 open source which basically means that you 0:01:15.130,0:01:19.190 can control electronics using a platform[br]that anyone can build and tinker with. 0:01:19.190,0:01:23.570 The people at Arduino are lovely enough to[br]have open sourced it, which 0:01:23.570,0:01:26.980 means that anybody can make their own[br]Arduino boards that really want to. 0:01:28.180,0:01:30.880 This one here, in particular, is the[br]Arduino Uno. 0:01:30.880,0:01:33.590 It's one of a variety, of different models 0:01:33.590,0:01:35.750 that the lovely people at Arduino have[br]released. 0:01:37.090,0:01:38.520 You can have a whole range of components 0:01:38.520,0:01:41.900 connected to it, too, like LED light[br]bulbs, sensors, 0:01:41.900,0:01:44.900 and even shields, which are things you[br]kind of 0:01:44.900,0:01:48.110 stack on top of Arduinos to add more[br]functionality. 0:01:48.110,0:01:51.340 This one in particular is a MIDI, shield[br]which has 0:01:51.340,0:01:54.432 the ability for, to play sounds, like a[br]MIDI Keyboard does. 0:01:54.432,0:01:56.610 0:01:56.610,0:01:58.735 Node.js is a platform that takes 0:01:58.735,0:02:01.550 JavaScripts, a scripting language most[br]commonly used 0:02:01.550,0:02:05.710 for web pages, unless you're writing up[br]network applications such as web servers. 0:02:07.170,0:02:11.780 We'll be using it today, to run a web[br]server that'll talk to our Aduino. 0:02:12.900,0:02:16.990 If you haven't used Node.js before, get[br]started by 0:02:16.990,0:02:19.799 heading over to Node.js.org, which I'm[br]showing on screen here. 0:02:20.880,0:02:22.570 Click that Install button and get it[br]installed 0:02:22.570,0:02:24.170 and running on your computer, so that[br]you'll 0:02:24.170,0:02:28.290 be able to continue and follow along with[br]the example code that I'll be putting up. 0:02:28.290,0:02:30.366 [BLANK_AUDIO] 0:02:30.366,0:02:32.410 So why Node.js and Arduinos? 0:02:32.410,0:02:34.160 Why link these two technologies together? 0:02:35.380,0:02:38.770 Well, one of the strengths of JavaScript[br]is that there are quite a few APIs 0:02:38.770,0:02:42.360 out there, which you can join in different[br]ways to make ideas come to life. 0:02:43.910,0:02:45.600 Want to develop a robot that takes 0:02:45.600,0:02:48.060 instructions from your Twitter followers,[br]or a 0:02:48.060,0:02:49.690 coffee machine that makes you a different 0:02:49.690,0:02:51.430 style of coffee, depending on the weather[br]outside? 0:02:52.720,0:02:55.780 If you want to add a Leap Motion as an[br]input 0:02:55.780,0:03:01.230 device, or feed in data from your Jawbone[br]or FitBit fitness products. 0:03:01.230,0:03:02.760 The possibilities are going all the time. 0:03:02.760,0:03:05.380 And JavaScript is becoming an easy to use[br]bridge between technologies, 0:03:05.380,0:03:07.520 because we've got a whole bunch of APIs[br]we've got access to. 0:03:09.050,0:03:10.362 And what is Johnny-Five? 0:03:10.362,0:03:14.250 Johnny-Five, is one of those open APIs[br]that makes JavaScript such 0:03:14.250,0:03:17.150 a valuable language to be developing this[br]sort of thing in. 0:03:18.180,0:03:20.188 It allows you to control your Arduino[br]using 0:03:20.188,0:03:22.460 very similar functions to those that you'd[br]use 0:03:22.460,0:03:24.560 if you were programming it just using the 0:03:24.560,0:03:28.180 Arduino platform that comes with the[br]Arduino itself. 0:03:31.440,0:03:32.980 We'll be doing a lot of this stuff in the 0:03:32.980,0:03:36.590 tutorial that it's explaining here, so[br]don't worry too much. 0:03:36.590,0:03:37.720 But you can see, there's a lot of cool 0:03:37.720,0:03:39.566 things that people have started to make[br]with it. 0:03:39.566,0:03:44.970 Wireless Nodebot Kinnect controlled robot[br]arm, and LCD Running Man. 0:03:44.970,0:03:48.950 So, you know, the possibilities get pretty[br]exciting. 0:03:50.520,0:03:55.290 Okay, to get started we'll need to connect[br]our, our Arduino to our computer. 0:03:56.340,0:04:00.660 So, we'll do this by connecting the USB[br]port to our Arduino. 0:04:00.660,0:04:03.550 It serves as both the power to the[br]Arduino, 0:04:04.610,0:04:07.990 and the way to upload software to our[br]Arduino. 0:04:09.020,0:04:11.220 As you can see, once you plug it in,[br]you'll 0:04:11.220,0:04:14.700 have the on lights flicker on, which is a[br]good sign. 0:04:16.430,0:04:18.860 In this demo today, I'll be doing a really 0:04:18.860,0:04:23.380 basic example of turning this LED light on[br]and off. 0:04:23.380,0:04:26.868 I've already got the jumper leads in where[br]they should be. 0:04:26.868,0:04:30.828 So if you need to pause this to be able to[br]follow along, feel free to 0:04:30.828,0:04:35.320 pause it now, and put the jumper leads in,[br]in the way that I've got them. 0:04:39.510,0:04:41.170 Connecting up the Arduino is pretty[br]simple. 0:04:42.210,0:04:48.060 Connect up the green one here, to pin 13[br]on your Arduino. 0:04:48.060,0:04:51.790 Then connect up the red one to the 5 volt[br]pin. 0:04:54.680,0:05:01.130 And finally we connect up the black one,[br]to the ground pin. 0:05:01.130,0:05:02.300 Doesn't really matter about colors, you[br]can 0:05:02.300,0:05:06.760 use whatever color jumper wire you'd like. 0:05:06.760,0:05:12.220 Now that that's all done, we're ready to[br]go into the software part 0:05:12.220,0:05:17.515 of the tutorial with what code we've gotta[br]run, and where to talk to our Arduino. 0:05:19.528,0:05:21.130 Node application is extremely simple. 0:05:21.130,0:05:25.560 We've only got two files, an index[br]JavaScript file and a package Jason file. 0:05:27.240,0:05:34.700 If you are new to Node the package Jason[br]file is what we use to provide any details 0:05:34.700,0:05:38.579 about the application, and what other Node[br]modules are required for that application. 0:05:40.070,0:05:43.286 So, to start with, I'll go over this[br]packaged 0:05:43.286,0:05:46.120 up Jason file, and show you what's going[br]on. 0:05:46.120,0:05:49.610 So, here we've got what the name of 0:05:49.610,0:05:53.540 our application is in this case, Node in[br]Johnny-Five. 0:05:53.540,0:05:57.930 Can name this whatever you'd like, totally[br]up to you, but keep it all to one word. 0:05:57.930,0:05:59.460 It doesn't seem to like spaces. 0:05:59.460,0:06:02.420 It'll start complaining at you, so[br]definitely stick to one word. 0:06:03.870,0:06:05.900 We've got a version number. 0:06:05.900,0:06:08.020 Once again, you can pretty much use any[br]version 0:06:08.020,0:06:11.660 number you'd like, really, for simple[br]basic test applications. 0:06:11.660,0:06:16.240 I've called it 0.0.1, because really this[br]application is very, 0:06:16.240,0:06:19.130 very early stages and isn't going to be[br]doing too much. 0:06:19.130,0:06:21.280 So, I'm keeping it at a very early[br]version. 0:06:22.520,0:06:25.270 Then the very important thing, which will[br]definitely prevent 0:06:25.270,0:06:31.250 our application working with Arduinos is[br]our dependency section here. 0:06:31.250,0:06:34.120 This is where we say what other modules we[br]need, 0:06:34.120,0:06:37.710 running and in our Node application for[br]this to work. 0:06:37.710,0:06:41.800 So, we only need Johnny-Five, which is the[br]module I was showing earlier. 0:06:42.910,0:06:44.380 And this here is the version. 0:06:44.380,0:06:49.060 So, in this case, we want the latest[br]Johnny-Five version of that module. 0:06:50.550,0:06:53.675 Basically, we're doing such simple stuff,[br]just basic turning 0:06:53.675,0:06:56.970 an LED light on and off, not likely to[br]change. 0:06:56.970,0:07:00.305 So, we're gonna assume that, in every[br]future version of 0:07:00.305,0:07:04.350 Johnny-Five, it'll be compatible with what[br]we're gonna be doing here. 0:07:04.350,0:07:08.580 So, there's no need to really be, specific[br]on which version we're wanting. 0:07:08.580,0:07:12.130 Now we'll go on to the index JavaScript[br]file. 0:07:15.600,0:07:17.840 Our index JavaScript file contains all 0:07:17.840,0:07:20.350 of the functionality, but the node[br]application. 0:07:20.350,0:07:24.350 So, this pretty much is our note[br]application 0:07:25.510,0:07:28.980 in 19 lines, two of which are Console[br]logs. 0:07:28.980,0:07:31.810 So, very, very small application here. 0:07:32.940,0:07:33.900 I'll go through it step by step and 0:07:33.900,0:07:35.850 explain what everything is and why it's[br]there. 0:07:37.860,0:07:40.190 Firstly, we've got our five variable. 0:07:40.190,0:07:44.030 Our five variable just requires the[br]Johnny-Five module. 0:07:44.030,0:07:48.600 Once again, the reason that we've got it[br]here as well as in the package Jason file, 0:07:48.600,0:07:54.570 is that we're assigning all of the[br]different objects and functionality. 0:07:54.570,0:07:57.560 That we gain from the Johnny-Five module[br]into this five 0:07:57.560,0:08:00.935 variable so we can access it throughout[br]the node application. 0:08:00.935,0:08:04.740 An example of that is our next line here,[br]which is board. 0:08:04.740,0:08:08.790 Our board variable, is creating a new[br]board 0:08:08.790,0:08:12.440 object which is part of the Johnny-Five[br]module. 0:08:12.440,0:08:17.310 So we're looking into the Johnny-Five[br]object here, that 0:08:17.310,0:08:19.860 we've required here, and we're grabbing[br]the board object. 0:08:21.520,0:08:23.240 Which is all the part of the Jonny-Five[br]module. 0:08:23.240,0:08:24.420 We don't have to worry about any of this. 0:08:24.420,0:08:25.970 We don't have to really create any of[br]this. 0:08:25.970,0:08:27.680 It's all been there. 0:08:27.680,0:08:29.350 Thanks to the geniuses who have come[br]before us. 0:08:32.409,0:08:35.140 Next up, we are declaring a few more[br]variables that we use later on, 0:08:35.140,0:08:39.929 so we are declaring the LED variable, and[br]we are declaring toggle state variable. 0:08:39.929,0:08:41.190 I'll explain these a bit later on. 0:08:41.190,0:08:45.414 [BLANK_AUDIO] 0:08:45.414,0:08:48.240 To begin, look at this here actually. 0:08:48.240,0:08:49.790 This is an important one because this is[br]what 0:08:49.790,0:08:52.620 will come up first, when we run our[br]application. 0:08:52.620,0:08:54.900 It's just a console log saying waiting for[br]device to connect. 0:08:56.000,0:09:01.120 What that means is that, that will come up[br]first, as soon as the known application 0:09:01.120,0:09:04.669 is starts up just to let us know that the[br]new application is at least running. 0:09:05.890,0:09:10.070 But we don't know yet whether our Arduino[br]has 0:09:10.070,0:09:11.700 connected up, and whether we can talk to[br]it. 0:09:13.010,0:09:17.820 What then happens, is, using this baud[br]variable here that we created. 0:09:17.820,0:09:20.600 Which is a Johnny-Five board object. 0:09:21.810,0:09:24.330 We say, on ready, which means, when we've[br]got 0:09:24.330,0:09:28.000 the event of ready fired from the board,[br]which means. 0:09:28.000,0:09:32.590 The board's pretty faster, sends any sort[br]of commands and requests to it. 0:09:33.860,0:09:38.030 We run this function right here, and this[br]function 0:09:39.070,0:09:41.110 starts off with a console log saying board[br]ready. 0:09:41.110,0:09:44.460 This will just let us know, if we're[br]watching the console while 0:09:44.460,0:09:47.650 our node application is running, that the[br]board is ready to receive. 0:09:49.000,0:09:51.120 Our request. 0:09:51.120,0:09:54.800 It also is a good way to devote whether,[br]or not the board is connected properly. 0:09:54.800,0:09:55.520 You are doing a board. 0:09:57.380,0:10:01.820 Next up, we use this LED variable that we[br]declared earlier, and 0:10:01.820,0:10:04.882 we create a new LED, once again part of[br]the Johnny-Five module. 0:10:05.910,0:10:10.420 We're basically just letting it know that[br]we've got an LED. 0:10:10.420,0:10:13.390 At pin 13 which is what we plugged into[br]earlier. 0:10:15.770,0:10:20.985 Then we get to the JavaScript bit which[br]is, we're setting an interval using the 0:10:20.985,0:10:24.330 JavaScript function which many of you[br]might 0:10:24.330,0:10:26.850 be used to if you are JavaScript gurus. 0:10:26.850,0:10:32.440 Basically set interval means that we're[br]gonna use this function here, toggle LED. 0:10:32.440,0:10:36.530 Every 200 milliseconds, and you can play[br]around with this 0:10:36.530,0:10:39.920 number if you'd like later on, just to[br]experiment, and change 0:10:39.920,0:10:42.810 how often the LED light gonna toggle on[br]and off, 0:10:42.810,0:10:45.550 but basically we're gonna say, run this[br]function every 200 milliseconds. 0:10:46.770,0:10:49.000 What isn't that function well, the[br]function here has. 0:10:50.672,0:10:55.180 Three lines and one life line which is[br]just there for user reading. 0:10:55.180,0:10:59.040 Basically we use this variable here,[br]toggle state, 0:10:59.040,0:11:01.060 which we set up earlier to be false. 0:11:02.300,0:11:05.840 And each time toggle LED runs, will change[br]the value of 0:11:05.840,0:11:09.120 toggle state from true to false or from[br]false to true. 0:11:09.120,0:11:11.709 So, it basically just changes it the[br]opposite of what it was. 0:11:13.100,0:11:19.890 Then, if total state is true, we turn our[br]LED light on, otherwise turn it off. 0:11:19.890,0:11:22.700 So, basically, we keep changing toggle[br]state on and off, on and off, 0:11:24.120,0:11:27.790 in turn, turning our LED light on and off[br]and on and off. 0:11:27.790,0:11:30.390 [BLANK_AUDIO] 0:11:30.390,0:11:31.080 You've. 0:11:32.080,0:11:33.490 You're following this now and kind of, 0:11:33.490,0:11:36.060 picturing the function running in your[br]head. 0:11:36.060,0:11:39.140 If you'll notice there is nothing that[br]turns off 0:11:39.140,0:11:42.360 this LED, so it will theoretically go on[br]forever continually 0:11:42.360,0:11:45.500 turning on and off, on and off until we[br]either 0:11:45.500,0:11:48.180 disconnect our Arduino or we turn off this[br]node application. 0:11:48.180,0:11:50.270 And I'll be showing you how to do that to. 0:11:51.580,0:11:55.040 Theoretically, you could also include some[br]other functionality, in the 0:11:55.040,0:11:59.310 error to turn off the, Intel by clearing[br]Intel if you'd 0:11:59.310,0:12:02.290 like to but in this tutorial to keep[br]things simple, 0:12:02.290,0:12:04.110 we're just gonna give it to the basics I'm[br]showing you. 0:12:04.110,0:12:08.100 This is how you can control the Arduino[br]from Node, and 0:12:08.100,0:12:10.930 then you can add as much functionality as[br]you'd like to. 0:12:10.930,0:12:12.010 On top of this and have a bit of fun. 0:12:14.440,0:12:20.830 Now that we have those two files up there[br]and ready to run our Node application, we 0:12:20.830,0:12:29.150 do have to make sure those dependencies we[br]mentioned, are there and available to run. 0:12:31.110,0:12:34.690 So, what I've done is I've opened up a[br]tunnel, and I've gone to 0:12:34.690,0:12:39.560 the same folder that we put those two[br]files in to prove that to you. 0:12:39.560,0:12:40.530 I'll just show you there. 0:12:40.530,0:12:44.170 So, you've got the index JavaScript file,[br]and our package JSON file. 0:12:46.290,0:12:46.790 So. 0:12:48.230,0:12:53.853 How you would usually run a node[br]application is just Node index.js. 0:12:53.853,0:12:57.290 And we're gonna attempt to run it. 0:12:57.290,0:13:01.610 And what we see here is that is says,[br]cannot find Module Johnny-Five. 0:13:01.610,0:13:02.990 Which is fair enough. 0:13:02.990,0:13:05.970 We've told it in the Index JavaScript[br]file. 0:13:05.970,0:13:10.310 That there's gonna be a node module called[br]Johnny-Five and it's gone and looked for 0:13:10.310,0:13:13.630 it and can't find and it is now very upset[br]at us for lying to it. 0:13:13.630,0:13:16.050 So, we need to get it installed. 0:13:17.540,0:13:21.750 To install it you can use an incredible[br]package manager called MPM. 0:13:23.060,0:13:27.202 MPM just runs through your package.jason[br]file, 0:13:27.202,0:13:29.440 and installs any dependencies that you've[br]got listed. 0:13:29.440,0:13:32.150 If you don't have MPM on your machine just[br]do a 0:13:32.150,0:13:35.550 quick Google search for MPM, and install[br]it on your computer. 0:13:36.750,0:13:41.179 It's quite a simple process, so I won't[br]cover it here. 0:13:42.900,0:13:47.460 So basically, once you've got MPM[br]installed, you type in MPM space install. 0:13:47.460,0:13:51.460 And, it will go through looking through[br]our package Jason file. 0:13:52.790,0:13:54.980 It also does a nice bunch of warning us,[br]saying we 0:13:54.980,0:13:59.880 don't have a few of those that we could[br]have had. 0:13:59.880,0:14:01.620 Description I think and a few other ones. 0:14:02.700,0:14:05.350 So, basically, it's gone through and[br]installed 0:14:05.350,0:14:08.401 our modules here so we've got all the 0:14:08.401,0:14:11.680 Johnny-Five Modules, and all this other[br]stuff 0:14:11.680,0:14:14.790 that it deems necessary to run our[br]application. 0:14:16.070,0:14:16.780 So now, I'm going 0:14:18.920,0:14:22.580 to clear this, but before we run our[br]actual. 0:14:22.580,0:14:26.850 Application we're gonna need to set up our[br]Arduino, so 0:14:26.850,0:14:30.760 that it's able to receive communication[br]from our Arduino application. 0:14:31.980,0:14:36.700 To get this communication working between[br]our Arduino and the computer, 0:14:36.700,0:14:40.660 we just need to upload a bit of code to[br]our Arduino. 0:14:40.660,0:14:44.770 Arduino calls these bits of code sketches. 0:14:44.770,0:14:50.018 Which you upload and then install onto the[br]Arduino and then the Arduino knows 0:14:50.018,0:14:55.089 what it needs to do, In our case we don't[br]need the Arduino to do too much. 0:14:55.089,0:15:00.480 Most of our functionality is in Node, all[br]we need to do is install 0:15:00.480,0:15:04.030 a bit of code to ensure it understands how[br]to communicate with the computer. 0:15:05.960,0:15:10.020 First off, before we install it, if you[br]haven't used the Arduino software 0:15:10.020,0:15:16.410 before, double check that your serial port[br]is pointing to the correct USB port. 0:15:16.410,0:15:17.830 You might need to do a bit of trial, and[br]error with 0:15:17.830,0:15:21.180 this one if you're not sure which USB port[br]is the correct one. 0:15:21.180,0:15:24.870 But in my case, it was this TTY USB modem. 0:15:26.990,0:15:28.610 Do a bit of trial and error to check which[br]will work 0:15:28.610,0:15:33.123 if you are having any issues with[br]uploading your code to your Arduino. 0:15:33.123,0:15:35.625 Definitely check that setting right there. 0:15:35.625,0:15:38.190 I've also got the board set up to 0:15:38.190,0:15:42.135 be Arduino set up to whichever board[br][INAUDIBLE]. 0:15:42.135,0:15:43.590 Then top load the sketch. 0:15:44.910,0:15:47.620 We're going to go to file, examples. 0:15:47.620,0:15:49.145 And then you'll have this on yours too 0:15:49.145,0:15:54.980 Fermata, we want the standard Fermata,[br]sketch here, and 0:15:54.980,0:15:58.000 this as it says here is a generic protocol 0:15:58.000,0:16:01.410 for communicating with micro controls,[br]from software on computer. 0:16:03.020,0:16:05.790 That is convenient, because that's exactly[br]what we want to do. 0:16:05.790,0:16:10.870 We want to communicate from our notes[br]software 0:16:10.870,0:16:14.803 to our micro control, which is our[br]Arduino. 0:16:14.803,0:16:17.908 So, to upload this to our Arduino, make[br]sure you've 0:16:17.908,0:16:22.320 got it plugged into your computer still,[br]and click upload. 0:16:22.320,0:16:23.690 It'll compile the sketch. 0:16:24.780,0:16:27.210 It'll upload it onto the Arduino. 0:16:28.390,0:16:31.040 And then in a few seconds it should be[br]done. 0:16:31.040,0:16:31.620 There we go. 0:16:31.620,0:16:33.650 So, it's done uploading, which mean's[br]you've now got 0:16:33.650,0:16:39.270 the standard Fermata software or a[br]standard Fermata sketch. 0:16:39.270,0:16:42.350 On your Arduino, which means we're ready[br]now, to move on to the 0:16:42.350,0:16:46.560 next very exciting bit of running our Node[br]code and communicating with that Arduino. 0:16:48.020,0:16:50.130 We've got our two files set up. 0:16:50.130,0:16:55.390 Our index JavaScript which has all the[br]code for our Node application. 0:16:55.390,0:16:58.910 We've installed all our dependencies,[br]using MPM. 0:16:58.910,0:17:01.590 We've also got our Arduino connected and 0:17:01.590,0:17:06.869 running the standard Fermata, sketch code;[br]which means 0:17:06.869,0:17:10.119 it's now ready to accept all commands that[br]will come to it from our computer. 0:17:11.319,0:17:14.310 So, all that's left is to be in our[br]terminal 0:17:14.310,0:17:21.099 and type in Node index.js, and when we run[br]this, 0:17:23.349,0:17:26.140 we've got our, waiting for device to[br]connect, message along 0:17:26.140,0:17:31.400 with a few messages that come from the[br]Johnny-Five Module. 0:17:32.600,0:17:36.269 It's found our serial port, which is the 0:17:37.650,0:17:42.890 USB port that we've got the Arduino[br]connected to. 0:17:42.890,0:17:45.320 Your one might be very different to this. 0:17:45.320,0:17:46.150 Doesn't really matter. 0:17:46.150,0:17:47.860 The main important thing, is that our[br]console log 0:17:47.860,0:17:51.220 that we set up, which said, board ready,[br]has appeared. 0:17:51.220,0:17:55.849 And if you turn to face your LED light,[br]you'll see that it's now flashing. 0:17:57.570,0:17:58.060 Which is lovely. 0:17:58.060,0:17:59.346 It means that our code is working. 0:17:59.346,0:18:04.980 We're sending our commands to the 13th[br]pin, telling 0:18:04.980,0:18:07.450 it to turn an LED light on and off. 0:18:07.450,0:18:10.580 And so it's turning on and off, and on and[br]off, on and off. 0:18:10.580,0:18:13.630 Just as we requested it to. 0:18:13.630,0:18:16.070 The only important question is how do you[br]get it to turn off? 0:18:16.070,0:18:18.650 How do you stop it from constantly[br]running? 0:18:18.650,0:18:19.650 This note application. 0:18:21.110,0:18:27.452 If we go back to the terminal here, what[br]you've gotta do is just press Ctrl C and 0:18:27.452,0:18:34.040 then Ctrl C again and it'll close the[br]board and it'll stop that light blinking. 0:18:35.050,0:18:37.550 If you timed it correctly, the light'll be[br]off. 0:18:37.550,0:18:40.690 If you time it slightly differently, the[br]light will stay on. 0:18:40.690,0:18:42.750 And that's okay, really. 0:18:42.750,0:18:43.440 It's not a big deal. 0:18:43.440,0:18:47.130 If you want to completely turn it off, you[br]can just unplug the 0:18:47.130,0:18:52.750 USB from the computer, and it will turn[br]off all power to your Arduino. 0:18:52.750,0:18:53.780 It won't harm it in any way. 0:18:53.780,0:18:55.800 It's just a quick way of getting it to. 0:18:56.920,0:18:59.870 Stop doing what it was doing that you[br]really didn't want it to do. 0:18:59.870,0:19:05.700 And that, my friends, is how you turn a[br]LED light on and off, and on and off 0:19:05.700,0:19:11.250 in an infinite loop using node Johnny-Five[br]and Arduino. 0:19:11.250,0:19:14.510 If you followed along, you should now have[br]an 0:19:14.510,0:19:17.360 LED light, bending to your node[br]application as well. 0:19:17.360,0:19:17.860 Good work. 0:19:19.080,0:19:20.500 This is the basics. 0:19:20.500,0:19:22.090 There's a lot more to do from here. 0:19:22.090,0:19:24.940 If you've got any questions, or if there's[br]anything that 0:19:24.940,0:19:27.300 I've missed, feel free to get in touch[br]with me. 0:19:27.300,0:19:29.530 My name once again is Patrick Catanzariti. 0:19:29.530,0:19:38.110 I am on Twitter at thatpatrickguy or I've[br]got a website Patcat.me. 0:19:38.110,0:19:41.880 So, feel free to get in touch, if you make[br]anything really cool with Arduinos 0:19:41.880,0:19:43.260 following up from this tutorial,[br]definitely get 0:19:43.260,0:19:44.260 in touch as well, we'd love to see. 0:19:44.260,0:19:52.719 Thanks for taking the time, to watch, and[br]I hope you learned something new. 0:19:52.719,0:19:55.046 See you. 0:19:55.046,0:20:01.270