Upload your first code into Arduino

Upload your first code into Arduino

Ah yes, it is finally time to make your Arduino do something! We’re going to upload our very first code into the arduino. We’ll start with the classic hello world! of electronics, a blinking light.

This lesson will basically get you up and running using the Arduino software and uploading a sketch into the Arduino board. Once you’ve completed this step we can continue to the really exciting stuff, which is when we start writing our own sketches!

First lets see what we need for this tutorial !!

   Well, for this tutorial we only need:
                 1) Arduino Uno or Arduino Mega
                 2) An Arduino Cable
                 3) PC or Laptop (For now we’ll be showing this on windows only)

Arduino Uno                                                Arduino Mega

Arduino_uno rsz_arduinomega2560_r3_fronte

Installing the software

Get the latest version from the download page clicking the Windows installer which includes all the drivers. This will save you a lot of troubles!

When the download finishes, proceed with the installation and allow all driver installation requests.

DRV_Capture1

Tick all the components to install and press Next >. Choose the installation directory (we suggest to keep the default one)

The process will extract and install all the required files to execute properly the Arduino Software (IDE)

Connecting and Uploading the Code

  1. Connect the board to your computer using the USB cable. The green power LED should go on.
  2. Launch the program that you just installed. You should see something like this:ide_arduino
  3. Delete everything and write/paste the following code:
    void setup() {
      pinMode(13, OUTPUT);
    }
    
    void loop() {
      digitalWrite(13, HIGH);
      delay(1000);              
      digitalWrite(13, LOW);   
      delay(1000);              
    }

     

  4. Select your board
    You’ll need to select the entry in the menu.
    from Tools > Board > Arduino/Genuino Uno  (for Arduino Uno)
    or  Tools > Board > Arduino/Genuino Mega or Mega 2560  (for Arduino Mega)
    board selection_opt
  5. Select the serial device of the board from the Tools > Port: “COM….” menu. This is likely to be COM3 or higher. To find out, you can disconnect your board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.
    port selectionrsz_mega processor
    if you are using the Arduino Mega , there’ll be an additional option below the Bord:”…”
    named Processor: “Atmega2560”
    Just make sure you don’t change it.


    In case you can’t select any Port while the Arduino is connected(the green light is on), that means you need manual driver installation. Don’t panic, just follow these easy instructions on Arduino Driver Installation
    and we will be good to go in no time!


  6. Now, simply click the “Upload” button in the environment. (You will be prompt to) Save the file, wait a few seconds – you should see the RX and TX leds on the board flashing. If the upload is successful, the message “Done uploading.” will appear in the status bar.

 

A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does, Congratulations! You’ve gotten your Arduino up-and-running.

If you have problems, please see the troubleshooting suggestions.

 


What are your thoughts?