Your First Patch

Now, let’s write your first Ardestan program. Respecting the tradition of the hacker’s culture, we write a very simple program to display a message: “Hello, world!” inside the Serial Monitor pane of the Ardestan IDE.

Patch, Object, and Connection

A visual program in Ardestan is called ‘a patch.’ This is because Ardestan’s language design is originated from its predecessors, such as Max and PureData, both of which are quite popular in computer music and digital arts. In these languages, a visual program is called ‘a patch,’ possibly its visual program looks like a modular synthesizer patch of the good old time (see Figure 1 below).

Figure 1: An example of a modular synthesizer patch
(from the Wikimedia Commons, license: Creative Commons Attribution 2.0 Generic)

Similarly as in a synthesis patch above, a program is created by connecting various software modules in a Ardestan patch. We simply call each software module ‘an object’ or ‘an Ardestan object’ in Ardestan. We also refer a virtual cable that connects an output of an object to an input of another object (or the object that produces output itself) as ‘a connection’ in Ardestan.

Creating a New Patch

First, select the menu item: New Patch from the File menu to create a new program.

Figure 2: The New Patch menu item.

Then, you will see a new window inside the Ardestan IDE, tabbed with a title (“untitled”), as shown in Figure 3.

Figure 3: A New Patch is created.

Creating an Ardestan Object

To create our first Ardestan patch, we first place four Ardestan objects inside the patch window. To create an Ardestan object, just select the menu item: Object Box under the menu: Put.

Figure 4: Creating an object box.

Then, you should see an ‘object box’ in the patch window.

Figure 5: An object box is created inside the patch window.

Alternatively, you can use the shortcut key (command + 1 for macOS or control + 1 for other platforms). An object box will be created below the position under the mouse cursor.

At this point, it is still just an ‘object box’ and it is still not an Ardestan object. Just click the object box and type “loadbang” to the object box, then it will be changed as a “loadbang” object as below.

Figure 6: A loadbang object is created.

An object box can be dragged to anywhere inside the patch window. Let’s create more Ardestan objects and place them as below.

Figure 7: Four Ardestan objects are created.

Connecting Objects: Outlets and Inlets

You might have noticed that some Ardestan objects have one or more small rectangles at the top and at the bottom. These are called ‘inlets’ and ‘outlets’ respectively. An inlet is where an object receives an output value from another object and an outlet is where an object output a value.

In Ardestan, we connect inlets and outlets of various objects so that Ardestan objects can collaborate each other and perform the task you want to realize.

Figure 8: Connecting an inlet and an outlet.

Let’s create a connection between the loadbang object and the string object we already placed in the patch window.

First click an inlet of the loadbang object (left above), and then drag the mouse (right above). Move the mouse at the left outlet of the string object (left below) so that you can connect the inlet and the outlet. After you successfully connect them, the connection will be created between the inlet and the outlet (right below). Now that the connection is created, whenever the loadbang object output a value from its outlet, it will be received by the string object at its left inlet.

Let’s create one more connection between the string object to the serial_println object as below (Figure 9).

Figure 9: Your First Patch.

Now, let’s save your patch by selecting the menu item: File > Save.

Figure 10: The “Save” menu item.

As we haven’t given any file name, a dialog window will be shown as Figure 11. We name this file as ‘hello.ard’ and save it inside the project folder.

Figure 11: The save dialog window (This is the Japanese version).

If you successfully saved your file, it should show up in the Project Explorer window in the Ardestan IDE (Figure 12).

Figure 12: The “hello.ard” file is now shown in the Project Explorer window.

Building and Uploading Your First Patch

Now we have finished ‘coding’ of your first patch in Ardestan! Then. Let’s ‘compile’ your patch and then upload your program to Arduino.

First thing you need to do it to make it sure that your Arduino is connected to your computer. Then, select the menu item: Tools > Select Connected Board.

Figure 13: The “Select Connected Board” menu item

If you select this menu item, Ardestan will look for Arduino devices connected to your computer and show the dialog: “Select the Arduino device” as shown in Figure 14. your Arduino should show up in the connected box. Select one you want to upload your program and then press the OK button.

Figure 14: The Select the Arduino device dialog.

If you successfully selected the Arduino, the names of the Arduino and the connected port should show up in the window title of the Ardestan IDE as below (Figure 15).

Figure 15: The window title is changed.
Now it shows the names of the Arduino device and the connected port.

Now you are ready to compile and upload your program to the Arduino! Yet, how can we do it? Select the menu item: Project > Build and Upload (Figure 16). Then, the Ardestan IDE will start compiling your program and uploading it to the Arduino.

Figure 16: The “Build and Upload” menu item.

If you have successfully compiled and uploaded your patch, you should have seen the messages as in Figure 17 in the Console window in the Ardestan IDE.

Figure 17: The compilation/upload results are shown in the Console window in the Ardestan IDE.

At this point, you may haven’t seen anything even though you successfully compiled and uploaded your patch to the Arduino.

Let’s move to the next section: Serial Monitor to see what your first Ardestan patch is doing!.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s