Depth-First Message-Passing

Message Passing

In the previous section, what our first Ardestan patch does; It sends out the message: “Hello, world!” to your computer via its serial output. The message is received by the computer at it serial input, resulting the message to be shown in your Serial Monitor window inside the IDE.

Now, let’s learn what is happening in your first patch step-by-step. Before we begin explaining the detail, just keep this in Ardestan in your mind: “An Ardestan program consists of a number of objects that pass messages each other.”

In Ardestan, an object sends out a value from its outlet. When it is received by another object, the object may react to the incoming value; It may store the incoming value for later use, it may output some other value from its own outlet, or it may set the digital output high or low.

Here, we would like to clarify the difference between ‘a value’ and ‘a message’ in Ardestan. A value in Ardestan is some value such as 1, 2, 1.52, -11.3, bang, high, “Hello. world!” etc. We learn more about values in Ardestan in a later section. At this point, just remember it can be any integer number, decimal number, symbol or string (string is a sequence of characters). It can be stored within an Ardestan object and passed to other objects via connections built between objects. In Ardestan, when a value is passed to another object through a connection, we call it a message, as it is sent out from one object and received by another object to exchange the information, in man cases, to trigger a certain behavior at the receiver object.

Thus, an Ardestan patch is made of two or more Ardestan objects. Each object may generate a value, pass it to other objects as a message, receive a message, and do something when it received a message. In short, an Ardestan patch is executed by ‘message passing’ between objects.

Now let’s get into the details of what is happening in your first Ardestan patch. First, we need to know about the loadbang object (Figure 1). The loadbang object has a feature that it sends out a symbol value: bang, when your Arduino starts up (at this point, just think of ‘a symbol’ as a word consists of one or more characters, which is internally given its own unique ID.)

Figure 1: The loadbang object sends out a message (a symbol: bang) from its outlet,
and the string object receives it at its left inlet.

As shown in Figure 1, when the Arduino starts up, the loadbang object sends out a message (a symbol: bang) from its outlet and it is received by the string object at the left inlet. What does the string object do when it receives a message, a symbol: bang, at its inlet? It does immediately output the stored string value as a message (Figure 2).

Figure 2: The string object outputs a message (a string: “Hello, world!”).

Now, the serial_println object just received a message (a string: “Hello, world”).

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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