This is an old revision of the document!
Table of Contents
Configuring Netbeans for Arduino Development
My current favorite tool for developing non-trivial Arduino projects is Netbeans with C++ support. This documents my setup. It has been vetted with NetBeans 8.2.
The tool collection
NetBeans will want to know where the build tools for your project live so code completion and other things work correctly. Set up a new tool collection for Arduino along the lines of the figure below:
If you are using something other than an Arduinos with AVR microcontrollers, the paths will need to be adjusted.
The Makefile and config
I use either Arduino-Makefile or my own Arduino-Build to do the actual building. I won't cover using either of those in any depth here as they are each their own thing. However, you can use the following as a cheatsheet for setting things up.
Arduino-Makefile
When creating a new project with Arduino-Makefile, your local project Makefile should look something like the following:
- Makefile
# Project config ARDUINO_LIBS = SoftwareWire AsyncTimer BOARD_TAG = pro BOARD_SUB = 16MHzatmega328 MONITOR_PORT = /dev/ttyUSB0 MONITOR_CMD = screen-wrap # "Platform" config ARDUINO_QUIET = true ARDUINO_SKETCHBOOK = $(HOME)/Arduino ARDUINO_DIR = $(HOME)/opt/arduino ARDMK_DIR = $(HOME)/Build/Arduino-Makefile # Include parent Makefile from <https://github.com/sudar/Arduino-Makefile> include $(HOME)/Build/Arduino-Makefile/Arduino.mk
Arduino-Build
If you're using Arduino-Build, then your project's Makefile should resemble the following:
- Makefile
# Point BB at the arduino-build.sh script BB=<your-path-to>/arduino-build.sh # You shouldn't have to change any of these. .PHONY : compile clean upload monitor upmon build: $(BB) build clean: $(BB) clean upload: $(BB) upload monitor: $(BB) monitor upmon: upload monitor
You will also need an arduino.conf
file in the root of your project that looks like:
- arduino.conf
# === Arduino path === ARDUINO_PATH=/home/mithat/opt/arduino # === Board parameters === BOARD_PACKAGE=arduino BOARD_ARCHITECTURE=avr BOARD=nano BOARD_PARAM="cpu=atmega328old" # === Communication settings === PORT=/dev/ttyUSB0 SPEED=9600
See the Arduino-Build readme for information on figuring out the board parameters and other fiddly bits.
Code completion
While your setup should be working now, NB will be shouting at you a lot about things not being defined, etc. That's because you need to add code completion directories to the tool collection. Do this on the Code Completion > C++ tab of the tool collection dialog.