How to use the new Arduino 2.0 IDE

0

The Arduino IDE 2.0 has been in beta since early 2021 and around that time we took it for a test drive and liked what we saw. When Arduino announced that version 2.0 had been moved to a stable release, we just had to pull it out for another round.

Arduino IDE 2.0 brings a number of improvements to the original IDE. Most notably an updated user interface. Here are some other improvements for end users.

(Image credit: Tom’s Hardware)

The Arduino IDE 2.0 introduces code auto-completion, useful when entering large sections of code. As we type, the IDE suggests possible keywords/commands that we can use. This feature has been standard in many other IDEs and is a welcome addition to Arduino IDE 2.0.

(Image credit: Tom’s Hardware)

If you like your dark code editors, then Arduino IDE 2.0 has a plethora of themes to choose from.

(Image credit: Tom’s Hardware)

Found in File menu >> Preferences. Modify the theme to your liking and every facet of the editor will respond to your request.

(Image credit: Tom’s Hardware)

Finally the Serial Plotter got an update and now it looks great. The serial plotter is useful for measuring and interpreting analog signals and voltages.

Under the hood, Arduino IDE 2.0 sees improved compile time and built-in updates for our boards and software libraries. Speaking of updates, Arduino IDE 2.0 can also be updated from the app, so we don’t have to download the latest version from the Arduino website.

Getting to Know Arduino IDE 2.0

The best way to understand the new IDE is to use it. In this guide, we’ll download and install the new IDE, then use it to create a fun project using NeoPixels.

1. Open a browser and navigate to Arduino official website to download the installer for your operating system. We are using Windows 11 so downloaded the 64 bit version for our computer.

(Image credit: Tom’s Hardware)

2. Follow the installation process and, when done, start the Arduino 2.0 IDE.

3. Allow the Arduino IDE to pass through your firewall. The IDE will communicate with its servers to ensure that we have the latest version and software libraries.

(Image credit: Tom’s Hardware)

4. When prompted, install the USB driver. This allows the Arduino IDE to communicate with many different development boards, such as Arduino Uno and Raspberry Pi Pico.

(Image credit: Tom’s Hardware)

The new Arduino 2.0 IDE

The new IDE has had a lot of “front view” improvements, and we have to say, it looks amazing. Whether you’re new to Arduino or a seasoned pro, we’ve put together a quick reference on where to find the new features.

The Arduino 2.0 IDE has seen a major overhaul, but the most basic elements remain the same.

(Image credit: Tom’s Hardware)

1. This is the sketch area (Sketches are the Arduino language for our project files) where we write the code that makes our project.

2. The exit area This is where we see the output of installing new software libraries and debugging information when our code is flashed to a microcontroller.

What has changed is on the left side of the app. A new vertical menu contains quick access to a number of once-hidden, but well-used features.

(Image credit: Tom’s Hardware)

1. Sketchbook: Here all the sketches (our projects) are contained for quick access. Our sketchbook contains the demo project for this manual.

(Image credit: Tom’s Hardware)

2. Table manager: The Arduino IDE can be used with many different boards and this is where we can install their support.

3. Library manager: This is where we can install, update and remove software libraries for our projects. For example, we can install libraries to control NeoPixels, Wi-Fi and sensors.

4. Debug: Running the debug tool will show any errors in our code.

5. Look for: Use it to find specific value in your project. Here we use the search to find a specific constant that we use to control the speed of our demo project.

(Image credit: Tom’s Hardware)

6. Board selection: The Arduino IDE can work with many different boards and this dropdown makes it easy to switch boards and locate the correct COM port.

Configuring a card, installing software

Learning a new IDE, especially one that looks as good as the Arduino 2.0 IDE, is best done by taking on a project. We learn all new features and improve our workflow.

To test the Arduino 2.0 IDE, we created a simple project that uses Adafruit’s NeoPixel library for Arduino boards to create a quick RGB LED light show for dark nights.

1. Connect your Arduino Uno (or compatible) to your computer. Using a genuine Arduino is the best option, but compatible boards will work just as well.

