65.9K
CodeProject is changing. Read more.
Home

Blinking an LED with the Arduino IDE

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Jun 11, 2015

CPOL

5 min read

viewsIcon

11123

This guide will teach you how to run a sample sketch on your Intel® IoT board using the Arduino IDE.

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Overview

This guide will teach you how to run a sample sketch on your Intel® IoT board using the Arduino IDE. These instructions are geared toward the Intel® Edison module with the Arduino* Expansion Board, but can also be applied to the Intel® Galileo board.

Requirements

Setup

1. Run Arduino.

Figure 1 - Open arduino.exe.

2. Open the LED blink example sketch: File > Examples > 1.Basics > Blink. You should see a window like in Figure 2.

Figure 2 - Load Blink Example in IDE.

3. Choose Tools > Board, then select your board, like in Figure 3.

Figure 3 - Select Intel® Edison from the Tools>Board menu

4. Select the serial device of the board from the Tools > Serial Port menu. See the instructions below for your specific OS.

Note: The easiest way to find what port the board is using is by disconnecting your board, restarting the IDE, and re-opening the menu. The entry that disappears should be the Intel Edison board. Reconnect the board, restart the IDE, and select that serial port.

On Windows*

One easy way to find what port the board is using is by disconnecting your board, restarting the IDE, and re-opening the menu; the entry that disappears should be the Intel® Edison board. Reconnect the board, restart the IDE, and select that serial port.

The port is likely to be COM3 or higher and is called "Intel Edison Virtual Com Port" in the Device Manager, like in Figure 4. It is NOT "USB Serial Port". COM1 and COM2 are usually reserved for hardware serial ports. Select your COM port, as shown in Figure 5.

Figure 4 - Select Intel Edison Virtual Com Port (COM#)

Figure 5 - Select COM port from Tools>Serial Port menu is using Windows*

Now the bottom right should match the COM port number of the 'Intel Edison Virtual Com Port (COM#)" from the Device Manager, like in Figure 6.

Figure 6 - The COM number should match the Intel Edison Virtual Com Port (COM#)

Once you have selected your port, continue to upload the sketch to your board.

On Linux*

The port is likely to be /dev/ttyACM0, like in Figure 7.

Figure 7 - Select /dev/ttyACM0 from the Tools>Serial Port menu is using Linux*

Note: If the /ttyACM* port is not available, here are several reasons why

  • Modem manager is using the port. When the port becomes active, modem manager can claim the port, blocking the IDE's access to the port. The exact command to remove it will depend on your Linux distribution. For example, the command
    sudo apt-get remove modemmanager

may work.

  • The /ttyACM port was not created automatically when you plugged in your board. To add the port do the following:

a. Create a file etc/udev/rules.d/50-arduino.rules

b. Add the following to the file

          KERNEL=="ttyACM[0-9]*", MODE="0666"

c. Restart the udev with the following command

          sudo service udev restart

If you are using a virtual machine (VM), you may need to reboot Linux within the VM.

  • If you still are not able to see the port in the IDE, it may be because your user hasn't been added to the dialout group. Add yourself to the dialout group by
    sudo adduser your_user_name dialout

Then restart the IDE and try again.

Once you have selected your port, continue to upload the sketch to your board.

On Mac OS X*

The port is likely to be /dev/cu.usbmodemxxxx, like in Figure 8.

Figure 8 - Select /dev/cu.usbmodemxxxx from the Tools>Serial Port menu is using OS X*

5. Click the Upload button in the upper left to load and run the sketch on your board, like in Figure 9.

Once you have selected your port, continue to upload the sketch to your board.

Uploading the sketch to your board

  1. Click the Upload icon in the upper left to load and run the sketch on your board.
  2. You should see Done Uploading and Transfer complete messages when your sketch has uploaded.

  3. The DS2 LED on your board should now blink on or off every second.

Next Steps

If you have the Grove Starter Kit Plus Intel IoT Edition, here's how you add sensors:

1. Navigate to the Seeed-Studio github repo, https://github.com/Seeed-Studio/Sketchbook_Starter_Kit_V2.0.

2. Click Download ZIP (see Figure 12).

Figure 12 - Navigate to Seeed-Studio github.

3. Unzip, and copy to /libraries folder in your Arduino* folder.

4. remove the period "." in the folder name to make it: "Sketchbook_Starter_Kit_V20"

5. Restart the Arduino* IDE.

6. Connect your desired sensor and run the code.

Troubleshooting

Resources

For more resources visit the Intel® Edison Developer Resources page

Blink Without Delay Example

Intel® Developer Zone for IoT

Start inventing today with the Intel® IoT Developer Program which offers knowledge, tools, kits and a community of experts to quickly and easily turn your innovative ideas into IoT Solutions.

Dream it, Build it with the Intel® IoT Developer Kit for Intel® Edison and Intel® Galileo platforms. These kits are versatile, performance-optimized and fully integrated end-to-end IoT solutions supporting a variety of programming environments, tools, security, cloud connectivity and hardware.

For more resources and to learn how the new Intel® IoT Developer Kit v1.0 can help streamline your IoT projects: