Receiving the Output from Your First Patch
In the previous section, we created our first Ardestan patch and then compiled the patch/uploaded to the Arduino. However, we still haven’t seen anything yet. To see what your program does, let’s click the ‘Serial Monitor’ tab and see the Serial Monitor window in the Ardestan IDE (Figure 1).
You see the ‘active’ checkbox on the top left of the Serial Monitor window. Let’s click it as shown in Figure 2. By doing so, we can see the input from your Arduino inside the Serial Monitor window.
Now, You may have seen a message printed out by your Arduino: “Hello, world!” in the Serial Monitor window (Figure 3).
If you don’t see any, just reset your Arduino by pushing its reset button on board. If you push it again, then you will see one more “Hello. world!” message inside the Serial Monitor. You can repeat this as many as you want (Figure 4).
What is a Serial Monitor?
Now, we are sure that our first Ardestan patch is working fine! Yet, you might still have one question: “What is a Serial Monitor?” at this point, if this is your first experience with the Arduino. So, let’s learn what it is now.
To use an Arduino and upload a program, you need to connect your Arduino and computer with a USB cable, as you already know. Via the USB interface, your computer can ‘talk’ to the Arduino so that you can upload an Arduino program.
This USB connection can be also used to let your Arduino program communicate with the Ardestan IDE (or other software on your laptop). This is what we have done in our first Ardestan patch, and our program used the serial output via the USB interface to let the Arduino output the message to your Serial Monitor window.
As shown in Figure 5, when a serial connection is established between the Arduino and your computer, The data that your Arduino output at its serial output is received at the serial input of your computer and vice versa. Then, what ‘Serial’ means? At this point, just simply think that it is called ‘serial’ as the communication between your Arduino and computer is by sending just one bit at one time (conversely, if the communication is performed by sending two more bits altogether simultaneously, it is called ‘parallel’).
It is also required to coordinate the speed of the serial communication by making it sure that the both sides (your Arduino and your computer) communicate. Hence, we need to set the ‘baud rate’ (the speed of the serial communication) the same on both sides. In Figures 1, 2, and 4, you see the baud rate is set to 9600 bps (bit per second) on the side of the Serial Monitor (on your computer).
Similarly, as shown in Figure 6, the ‘serial’ object is given the number 9600 after its object name (such a value is called ‘an argument’ in Ardestan. We will learn about this a bit later). This sets up the speed of the serial communication (baud rate) on your Ardestan to 9600 bps.
Now we learned that we are using the serial output from the Arduino to send out the message “Hello, world!” (which is received by the serial input of your laptop and shown in the Serial Monitor window). In the next section, we learn about the other part of our first patch.
Next: Depth-First Message-Passing