The Arduino IDE is very user-friendly and simple to use.
Let’s explore how to use it by going through the Blink example that comes with the IDE’s built-in examples.
Steps:
- Open the Arduino IDE from the folder where you installed or unzipped it.
- In the File menu, go to Examples. Here, you will find a list of all the built-in examples that come with the IDE. Below the built-in examples, you will also find additional examples for various boards.
In this case, we will focus on the Blink example, which makes the LED on the Arduino board blink.
- Once you click on Blink, a new window will open with the sketch (Arduino refers to the code written in its IDE as a sketch) for the Blink program.
- Before uploading this code to the Arduino board, we need to configure the IDE for the specific board you are using. You also need to select the correct communication port and the method for uploading the code.
- Go to the Tools menu and select the Board option. It will display a list of available Arduino boards. Choose the board you are using from that list. In this example, we have selected the Arduino/Genuino Uno board.
Arduino and Genuino are essentially the same; outside of the USA, Arduino boards are branded as Genuino.
- Next, select the appropriate communication port through which your computer or laptop will communicate with the Arduino board. In the Tools menu, you will find the Port option. Choose the port to which your Arduino board is connected from the list of available ports.
- Now that the board and communication port are selected, we need to choose the appropriate programmer.
For this setup, we will be using the AVR ISP mk2 programmer.
- In the Arduino IDE, you’ll find six unique buttons, each serving a specific purpose:
- Verify Button: Used to verify (or compile) the sketch before uploading it.
- Upload Button: Used to upload (or burn) the sketch onto the Arduino board.
- New Sketch Button: Used to create a new sketch.
- Open Sketch Button: Used to open an existing sketch or a built-in example.
- Save Sketch Button: Used to save the current sketch.
- Serial Monitor Button: Used to open the serial monitor that comes with the Arduino IDE.
Note: While you can use the Arduino IDE’s serial monitor, you can also use other serial terminal programs like PuTTY, RealTerm, or TeraTerm. The Arduino serial monitor supports only one serial port at a time. If you need to observe multiple ports (for example, multiple Arduino boards connected to the same computer), you’ll need to use one of the alternative serial programs.
- Once the appropriate board, communication port, and programmer are selected, you can upload the Blink sketch to the board.
You can verify the sketch before uploading, though the IDE will automatically verify the sketch as part of the upload process.
- Since Blink is a built-in example sketch, there will be no warnings or errors during verification. If there are any issues, the IDE will display the errors in the black area below the code editor. This area is highlighted in red in the image below.
- Once you’ve verified the sketch, click Upload. After the upload is complete, you will see the “Done uploading” message. The LED on your Arduino board should now blink at one-second intervals.
12. This process should be followed for all sketches, whether they are built-in examples or custom sketches created by the user.