2. Select your Arduino from the board selection drop-down list. This will configure the card and port out of the box. Other card types may require additional configuration.

(Image credit: Tom’s Hardware)

3. Skip this step if you are using a genuine Arduino. In the Cards drop-down list, click “Select another card and port”.

(Image credit: Tom’s Hardware)

4. Skip this step if you are using a genuine Arduino. Find your card, then select it and the correct port. If you are not sure about the port, see our guide for more information.

(Image credit: Tom’s Hardware)

5. Click on Library Manager and search for Adafruit NeoPixel. Select Adafruit NeoPixel from the list and click Install.

(Image credit: Tom’s Hardware)

Creating a NeoPixel project

NeoPixels, Adafruit’s term for WS2812B addressable RGB LEDs, is a great way to introduce microcontrollers and the new Arduino IDE. Why? Simply, they are great fun. We can control the color and brightness of each RGB LED to create animations and effects.

For this project you will need

(Image credit: Tom’s Hardware)

The circuit for this project is simple. Our NeoPixels are connected to the three GPIO pins of the Arduino. If you’ve never soldered before, never fear, because soldering the connections to your NeoPixels is simple. Take a look at our How to Solder Pins to Your Raspberry Pi Pico guide that will give you the basics. If you need a soldering iron, Pinecil V2 is a great iron for all budgets and all levels of users.

wire color Arduino GPIO NeoPixel
Red 5V VDC/V/5V
Yellow 6 Incoming data
Black Earth Earth

Connecting up to eight NeoPixels to an Arduino Uno is perfectly safe, but no more and you should consider external power supply for NeoPixels

We’ll use Adafruit’s NeoPixel library to control a short string of NeoPixels, changing their color from red to green to blue.

1. Click File >> New to create a new sketch. Erase the contents of the sketch.

2. Include the Adafruit NeoPixel library in the sketch. Python programmers will be familiar with this, in Python we import a code module.

#include 

3. Create three constants that will contain the GPIO pin used for the NeoPixel data pin, a pause (in ms), and the number of LEDs in our chain. We are using GPIO pin 6, and we want a 10ms pause between each LED color change and we have 96 LEDs in our chain. Best practice is to keep the number of LEDs below eight if using the 5V supply on the Arduino. In our example, we briefly used 96 to illustrate how a long strip of NeoPixels works.

#define LED_PIN    6
#define PAUSE 10
#define LED_COUNT 96

4. Declare the NeoPixel object and passing the number of pixels (LED), which GPIO pin is used, the configuration of the LED (RGB or GRB) and the pixel bitrate (usually 800 Hz).

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

5. Create a function, configure it and use it to initialize the NeoPixels, turn off the LEDs, then set the brightness to 25. Brightness is a value between 0 and 255. A value of 25 corresponds to 10% brightness.

void setup() {
 strip.begin();
 strip.show();
 strip.setBrightness(25);
}

6. Create a function, loop and use it to set the LED color to red, green and blue using a swipe action (we will create this function later). Use the PAUSE constant to add a 10 ms delay.

void loop() {
 colorWipe(strip.Color(255,   0,   0), PAUSE); // Red
 colorWipe(strip.Color(  0, 255,   0), PAUSE); // Green
 colorWipe(strip.Color(  0,   0, 255), PAUSE); // Blue
}

seven. Create the colorWipe function which takes color and delay time as arguments.

void colorWipe(uint32_t color, int wait) {

8. Inside the function, create a for loop that will loop through all the LEDs in the strip, set the color of each pixel before pausing for 10ms and then moving on to the next LED.

 for(int i=0; i

Complete list of codes

#include 
#define LED_PIN    6
#define PAUSE 10
#define LED_COUNT 96
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
 strip.begin();
 strip.show();
 strip.setBrightness(25);
}
void loop() {
 colorWipe(strip.Color(255,   0,   0), PAUSE); // Red
 colorWipe(strip.Color(  0, 255,   0), PAUSE); // Green
 colorWipe(strip.Color(  0,   0, 255), PAUSE); // Blue
}
void colorWipe(uint32_t color, int wait) {
 for(int i=0; i
Share.

About Author

Comments are closed.