Configuring Netbeans for Arduino Development
After spending some time using Eclipse and Arduino IDE for Arduino development, I’ve decided enough is enough! No longer will I put up with the unbearable hardship of using some other IDE. It’s NetBeans or bust! Well, it was a long road, but I’ve made it. If you’d like to make it too, then I can help.
First, we need to install the Arduino IDE. On Ubuntu, this is a simple apt-get:
sudo apt-get install arduino arduino-core gdb-avr
When that is finished, run the Arduino IDE.
Click Add when prompted about Dialout permissions
Enter your password
Before we can continue, we must logout, then log back in for the updated permissions to take effect.
Verify it works
Open Arduino IDE
Click File -> Examples -> 01.Basics -> Blink
A new window should launch with code for the basic blink program.
Plug your Arduino Uno into your computer via usb port. Click Tools -> Serial Port and select the correct Serial port
Click the Upload button on the toolbar. If all is well, your Pin 13 LED should start blinking.
Click Tools -> Options
Click on the C/C++ tab
In the bottom left corner, click Add…
In the Base Directory: field, enter the location of your AVR tool collection. apt-get put mine at /usr/bin
In the Tool Collection Family: dropdown, select GNU
In the Tool Collection Name: field, enter Arduino. Click OK when done
The various commands will be populated with the standard GNU toolkit commands. This is not what we want. Change them all to their avr equivalents: avr-gcc, avr-g++, avr-as, and avr-gdb. There is no avr-make, so leave it as the standard make. Feel free to clear the QMake Command: field.
Click the Code Assistance tab. Ensure the Tool Collection: dropdown has your Arduino toolchain selected and that the C Compiler tab is selected
Add arduino libraries. These are:
/usr/share/arduino/hardware/arduino/cores/arduino /usr/share/arduino/hardware/arduino/variants/[VARIANT] /usr/share/arduino/libraries
Click C++ Compiler. Add the same libraries as above
For our plugin, we’ll be using arduino-netbeans by Jaques Claudino
Click the above link, and navigate to Downloads. Download the latest Linux plugin.
When the download is completed, return to NetBeans.
Click Tools -> Plugins and click the Downloaded tab
Click Add Plugins…
Browse to the location of the downloaded plugin, select it, and click OK
Follow the wizard.
When prompted about an untrusted certificate, we might as well click Continue. After all, we are downloading software made by Some Guy, it’s not going to be signed by VeriSign or somesuch.
Click Finish when done.
Verify it works
Click File -> New Project…
Select Arduino and click Next >
Give your project a name, and click Finish.
First, open up the Makefile for your project, we have some changes to make
As the comments at the top of the Makefile say, we need to make some changes. First set COM_PORT to be the correct serial port.
Next Set ARDUINO_BASE_DIR to the correct installation path. For me, that is /usr/share/arduino
Next, uncomment the correct configuration. Since I am using an Uno, there is no change for me. However, if you have a different board, comment the Uno section and uncomment the correct board.
We should officially be set. In your main.cpp, implement the blink program. I recommend copying and pasting the one provided by Arduino IDE that we used previously. Be sure you don’t delete the #include and extern HardwareSerial Serial; lines.
When you are ready, click Clean and Build. Then click Run. If all is well, your onboard Pin 13 LED should blink.