ENVIRONMENT (IDE). The Wiring 
		environment includes a text editor and a compiler. It enables the creation 
		of software for the Wiring hardware within a carefully designed set of constraints.

Wiring Development Environment (PDE)
Wiring Environment Preferences
Sketchbook
Tabs, Multiple Files, and Classes
Application Upload

Top Wiring Development Environment

We've designed a simple and usable editor for writing and running programs in the Wiring hardware. The Wiring Environment (Integrated Development Environment or IDE) has a text editor and compiler for writing programs for the Wiring hardware. When the "run" button is clicked, the program compiles. The toolbar provides functionality for compiling programs, creating a new sketch, opening, saving, and exporting to the hardware. Additional commands are available through the menus. The message area gives feedback while saving and exporting and also shows the locations of errors when programs are compiled. The Serial Monitor text area presents messages and can be written from the Wiring board using with the Serial.print() programming function.


IDE screenshot

Software written using Wiring are called sketches. These sketches are written in the text editor. It has features for cutting/pasting and for searching/replacing text. The message area gives feedback while saving and uploading and also displays errors. The Serial Monitor displays text output by Wiring programs and text output from programs with the Serial.print() and Serial.println() functions, the console displays messages including complete error messages . The toolbar buttons allow you to run and stop activity, create a new sketch, open the circuit schematics for the sketch, open, save, upload and the Serial Monitor:

  Verify / Compile: Verifies the sketch code.
     
  Schematics: Open a window with the sketch circuit schematics if available.
     
  New: Creates a new sketch. In Wiring, projects are called sketches.
     
  Open: Select and load a pre-existing sketch. A menu opens and you may choose from your own sketchbook, examples, or you can open a sketch from anywhere on your computer or network.
     
  Save: Saves the current sketch into the Wiring sketches folder. If you want to give the sketch a name other than the current date, you can choose save As from the File menu.
     
  Upload to the Wiring hardware: Exports the current sketch into the sketchbook and uploads it to the Wiring hardware. The directory containing the files is opened. There is more information about uploading below
     
  Serial monitor: Opens the Serial Monitor Window and a serial port connection to monitor the data coming from the Wiring hardware, this is very useful for debugging and verification.

Additional commands are found within the five menus: File, Edit, Sketch, Tools, Help. The menus are context sensitive which means only those items relevant to the work currently being carried out are available.

File
Edit
Sketch
Tools
Window
Help
Top Preferences

It is possible to set some preferences directly from the editor. The preferences dialog box allows for quickly change some handy options as well a direct link to the actual preferences file for the application for changing details.

The preferences dialog include these options: Editor font size, smooth text, maximum memory for the application, delete previous exported code when uploading, use external editor, checking for updates, automatic start for serial monitor after upload, play a beep after upload or compile (two beeps will sound if an error is found), select the language of your preference for the reference and a link to the actual references.txt file on your system

Top Sketchbook

All Wiring projects are called sketches. Each sketch has it's own directory (folder) and inside there is the main program file which has the same name as the sketch. For example, if the name of the sketch is "Sketch_123", ", the directory for the sketch will be called "Sketch_123" and the main file will be called "Sketch_123.wiring" (or "Sketch_123.pde").

Sketches need other directories inside to contain additional code files. When a sketch is uploaded, all files are exported into into a single .hex file with the same name as the sketch. For example, if the sketch is named "Sketch_123", the exported file will be called "Sketch_123.hex"

Sketches are all kept in the Wiring directory, which will be in different places on your computer or network, depending if you use Windows, Mac, or Linux and how you have your preferences set. To locate this directory, select the "Preferences" option in "File" menu.

It is possible to have multiple program divisions in one sketch. Each of these divisions is visible as a tab in the area below the menu. When a program is compiled these divisions are made into one file and compile as a single program. Divisions can also be separate C++ files (the extension .cpp or .h) which are compiled together with the Wiring files. To add a new division, click on the arrow to the right of the tabs. You can write functions and classes in new divisions and you can write any C or C++ code in files with the .c, .h or .cpp extension.

Top Tabs, Multiple Files, and Classes

It can be inconvenient to write a long program within a single file. When programs grow to hundreds or thousands of lines, breaking them into modular units helps manage the different parts. Wiring manages files with the Sketchbook and each sketch can have multiple files that are managed with tabs. The arrow button in the upper-right corner of the Wiring Development Environment is used to manage these files. Click this button to reveal options to create a new tab, rename the current tab, and delete the current tab. If a project has more than one tab, they can also be hidden and revealed. Hiding a tab temporarily removes that code from the sketch (it will not be compiled with the program when you press Verify/Compile).

Tabs are intended for more advanced users, and for this reason, the menu that controls the tabs is intentionally made less prominent.

For programmers familiar with C/C++. When a program with multiple tabs is run, the code is grouped together. When .cpp .h or .c files are added, they are copied into the sketch folder and are compiled when the sketch is compiled but they are not preprocessed (errors on these type of files may not be highlited within the file). Use this feature to develop new libraries or classes within a project with immediate testing.

Top Application Upload

Upload creates a version of the sketch that can run within the Wiring hardware. When code is exported from Wiring, the preprocessor add the function headers and includes to be a full C++ program and then the code is compiled. When a project is uploaded, a series of files are written to an "build" directory which is created within the primary sketch directory. If the sketch is called "Sketch_123", the build directory contains among many other files the following:

Sketch_123.cpp.hex
HEX file containing all necessary code for the sketch to run on the Wiring hardware. Includes the Wiring code as well as those custom to the sketch.

Sketch_123.cpp
The C++ file generated by the pre-processor from the PDE file. This is the actual file which is compiled into the HEX file by avr-g++, the C++ Compiler used in Wiring for the AVR8 Core.

Sketch_123.wiring (or Sketch_123.pde)
The original program file.


Every time a sketch is uploaded, all of the above files are re-written.

When a sketch is uploaded, all files (including those in the sketch folder and the sketchbook user libraries) are packed into a single .hex file.