Uploading Code to an Arduino Board – Programming Arduino

- Advertisement -
 

Getting started with an Arduino board and uploading the code could be a little confusing for some beginners. Because getting all the details from one source is not always easy. For programming an Arduino board, first, you would need to install drivers, Arduino software, or Integrated Development Environment (IDE), and then upload the code (called a sketch) to the Arduino board.

It is applicable to PCs using Windows as the operating system (OS), including Windows 7, 8, and 10 versions. The steps are also applicable for Windows XP but some of the dialogue windows may be different.

Programming Arduino

The step-by-step procedure to upload code to an Arduino board is given below.

  1. Install Arduino IDE on your PC. You can download the latest version of Arduino software.
  2. Connect the Arduino board to your PC using a USB cable and wait for Windows to begin the USB driver installation process.
  3. If the Windows installer does not start automatically, open the Windows Device Manager from Start→ Control Panel option and find the Arduino under the Ports (COM&LPT) list.
  4. If Arduino is not found, go to Other Devices and select the Unknown Device option. Then update the driver.
  5. Select the Browse my computer for driver software option and go to the Arduino software download location and select Arduino.inf/Arduino uno.inf (depending on your software version) to install the driver.
  6. After successful installation of the driver, from the Arduino IDE select the Tools/Board option. From here select your Arduino board among those listed, such as Arduino Uno, Arduino Mega 2560, Arduino Leonardo, etc.
  7. Choose the correct serial COM port for your board. The COM port number will be visible under the Device Manager.
  8. Open the source code/sketch, compile it and upload the code to the Arduino board by clicking the Upload button. If you do not have the sketch ready, the easiest way to start with the Arduino programming is to use the ‘Blink’ sketch from the Examples in Arduino. You can access Blink source code from the File→Examples→Basics option, as shown in Fig. 1.
  9. Compile the code and upload it to the Arduino board.
Arduino Example Code
Arduino IDE Blink
- Advertisement -

After uploading the code, you can access the Arduino pins or interface the pins with other devices.

We hope now you know how to upload code to Arduino.

So let’s check and try hands on these interesting Arduino Projects

Most Common Errors when uploading code to Arduino

When programming Arduino, you may face the below errors. So let’s discuss how we can solve these errors.

1. Exit Status 1

You can get this error either during compilation or uploading. Check the preceding lines in the error output for specific information.

If it is showing a compilation error, then check the code. Otherwise check the ports and connections.

2. No device found on <port>

  • Make sure the correct port is selected in Tools > Port.
  • Close other instances that may be blocking the port e.g. Arduino IDE, serial monitors, and other software.
  • Restart your computer.

3. Couldn’t find a Board on the selected port

If the board on the selected port has been disconnected from the computer or reassigned to a different port, then you can face this error. To overcome this error, make sure you have selected the correct port.

  1. Make sure the board is connected to your computer.
  2. Select the board in Tools > Port.

If it is correct, try pressing the board’s reset button after initiating the upload.

4. dfu-util: No DFU capable USB device available
Upload error: Failed uploading: uploading error: exit status 74

  1. Make sure the board is connected to your computer.
  2. Make sure that the right board is selected in Tools > Board.
  3. Make sure the correct port is selected in Tools > Port.
  4. Close other instances that may be blocking the port e.g. Arduino IDE, serial monitors, and other software.
  5. Restart your computer.

5. jssc.SerialPortException: Port name – <port>; Method name – openPort(); Exception type – Port busy

  1. Make sure the correct port is selected in Tools > Port.
  2. Close other instances that may be blocking the port e.g. Arduino IDE, serial monitors, and other software.
  3. Restart your computer.

Still, if you face any issues or have any doubts, please feel free to ask in the comments below.

Or you can discuss it with the community of electronics experts using this Forum.

SHARE YOUR THOUGHTS & COMMENTS

 
 

What's New @ Electronicsforu.com

Most Popular DIYs

Electronics Components

Truly Innovative Tech