UDOO_test_communication_sketch.ino

Discussion in 'General Programming Discussion' started by Stebar59, Nov 21, 2013.

  1. Stebar59

    Stebar59 New Member

    Joined:
    Nov 17, 2013
    Messages:
    5
    Likes Received:
    0
    Hello,
    I'm looking for the sketch UDOO_test_communication_sketch.ino mentioned in the documentation ( ... For a complete example on communication between the two processors, follow this link http://www.udoo.org/features/processors-communication/ file containing an arduino sketch (UDOO_test_communication_sketch.ino) and a linux bash script (UDOO_test_communication_script.sh)... ) but at the mentioned link I can not find it!
    Some ideas?

    Stefano
     
  2. droman

    droman New Member

    Joined:
    Nov 22, 2013
    Messages:
    5
    Likes Received:
    0
    +1 :)

    I need those examples.

    I created a small application in Arduino that receives data from the serial port and displayed on a LCD screen, but I'd like an example of how to send data to the Arduino serial port, I have not managed to do. It would be great to have that example in Python.

    Sorry for my english... anybody speak Spanish? XD
     
  3. droman

    droman New Member

    Joined:
    Nov 22, 2013
    Messages:
    5
    Likes Received:
    0
    How to send data from Python to Arduino:

    First, create link: sudo ln -sf /dev/ttymxc3 /dev/ttyS0

    Now, in python:

    Code:
    import serial
    ser = serial.Serial('/dev/ttyS0', 9600);
    ser.write("Hello Wolrd!");
    ser.close();
    In Arduino:

    Code:
    void setup()
    {
      Serial.begin(9600);
    }
    
    char Caracter;
    
    void loop()
    {
        while (Serial.available()>0)
        {
              Caracter=Serial.read();
              print(Caracter);
        }
    }

    Sorry for my english :)
     
  4. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    I am trying to find those files too. I expected that if I opened the Serial Monitor on the Arduino IDE that I would see the output of my Serial.println() calls, but I do not see anything at all (I have a Serial.println() statement at the top of setup() and loop() and so I expected to see the output at the top of loop print over and over).

    Therefore, I am wondering if the bash script does something special to initialize the serial communication.
     
  5. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    That is exactly what you should see, without any tricks. The Serial Monitor in Arduino IDE (on the i.MX6) and assuming your initialise and do you print/println's you should see your output. There seems to be an issue currently with some data types being output via Serial.print/println so that may be your issue? Post your code snippet and we'll see.
     
  6. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    Hi Jim,

    I think this is what it is. I found the other thread right after I posted here and started experimenting. For this code in loop():

    Code:
      float tempF = (1.8 * tempC) + 32;
      int tempF100 = tempF * 100;  // I just added this for this purpose here, it has no meaning
      Serial.println(3);
    //  Serial.println(tempF); // trying to print a float is bad
    //  Serial.println(tempF100); // trying to print an int var is bad
      char buffer[10];
    //  dtostrf(tempF, 5, 2, buffer); // just calling dtostrf is bad
    //  String str("astring"); // declaring a String is bad
      Serial.println("endofloop");
      delay(2000);
    
    If I try to uncomment any one of those lines, it will break all of the Serial.println calls, including the one that works just fine in setup() and the one not shown that works just fine at the top of loop().
     
  7. Lifeboat_Jim

    Lifeboat_Jim New Member

    Joined:
    Sep 16, 2013
    Messages:
    399
    Likes Received:
    1
    @Mark

    yeah if, for the purposes of testing, you just put in Int/Chars/Array of Chars as values to your Serial.print/println's I'm sure you'll find it works.
     
  8. markAtUMR

    markAtUMR New Member

    Joined:
    Nov 27, 2013
    Messages:
    9
    Likes Received:
    0
    Unfortunately what I want to do right now is verify that the I2C bus is working correctly by simply printing the value to the Serial line. Maybe I'll post the value to ThingSpeak today to test instead.
     
  9. Stebar59

    Stebar59 New Member

    Joined:
    Nov 17, 2013
    Messages:
    5
    Likes Received:
    0
    As I can see they are some problems with the serial line output.
    I think it will be a very big help to have the example files mentioned in my first message!
    Nobody from support team can help?

    Stefano
     

Share This Page