6 Replies Latest reply on Sep 9, 2015 6:40 AM by JinLemon

    Print strings on multiple monitors with Galileo Gen2

    JinLemon

      Hello to everyone.

      In these days I'm working with my Galileo Gen 2 on a project involving the pthreads on an Arduino sketch.

      To show how are working 2 different threads, I would try, for each thread, to print a string in a different monitor: so, for example, thread1 will print on a monitor and thread2 will print on another. I know that the Arduino IDE has a unique Serial Monitor, but I was thinking to wire a display on a different port, or something other I don't know.

      I searched on internet about this argument but for now I didn't find anything, there's a chance that this thing could work?

       

      Thanks for any help,

       

      Best regards

        • 1. Re: Print strings on multiple monitors with Galileo Gen2
          DiegoV_Intel

          Hi JinLemon,

           

          That's possible. Galileo has two Serial objects: Serial and Serial1. The Serial object is the one that sends data to the Serial Monitor, and the Serial1 object sends data to the Tx pin (pin 1). You can use one Serial object in each thread. Take a look at the screenshot below, I did a quick test to show you the result:

           

          Two_Monitors_Test.JPG

           

          The "Monitor_1" message is shown in the Serial Monitor with the Serial.println(“Monitor_1”) statement, and the "Monitor_2" message is shown using the Serial1.println(“Monitor_2”) statement. Notice that the "Monitor_2" message is shown in a PuTTY session. Luckily, I had a MCP2221 which is a USB - UART converter, so I connect it to the Tx pin of the Galileo (pin 1) and I opened the COM port associated to the MCP2221 in my computer to see the data received.

           

          Regards,

          Diego.

          • 2. Re: Print strings on multiple monitors with Galileo Gen2
            JinLemon

            Thank you very much, this is what I needed!

            Unfortunately I haven't that component. So the only way to communicate with Serial1 output is through pin1 right?

            • 3. Re: Print strings on multiple monitors with Galileo Gen2
              DiegoV_Intel

              Hello JinLemon,

               

              Yes, the Serial1.println() statement sends data to pin 1 (Tx). In general, the Serial1 object manages the pins 0 and 1 (Rx and Tx) for serial communication. The Serial object, on the other hand, manages the serial communication with the Serial Monitor.

               

              It's not necessary to use the MCP2221. I used that IC because I had it with me when I did the test, but I think you could use an Arduino UNO (if you have one) or any other board/interface that has a serial interface and USB connection to your PC (COM port assigned in your PC).

               

              Regards,

              Diego.

              • 4. Re: Print strings on multiple monitors with Galileo Gen2
                JinLemon

                Thank you again Diego. I tried to wire Galileo pin1(TX) on the Arduino UNO pin0(RX) and vice versa (same for GND). Something happened, but it seems that Putty Monitor (on Arduino Uno port) print the same strings that I print on the serial Monitor (Galileo).

                • 5. Re: Print strings on multiple monitors with Galileo Gen2
                  DiegoV_Intel

                  Hello JinLemon,

                   

                  I did the test with an Arduino UNO instead of the MCP2221 I used before and I was able to get the same results. Take a look at the picture below:

                   

                  twoMonitors.JPG

                   

                  I printed the message "Message printed on Galileo's Serial Monitor" using the Serial.println() statement, and with the Serial1.println() statement I sent the message "Message printed on Arduino's Serial Monitor" to the Arduino UNO through the pin 1 (Tx) of the Galileo board. Then I opened the Galileo's COM port from the Arduino IDE, and the Arduino UNO's COM port with PuTTY.

                   

                  Regards,

                  Diego.

                  • 6. Re: Print strings on multiple monitors with Galileo Gen2
                    JinLemon

                    Now it's working, thank you again!