Thanks to the great people working on the Arduino IDE, it has everything you need to compile grbl included in their software package. This method compiles the Grbl source code and automatically uploads it to an Arduino.
NOTE: Before starting, delete prior Grbl library installations from the Arduino IDE. Otherwise, you'll have compiling issues! On a Mac, Arduino libraries are located in ~/Documents/Arduino/libraries/. On Windows, it's in My Documents\Arduino\libraries. On Linux (Ubuntu), it's in /usr/share/arduino/libraries
- If you don’t already have the Arduino IDE installed do so now
- Download the Grbl source code from the github directory.
· Click on the <>Code Tab
· Click the CLONE/DOWNLOAD button on the Grbl home page.
· Click the Download ZIP
· Unzip the download and you'll have a folder called grbl-XXX, where XXX is the release version.
- Launch the Arduino IDE
· Make sure you are using the most recent version of the Arduino IDE!
- Load the grbl folder into the Arduino IDE as a Library.
· Click the Sketch drop-down menu, navigate to Include Library and select Add .ZIP Library. The Add .ZIP Library command supports both a .ZIP file or a folder. In our case, there is no .ZIP file.
· You can confirm that the library has been added. Click the Sketch drop-down menu again, navigate to Include Library, then scroll to the bottom of the list where you should see grbl.
· IMPORTANT: Select the grbl folder inside the grbl-XXX folder, which only contains the source files and an example directory.
· If you accidentally select the .zip file or the wrong folder, you will need to navigate to your Arduino library, delete the mistake, and re-do Step 3.
- Open the GrblUpload Arduino example.
· Click the File down-down menu, navigate to Examples->Grbl, and select GrblUpload.
· Do not alter this example in any way! Grbl does not use any Arduino code. Altering this example may cause the Arduino IDE to reference Arduino code and compiling will fail.
- Compile and upload Grbl to your Arduino.
· Connect your Arduino Uno to your computer.
· Make sure your board is set to the Arduino Uno in the Tool->Board menu and the serial port is selected correctly in Tool->Serial Port.
· Click the Upload, and Grbl should compile and flash to your Arduino! (Flashing with a programmer also works by using the Upload Using Programmer menu command.)
Note: Remember to apply the correct settings for your build – common build settings found here
Compiling GRBL or Advanced Users: Most users are just fine with Grbl's default build, but you can customize Grbl by editing the config.h file in the Arduino library (not where you downloaded it, it has been copied into Arduino Library) folder. This file enables or disables all of Grbl's additional compile-time options. There are descriptions in the file that explains what they all do. Once edited and saved, just follow the steps above to flash your custom Grbl build!
No fuss! No muss!
NOTE: If you are having upload issues, try re-burning the Arduino bootloader. If you have a spare Arduino, it's easy!