Writing Sketches
Programs written using Arduino Software (IDE) are called sketches. These sketches are written in the text editor and are saved with the file extension .ino. The editor has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino Software (IDE), including complete error messages and other information. The bottom right-hand corner of the window displays the configured board and serial port. The toolbar buttons allow you to verify and upload programs, create, open, and save sketches, and open the serial monitor.
Note: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the extension .pde. It is possible to open these files with version 1.0, you will be prompted to save the sketch with the .ino extension on save.
- Verify: Compiles and approves your code. It will catch errors in syntax (like missing semicolons or parenthesis).
- Upload: Sends your code to the Arduino board.
- New: This buttons opens up a new code window tab.
- Open: This button will let you open up an existing sketch.
- Save: This saves the currently active sketch.
- Serial Monitor: This will open a window that displays any serial information your Arduino board is transmitting. It is very useful for debugging.
- Sketch Name: This shows the name of the sketch you are currently working on.
- Code Area: This is the area where you compose the code for your sketch.
- Message Area: This is where the IDE tells you if there were any errors in your code.
- Text Console: The text console shows complete error messages. When debugging, the text console is very useful.
- Board and Serial Port: Shows you what board and the serial port selections.
MENU
File
New - Creates a new instance of the editor, with the bare minimum structure of a sketch already in place.
Open - Allows to load a sketch file browsing through the computer drives and folders.
Open Recent - Provides a short list of the most recent sketches, ready to be opened.
Sketchbook - Shows the current sketches within the sketchbook folder structure; clicking on any name opens the corresponding sketch in a new editor instance.
Examples - Any example provided by the Arduino Software (IDE) or library shows up in this menu item. All the examples are structured in a tree that allows easy access by topic or library.
Close - Closes the instance of the Arduino Software from which it is clicked.
Save - Saves the sketch with the current name. If the file hasn't been named before, a name will be provided in a "Save as.." window.
Save as... - Allows to save the current sketch with a different name.
Page Setup - It shows the Page Setup window for printing.
Print - Sends the current sketch to the printer according to the settings defined in Page Setup.
Preferences - Opens the Preferences window where some settings of the IDE may be customized, as the language of the IDE interface.
Quit - Closes all IDE windows. The same sketches open when Quit was chosen will be automatically reopened the next time you start the IDE.
Edit
Open - Allows to load a sketch file browsing through the computer drives and folders.
Open Recent - Provides a short list of the most recent sketches, ready to be opened.
Sketchbook - Shows the current sketches within the sketchbook folder structure; clicking on any name opens the corresponding sketch in a new editor instance.
Examples - Any example provided by the Arduino Software (IDE) or library shows up in this menu item. All the examples are structured in a tree that allows easy access by topic or library.
Close - Closes the instance of the Arduino Software from which it is clicked.
Save - Saves the sketch with the current name. If the file hasn't been named before, a name will be provided in a "Save as.." window.
Save as... - Allows to save the current sketch with a different name.
Page Setup - It shows the Page Setup window for printing.
Print - Sends the current sketch to the printer according to the settings defined in Page Setup.
Preferences - Opens the Preferences window where some settings of the IDE may be customized, as the language of the IDE interface.
Quit - Closes all IDE windows. The same sketches open when Quit was chosen will be automatically reopened the next time you start the IDE.
Edit
Undo/Redo - Goes back of one or more steps you did while editing; when you go back, you may go forward with Redo.
Cut - Removes the selected text from the editor and places it into the clipboard.
Copy - Duplicates the selected text in the editor and places it into the clipboard.
Copy for Forum - Copies the code of your sketch to the clipboard in a form suitable for posting to the forum, complete with syntax coloring.
Copy as HTML - Copies the code of your sketch to the clipboard as HTML, suitable for embedding in web pages.
Paste - Puts the contents of the clipboard at the cursor position, in the editor.
Select All - Selects and highlights the whole content of the editor.
Comment/Uncomment - Puts or removes the // comment marker at the beginning of each selected line.
Increase/Decrease Indent - Adds or subtracts a space at the beginning of each selected line, moving the text one
space on the right or eliminating a space at the beginning.
Find - Opens the Find and Replace window where you can specify text to search inside the current sketch according to several options.
Find Next - Highlights the next occurrence - if any - of the string specified as the search item in the Find window, relative to the cursor position.
Find Previous - Highlights the previous occurrence - if any - of the string specified as the search item in the Find window relative to the cursor position.
Sketch
Verify/Compile - Checks your sketch for errors compiling it; it will report memory usage for code and variables in the console area.
Upload - Compiles and loads the binary file onto the configured board through the configured Port
Upload Using Programmer - This will overwrite the bootloader on the board; you will need to use Tools > Burn Bootloader to restore it and be able to Upload to USB serial port again. However, it allows you to use the full capacity of the Flash memory for your sketch. Please note that this command will NOT burn the fuses. To do so a Tools -> Burn Bootloader command must be executed.
Export Compiled Binary - Saves a .hex file that may be kept as archive or sent to the board using other tools.
Show Sketch Folder - Opens the current sketch folder.
Include Library - Adds a library to your sketch by inserting #include statements at the start of your code. For more details, see libraries below. Additionally, from this menu item you can access the Library Manager and import new libraries from .zip files.
Add File... - Adds a source file to the sketch (it will be copied from its current location). The new file appears in a new tab in the sketch window. Files can be removed from the sketch using the tab menu accessible clicking on the small triangle icon below the serial monitor one on the right side o the toolbar.
Tools
Auto Format - This formats your code nicely: i.e. indents it so that opening and closing curly braces line up, and that the statements inside curly braces are indented more.
Archive Sketch - Archives a copy of the current sketch in .zip format. The archive is placed in the same directory as the sketch.
Fix Encoding & Reload - Fixes possible discrepancies between the editor char map encoding and other operating systems char maps.
Serial Monitor - Opens the serial monitor window and initiates the exchange of data with any connected board on the currently selected Port. This usually resets the board, if the boar supports Reset over serial port opening.
Board - Select the board that you're using. See below for descriptions of the various boards .
Port - This menu contains all the serial devices (real or virtual) on your machine. It should automatically refresh every time you open the top-level tools menu.
Programmer - For selecting a harware programmer when programming a board or chip and not using the onboard USB-serial connection. Normally you won't need this, but if you're burning a bootloader to a new microcontroller, you will use this.
Burn Bootloader - The items in this menu allow you to burn a bootloader onto the microcontroller on an Arduino board. This is not required for normal use of an Arduino or Genuino board but is useful if you purchase a new ATmega microcontroller (which normally comewithout a bootloader). Ensure that you've selected the correct board from the Boards menu before burning the bootloader on the target board. This command also set the right fuses.
Help
Here you find easy access to a number of documents that come with the Arduino Software (IDE). You have access to Getting Started, Reference, this guide to the IDE and other documents locally, without an internet connection. The documents are a local copy of the online ones and may link back to our online website.
Here you find easy access to a number of documents that come with the Arduino Software (IDE). You have access to Getting Started, Reference, this guide to the IDE and other documents locally, without an internet connection. The documents are a local copy of the online ones and may link back to our online website.
Find in Reference
This is the only interactive function of the Help menu: it directly selects the relevant
page in the local copy of the Reference for the function or command under the cursor.
Is it possible to use PIC MCU on this software or it is only for Arduino MCU only?
ReplyDeleteGlad you asked Aldrin. If you intend to use or program a PIC MCU using the Arduino Software, that is possible. You just have to do some sort-of code combination and coded editing. Hope this one helps. :)
DeleteFor further reading got to http://circuitcellar.com/cc-blog/execute-open-source-arduino-code-in-a-pic-microcontroller-using-the-mplab-ide/
Ma'am, what is the difference between Upload and Upload Using Programmer?
ReplyDeleteThanks for your question Daisy. Upload is used when your done with the sketches and you already want to burn it in the Arduino Board, take note that this happens directly and does not need any other materials while Upload Using Programmer is used if you have an external programmer (e.g. an AVR-ISP, STK500, or parallel programmer), you can burn sketches to the Arduino board without using the bootloader. This allows you to use the full program space (flash) of the chip on the Arduino board. So with an ATmega168, you'll get 16 KB instead of 14 (on an ATmega8 you'll get 8 KB instead of 7). It also avoids the bootloader delay when you power or reset your board. Hope this one helps. :)
Deletemaam, what is the purpose of the button below the serial monitor?
ReplyDeleteThanks for the curiosity Marco. Well the button below the serial monitor is a drop down menu that provides options such as New Tab, Rename, Delete, Previous Tab, Next Tab and the Title of the sketch/program that you are currently working with. Hope this helps :)
Deletewhat if i used older version of arduino in doing my sketches, can i open that in the latest version?
ReplyDeleteGlad you asked Maureen. Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the extension .pde. It is possible to open these files with version 1.0, you will be prompted to save the sketch with the .ino extension on save. Hope this one helps :)
DeleteMa'am. What software that I can use other than Arduino software in programming on a arduino board?
ReplyDeleteThanks for asking Christian. It is possible to compile programs for the Arduino using other build tools (e.g. Makefiles and/or AVR Studio). You'll need to configure these to link against the appropriate files in the Arduino core libraries.
DeleteWhat is the difference of arduino software from the other software if I use them to compile programs in my arduino board?
DeletePlease specify the software that you are referring to Christian so that I can properly address your question. Thanks.
DeleteMakefiles or AVR Studio.
DeleteThe language is the same. The available symbols are different. You can either use Arduino IDE or Atmel Studio.The Arduino libary is more of a wrapper to make it easy to do things, like digitalWrite, which you do not have by default in Atmel Studio. Hope this one answered your question.
DeleteFor further reading, go to http://electronics.stackexchange.com/questions/84593/how-different-is-the-arduino-language-than-atmel-studio-language.