Blinky - Hello World of Robotics
Tags: robotics, arduino, hardware
Published: 2017-05-30 18:25:08

---
title: Blinky - Hello World of Robotics
published: true
description: Introduction to your Arduino Uno.
tags: robotics, arduino, hardware
---

Hey ya'll! I hope you enjoyed my [first robotics post](https://dev.to/kimberlypilbeam/that-time-i-built-a-robot) and are ready to start your own! Orig post over at [my blog](http://www.kimarnett.com/blog/?p=140)

This is an introduction to your Arduino Uno. I am still new to robotics myself, but together we will prevail. I hope to pass on what I know and you can pass on what you know, and soon we'll all be experts, right?!

Whenever you're learning a new software platform, you create a "Hello World" application. Well, the equivalent in the hardware world is called "Blinky". This tutorial is an introduction to the Arduino platform. I'll be using the [Arduino Uno R3](https://www.newegg.com/Product/Product.aspx?Item=9SIA7BF2K19064&nm_mc=TEMC-RMA-Approvel&cm_mmc=TEMC-RMA-Approvel-_-Content-_-text-_-) and an LED bulb that came with my learn to solder kit.



##Download the Arduino IDE 

here: [arduino.cc/en/Main/Software](https://www.arduino.cc/en/Main/Software)
*This tutorial is using Arduino 1.8.1

As a beginner, I had better luck using on Windows 10 platform than I did my 2015 MacBook Pro. I ran into a driver problem on the Mac and possibly downloaded a Japanese virus while trying to fix it. Oops.

##Quick IDE Intro:

<center>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5
</center>

![header](http://www.kimarnett.com/blog/wp-content/uploads/2017/05/Capture.png)

1. Verify - Compile the code to see if there are any right out failures or errors.
2. Upload - Put the code on the Arduino. Code will begin running right away as long as there's power.
3. New - Create a new document
4. Open - Open an existing document
5. Save - Save the document to your computer

##Prep the Uno

1. Plug it into your USB slot

2. The board will light up indicating there's power

3. Find an LED - Put the positive end (Longest leg / smallest piece inside the LED) into pin 13. Insert the negative end into the GND (Ground) pin.

4. Should look something like

![setup](https://i1.wp.com/www.kimarnett.com/blog/wp-content/uploads/2017/05/IMG_7491.jpg)

##Code

When you create a new file, or the default one, you'll see two methods: Setup and Loop.Setup is run exactly one time at the beginning of the program by the hardware, than the continuous code goes in the, you guessed it, loop function.At the beginning of the file we'll make a reference to the pin our LED is in:
```
int led = 13;
```

In the setup function we'll define the LED as an output with:

```
pinMode(led, OUTPUT);
```

Lastly in the loop function, we'll tell the light to blink. We send a signal to the pin (13), which will be either HIGH or LOW. This signal corresponds to the voltage given to that pin. HIGH, the light will turn on, and LOW the light will turn off. We also want to delay, wait, between turning the light on and off. Here's the code for the loop function:
```
 digitalWrite(led, HIGH); 

 delay(5000); 

 digitalWrite(led, LOW); 

delay(1000);
```

##Save -> Verify -> Upload

Press the Verify button at the top (Checkmark). This will sweep through your code and make sure no outstanding issues exist.

<i>Note: If you get this error on Windows (ser_open(): can't open device "\\.\COM[x]")
Open Device Manager ->Ports -> and determine what port the Uno is on. Then Go to Tools -> Port -> then select the correct port it's expecting.
</i>

If everything comes out good, select the upload button.

Once the program compiles the Uno will refresh and your program should now be running. The light will be on for 5 seconds, and off for 1 second.



<iframe width="560" height="315" src="https://www.youtube.com/embed/luiNmI7pybg" frameborder="0" allowfullscreen></iframe>


[Code On Github] (https://github.com/karnett/Blink)



[Original tutorial here.] (https://www.arduino.cc/en/tutorial/blink)