Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hello World With Arduino

In this lesson, you’ll upload your first sketch to the Arduino board using the Arduino IDE. It’s a sort of “Hello, World!” with the Arduino.

For more information about using troubleshooting connections and using an external power supply with your Arduino, check out the following resources:

00:00 In this lesson, you’ll send your first sketch to the Arduino, and just like in most programming languages, you can think of this as the “Hello, World!” program for the Arduino.

00:11 To upload your first sketch, the first step is to connect the Arduino to your PC using a USB cable. Connect the A side of the USB cable to the back of your PC, then the B side connects into the Arduino board. And on the board, you should see—along with a couple other flashing LEDs—the green ON LED light up, indicating that you’re properly connected.

00:35 Next, go ahead and start up the Arduino IDE that you installed in the last lesson.

00:42 You can close this sketch that comes up automatically. Then, you’re going to open the Blink example sketch, and you’ll find that from the pulldown menu of File > Examples > Basics and then you’ll see Blink. Let me show you what that looks like.

00:57 You’ll go to File > Examples > Basics and choose Blink. Blink is a fairly simple sketch. It’s going to change the built-in LED and set it to HIGH, which basically turns it on.

01:13 Then it waits one second, sets the LED to LOW, which turns it off, then waits another second. This all loops around, creating a blinking pattern.

01:24 Next, you need to configure the board. What that means is to select the appropriate board from the Tools menu. From the Tools menu, go to Board. From here, in my case I have an Arduino Uno which I would click on to select, but if you have one of the other ones in this list of names, you would select it.

01:52 The next configuration is to select the appropriate port that the Arduino’s connected to. It should be a USB port, so look under Tools > Port, and then you’ll see the name of the USB port. Okay, time to set the port.

02:07 Go to Tools > Port, and here you can see the different connections that are available. I’m using the USB connection, and here you can see the number.

02:17 You may want to write down what it shows there. In my case, /dev/cu.usbmodem14601. This specific address, if you will, is something that you’re going to use when you connect to Python. Now again, this will look different on your machine, but make sure that you write down what it shows next to Port.

02:42 The last step is to press Upload.

02:46 Now that you’ve configured those things, you can use this check mark to verify the program. Again, this is an example program, so it’s already been verified that it will compile, but that’s one step that you can do.

02:58 And here you can see that it says Done compiling, and it shows you how much space it’s going to use out of your Arduino. Then use this arrow button here, which is Upload. When I press this, it’ll send the Blink sketch to the Arduino.

03:13 And it’s pretty quick. There you can see it uploading, and it’s done uploading already. Let me show you what it looks like on the board. When pressing Upload, the L light will initially light, and then the transmit and receive LEDs will flash indicating that it’s received the sketch.

03:29 And now the L LED is just blinking. Hello!

03:36 All right, now that you’ve got that working, it’s time to start connecting external components to your Arduino.

Become a Member to join the conversation.