ENVIRONMENT (IDE). The Processing 
		environment includes a text editor, a compiler, and a display window. It enables the creation 
		of software within a carefully designed set of constraints.

Wiring Development Environment (PDE)
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. 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 I/O Board. 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 text area presents messages and can be written from the I/O Board using with the 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 console displays text output by Wiring programs including complete error messages and text output from programs with the Serial.print() and Serial.println() functions. The toolbar buttons allow you to run and stop activity, create a new sketch, open, save, and uload:

  Verify / Compile: Verifies the sketch code.
     
  Schematics: Open a window with the scketch 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 a serial port connection to monitor the data comming 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
Help
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.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 PC, Mac, or Linux and how you have your preferences set. To locate this directory, select the "Preferences" option in the "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) 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 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 .ccp .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 will 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, it is changed into C++ code and then compiled. When a project is uploaded, a series of files are written to an "applet" directory which is created within the primary sketch directory. If the sketch is called "Sketch_123", the applet directory contains for following:

Sketch_123.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.

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. Libraries not needed for the application should be deleted before uploading to keep the files size small.