How To Use The New Arduino IDE 2.0
The Arduino IDE 2.0 has been in beta since early 2021 and in those early days we took it for a test drive and liked what we saw. When Arduino announced that 2.0 was moving to a stable release, we just had to take it out for another round.
Arduino IDE 2.0 brings a number of improvements over the original IDE. Above all, an updated user interface. Here are a few more end-user improvements.
The Arduino IDE 2.0 introduces automatic code completion, which is useful when entering large chunks of code. As we type, the IDE will suggest 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.
If you like your code editors dark, then Arduino IDE 2.0 has a plethora of themes to choose from.
Found in the File >> Settings menu. Change the theme to your liking and every facet of the editor will suit your needs.
Finally the Serial Plotter has received an update and now it looks stunning. 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 in-app updates for our boards and software libraries. Speaking of updates, Arduino IDE 2.0 can also be updated through the app, saving us the trouble of downloading the latest version from the Arduino website.
Getting to know the Arduino IDE 2.0
The best way to understand the new IDE is to use it. In this guide we will download and install the new IDE and then use it to create a fun project with NeoPixels.
1. Open a browser and go to Official Arduino website to download the installer for your operating system. We use Windows 11 so we downloaded the 64-bit version for our computer.
2. Follow the installation process and, When finished, launch the Arduino 2.0 IDE.
3. Allow the Arduino IDE through your firewall. The IDE communicates with their servers to ensure we have the latest version and software libraries.
4. If 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.
The new Arduino 2.0 IDE
The new IDE has seen many front of house 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 guide on where to find the new features.
The Arduino 2.0 IDE has undergone a major overhaul, but the most basic elements remain the same.
1. This is the sketcha (sketches are Arduino lingo for our project files) where we will write the code that makes our project.
2. The output area Here we see the output from installing new software libraries and debug information when our code is flashed to a microcontroller.
What has changed is to the left of the application. A new vertical menu provides quick access to a range of once-hidden but well-used features.
1. Sketchbook: Here are all the sketches (our projects) are included for quick access. Our sketchbook contains the demo project for this tutorial.
2. Board Manager: The Arduino IDE can be used with many different boards and here we can install support for it.
3. Library manager: Here 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 all the errors in our code.
5. Seek: Use this to find a specific value in your project. Here we use search to look for a specific constant that we use to control the speed of our demo project.
6. Board selection: The Arduino IDE can work with many different boards and this drop down list makes it easy to switch boards and find the correct COM port.
Configure board, install software
Learning a new IDE, especially one that looks as good as the Arduino IDE 2.0, is best accomplished by completing a project. We get to know all the 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 those dark nights.
1. Connect your Arduino Uno (or compatible) to your computer. Using a real 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 configures the board and port ready for use. Other board types may require additional configuration.
3. Skip this step if you are using a real Arduino. From the Boards drop-down list, click Select other board and port.
4. Skip this step if you are using a real Arduino. Browse for your board and select it and the correct port. If you are not sure about the port, See our guide for more information.
5. Click on the library manager and search for Adafruit NeoPixel. Select Adafruit NeoPixel from the list and click Install.
Creating a NeoPixel project
NeoPixels, Adafruit’s term for WS2812B addressable RGB LEDs, are a great way to introduce microcontrollers and the new Arduino IDE. Why? They’re just great fun. We can control the color and brightness of each RGB LED to create animations and effects.
For this project you will need
The circuit for this project is simple. Our NeoPixels connect to the Arduino’s three GPIO pins. If you’ve never soldered before, fear not as soldering connections to your NeoPixels is easy. Check out ours How to solder pins to your Raspberry Pi Pico Guide that teaches you the basics. If you need a soldering iron, Pinecil V2 is a great iron for all budgets and user levels.
wire color | Arduino GPIO | NeoPixel |
Red | 5V | VCC / V / 5V |
Yellow | 6 | data in |
Black | Dimensions | Dimensions |
Connecting up to eight NeoPixels to an Arduino Uno is perfectly safe, but consider more external power supply for the NeoPixels
We’re going to use Adafruit’s NeoPixel library to control a short chain of NeoPixels, changing their color from red to green and then to blue.
1. Click File >> New to create a new sketch. Erase the contents of the sketch.
2. Paste the Adafruit NeoPixel library into the sketch. Python programmers will be familiar with this, in Python we import a code module.
#include <Adafruit_NeoPixel.h>
3. Create three constants containing 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 under eight when using the 5V supply on the Arduino. In our example, we briefly used 96 to illustrate how a long strip of NeoPixel works.
#define LED_PIN 6
#define PAUSE 10
#define LED_COUNT 96
4. Declare the NeoPixel object and Passing the number of pixels (LEDs), which GPIO pin is used, configuration of the LED (RGB or GRB) and the bitstream of the pixels (typically 800 Hz).
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
5. Create a function, set it up and use it to initialize the NeoPixels, turn off the LEDs and 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 color of the LEDs to red, green and blue with a swipe action (We will create this function later). Use the PAUSE constant to add a 10ms 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
}
7. Create the colorWipe function that takes the color and the delay time as arguments.
void colorWipe(uint32_t color, int wait) {
8th. Inside the function, create a for loop that iterates through all the LEDs in the strip. Adjust the color of each pixel before pausing 10ms and then moving on to the next LED.
for(int i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}
Complete code list
#include <Adafruit_NeoPixel.h>
#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<strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}