Blinking an LED is same as 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 running a simple blink led program to see if everything is working fine and as expected.
The programs we write for LinkIt One in Arduino are called sketches. Inside the sketch we have a minimum of the following two methods:
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.
LinkIt One board
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.
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 -> Blink.
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.
When it’s done, you’ll see the text “Done uploading” at the bottom.
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.
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”.