New Sketch
Browse / Arduino IDE Cheatsheet
Arduino IDE Cheatsheet
A quick reference for the Arduino Integrated Development Environment, covering essential keyboard shortcuts, navigation, coding tips, and workflow essentials.
Basic Operations & Editing
File & Navigation Shortcuts
|
|
Open Sketch |
|
Save Sketch |
|
Save Sketch As... |
|
Close Window |
|
Quit IDE |
|
Next Tab |
|
Previous Tab |
|
Code Editing Shortcuts
Cut |
|
Copy |
|
Paste |
|
Undo |
|
Redo |
|
Select All |
|
Find |
|
Find Next |
|
Find Previous |
|
Sketch Structure
Every Arduino sketch must contain two functions:
|
Comments: Use comments to explain your code. They are ignored by the compiler.
|
Variable Declaration: Variables are declared before they are used, typically at the beginning of
|
Include Libraries: Libraries provide extra functionality. Include them at the very top of the sketch.
|
Datatypes: Common datatypes include:
|
Functions: User-defined functions can be created to organize code. Define them outside of
|
Compilation & Upload
Verify & Upload Actions
Verify Sketch |
|
Upload Sketch |
|
Upload Using Programmer |
|
Show Sketch Folder |
|
Show Verbose Output during Compilation/Upload |
File -> Preferences -> Show verbose output |
Export Compiled Binary |
Sketch -> Export Compiled Binary |
Burn Bootloader |
Tools -> Burn Bootloader |
Error Handling Tips
Read the Output: The black console area at the bottom provides error messages. The first error is often the root cause. |
Syntax Errors: Look for missing semicolons ( |
Compiler Errors: Messages like “‘symbol’ was not declared in this scope” usually mean you misspelled a variable/function name, or it’s out of scope, or you forgot to |
Linker Errors: Often relate to libraries or functions that aren’t correctly implemented or found. Check library installation and includes. |
Upload Errors: Problems communicating with the board. Ensure the correct board and port are selected (Tools menu). Check USB cable, board connection, and bootloader state. Sometimes a double-tap on the reset button helps. |
Common Typos: |
Use Auto Format: |
Google the Error: Copy and paste the exact error message into a search engine. Chances are, someone else has had the same problem. |
Board & Port Selection
Select Board |
Tools -> Board -> [Select your board] |
Select Port |
Tools -> Port -> [Select your COM or /dev/tty port] |
Install Board Packages |
Tools -> Board -> Boards Manager… |
Install Library |
Sketch -> Include Library -> Manage Libraries… |
Add .ZIP Library |
Sketch -> Include Library -> Add .ZIP Library… |
Check Board Info |
Tools -> Get Board Info |
Programmer Selection |
Tools -> Programmer -> [Select your programmer type] |
Tools, Libraries & Tips
Serial Monitor & Plotter
Open Serial Monitor |
|
Open Serial Plotter |
Tools -> Serial Plotter |
Set Baud Rate |
Dropdown menu in Serial Monitor/Plotter |
Send Data (Serial Monitor) |
Type in input box, hit Enter or Send button |
Clear Output (Serial Monitor) |
Click ‘Clear output’ button |
Autoscroll (Serial Monitor) |
Checkbox ‘Autoscroll’ |
Example `Serial.print` |
|
Library Management
Using the Library Manager:
|
Including in Sketch: After installing, include the library at the top of your sketch using
|
Adding a .ZIP Library:
|
Finding Examples: Installed libraries often come with examples. Go to |
Where Libraries are Stored: Usually in your Arduino sketchbook folder (
|
Updating Libraries: The Library Manager will show if updates are available for installed libraries. |
Troubleshooting Libraries: Ensure the library is compatible with your board. Check the library documentation or GitHub page for requirements. |
Tips & Advanced Features
Coding & Debugging Tips
Use Serial.print() for Debugging: Print variable values, messages, or states to the Serial Monitor to understand code execution flow. |
Define Constants: Use |
Use |
Avoid |
Name Pins Clearly: Give pins descriptive names using constants (e.g., |
Break Down Code into Functions: Organize reusable blocks of code into separate functions to improve readability and maintainability. |
Check Examples: The built-in examples ( |
Use |
IDE Preferences
Access Preferences: |
Sketchbook Location: Change the default folder for your sketches and libraries. |
Editor Language: Change the language of the IDE interface. |
Editor Font Size: Adjust text size in the code editor. |
Show Verbose Output: Enable detailed output during compilation and upload (mentioned before, useful for debugging). |
Compiler Warnings: Set warning levels (e.g., ‘More warnings’) to catch potential issues in your code. |
Check for Updates: Configure whether the IDE checks for software updates automatically. |
Useful Menu Items
Import .pde Sketch |
File -> Import .pde Sketch |
Examples |
File -> Examples -> [Built-in, Libraries] |
Manage Libraries |
Sketch -> Include Library -> Manage Libraries… |
Manage Boards |
Tools -> Board -> Boards Manager… |
Auto Format |
Tools -> Auto Format |
Archive Sketch |
Sketch -> Archive Sketch |
Serial Monitor |
Tools -> Serial Monitor |
Serial Plotter |
Tools -> Serial Plotter |