Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Hello World With Arduino LinkIt One

DZone's Guide to

Hello World With Arduino LinkIt One

How to make an LED blink with an Arduino LinkIt One open source microcontroller.

· IoT Zone
Free Resource

Blinking an LED is just like writing your first “Hello World” program. When you set up your development environment or test a new microcontroller board the first thing you do is run a simple blink LED program to see if everything is working fine and as expected.

Here are the links to the previous parts:

The programs we write for LinkIt One in Arduino are called sketches. Inside the sketch we have a minimum of the following two methods:

  • setup()
  • loop()

The setup method will run once at the beginning that helps to initialize our variable and sensors. The loop method will be called repeatedly. We can have many methods other than these two.

Requirements

  • LinkIt One board
  • USB cable
  • An LED

Image title

Connections

  1. Connect LinkIt One to your computer using a USB A to micro B cable.
  2. In the Arduino IDE, go to the Tools pull-down menu at the top, select Board, and make sure “LinkIt One” is checked.
  3. Then pull down the Tools menu again, and select appropriate Serial Port.

ports

If you have multiple serial ports to choose from and aren’t sure which to choose, try unplugging the board from your computer and plugging the board back again to see which port gets added.

The Arduino IDE has many examples that we can use, we will run one of these now. We will test our LinkItOne with the Blink Example that you can find under File, Examples, Basics, then Blink.

10

A new sketch window will open up with some code in it. Click the Upload button on the tool bar. It may take a moment to compile and upload to the board.

11

When it’s done, you’ll see the text “Done uploading” at the bottom.

Code

   int led = 13;  

    void setup()  
    {  
        pinMode(led, OUTPUT);  
    }  

    // the loop routine runs over and over again forever:  
    void loop()   
    {  
        digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)  
        delay(1000); // wait for a second  
        digitalWrite(led, LOW); // turn the LED off by making the voltage LOW  
        delay(1000); // wait for a second  
    }

9

WP_20151115_007

I am using a Red LED that I hooked up to pin 13 by carefully inserting the anode in pin 13 and the cathode to ground. They have polarity which means we need to connect them in the right order. There are many ways to differentiate between cathode and anode of the LED, we can tell that by looking at the LED carefully in many ways.

ledlegs 

  1. The longer leg will be the cathode and the shorter will be the anode.
  2. When we examine the LED from the top we see the two metal posts, the smaller of the two is the anode and the bigger is the cathode.

LinkIt One has digital and analog pins for input and output. Here by default our LED is hooked up to pin 13. To compile and run the sketch just hit the upload button. In the output you will see the transfer is complete and the LED is blinking. There is a little LED on the board that is also hooked up to pin 13 so if you don’t attach an external LED then that will also work for you.

Now we have successfully deployed our first sketch to LinkIt One. And we are ready to do more creative stuff with our powerful development board “LinkIt One”.

Topics:
arduino ,linkit one

Published at DZone with permission of Pooja Baraskar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}