5 Replies Latest reply on Mar 28, 2016 2:01 PM by FGT

    Communication between board & pc

    A.Kerdany

      Hello all,

       

      I want to write an algorithm (must use python language) on my board then send the output to my PC & then send a response back from my PC, I saw an example using mraa library (send/receive code) but I don't know how to use it https://github.com/intel-iot-devkit/mraa/tree/master/examples/python

       

      Also, is there any type of communication else I could use? or a better way?

       

       

       

      Thanks a lot

        • 1. Re: Communication between board & pc
          FGT

          Hi A. Kerdany.

           

          I don't know if better... I've used/adapted an example with a Java program in the PC and a Sketch which I think can be used in Galileo (I've not checked). Ask for it if you want to check.

           

           

          Fernando.

          • 2. Re: Communication between board & pc
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi A.Kerdany,

            The Python examples you mentioned are for other purposes. The sender and receiver examples are used to setup the UART interface (pins 0 and 1). I haven't tried it before, but if you want to communicate the board with your PC, you would have to use the USB port. You'd need, in your PC, a program that reads and writes to the COM port associated to the Galileo's USB port. In your Galileo, you'd need another script that reads and writes to the port associated to the USB port.

            The Java program and sketch suggested by the FGT might be very helpful for this, and they might help you to understand how the communication works in order to port the code to Python.

            Regards,
            Diego

            • 3. Re: Communication between board & pc
              A.Kerdany

              I think this code can be helpful! Can you please send them to me?

              • 4. Re: Communication between board & pc
                FGT

                A.Kerdany wrote:

                 

                I think this code can be helpful! Can you please send them to me?

                I'm "polishing" some details of the code & configuration, you have windows 64 bits, right?

                 

                Fernando.

                • 5. Re: Communication between board & pc
                  FGT

                  Hi again,

                   

                  I'll assume you have win 64 bits. If not, please tell me.

                   

                  General description of this example:

                   

                  The attachment contains code and dependencies. Please tell me if something is missing and/or fails...

                   

                  README (also included in the attachment):

                  =======================================================0

                  Echo: sketch to be loaded in Arduino

                   

                  deps: .dll needed in Windows for serial comm.

                   

                  java: java-related code, compile, and configuration details

                   

                  Step-by-step install & exec:

                  1) Load the sketch in directory Echo, take into account the COM file used for loading the sketch

                   

                   

                   

                  2) Compile java code, needed only if using java < 1.8.0 or windows 32 bits

                    In directory java:

                    2.1) Set JAVADIR directory in compile.bat file

                    2.2) Compile with compile.bat (windows command)

                   

                   

                  3) Execute java "pipe"

                    In directory java:

                    3.1) Set JAVADIR directory in execute.bat file

                    3.2) Set the correct COM port in execute.bat file (COM5 is left as example, change to the port used when loading the sketch)

                    3.3) Execute execute.bat (windows command)

                   

                  4) Execute java "pipe client"

                    In directory java:

                    4.1) java PipeClient localhost 5000

                    4.2) Enter text, which should be replicated as entered if everything is fine...

                   

                  =======================================================

                   

                  HTH,

                   

                  Fernando.