Go Down

Topic: arduino leonardo and processing serial issues (Read 2 times) previous topic - next topic

cantore

hello, I have a problem communicating with my arduino leonardo.
This is the processing code:
Code: [Select]

    import processing.serial.*;

    Serial myPort;  // Create object from Serial class
    int val;      // Data received from the serial port

    void setup()
    {
      size(200, 200);
      // I know that the first port in the serial list on my mac
      // is always my  FTDI adaptor, so I open Serial.list()[0].
      // On Windows machines, this generally opens COM1.
      // Open whatever port is the one you're using.
      String portName = Serial.list()[1];
      println(Serial.list());
      myPort = new Serial(this, portName, 9600);
    }

    void draw()
    {
      if ( myPort.available() > 0) {  // If data is available,
        val = myPort.read();         // read it and store it in val
        print((char) val);
      }
     
    }


and this is the arduino one:

   
Code: [Select]
void setup() {

      Serial.begin(9600);                    // Start serial communication at 9600 bps
        while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }
    }

    void loop() {
        delay(1000);
        Serial.print("hoila ");               // send to Processing
        delay(1000);                           
        Serial.print("hoibo ");               // send to Processing
    }


I receive all char if I use another arduino (not leonardo), or anoter serial terminal with leonardo, but with arduino leo and processing connected on the serial port nothing is read.
Do you have any idea?
thanks in advance

spcomputing

Is the Processing machine an WinXP?

I have the same issue on serial on a WinXP but not on Vista Machine (Have not tested Win7).
http://www.spcomputing.com

Magic1

I'm having the same issue but trying to interface with a vb.net application. I can send data to the Leonardo fine (and the Leonardo can read it) but when I try to make the Leonardo send anything back I never can get it to fire any kind of data received function in vb.net. The code I've been toying with works fine on an UNO though.

spcomputing

Yeah, I even did a Hot Fix to update the usbser.sys... no change.  I am curious on how cantore got it to output in another terminal program.  I tried teraserv and hyperterm...no joy.  cantore has success w/ Win7 and I did with Vista.
http://www.spcomputing.com

Magic1


Yeah, I even did a Hot Fix to update the usbser.sys... no change.  I am curious on how cantore got it to output in another terminal program.  I tried teraserv and hyperterm...no joy.  cantore has success w/ Win7 and I did with Vista.


Can you get it to receive messages from the computer, just not send any that the computer can catch or are you not getting anything at all either direction?

spcomputing

I can get it to actually receive a sketch.  I have sent the "fade" sketch switching from D9 to D13 and it works perfectly.  If I try to read anything from the serial communications on USB I get nothing.  If I move the Leonardo to a Vista machine and just open the serial monitor, it spews all kinds of data.
http://www.spcomputing.com

cantore


Is the Processing machine an WinXP?

I have the same issue on serial on a WinXP but not on Vista Machine (Have not tested Win7).


I have windows 7 and it soed not work, but I have tested it on an Xp computer with the same result

nsmet

Hey guys

I know this is an old topic, but  I hope you can help me. I am trying to send from arduino Leonardo to Visual Studio and I can't get it to work. All your problems describe everything i have.

Have you found a solution ?

PaulS

Quote
I am trying to send from arduino Leonardo

Using what code?

Quote
to Visual Studio

Visual Studio is an application for developing applications. It does NOT listen to the serial port. You can develop an application, using Visual Studio, that does listen to the serial port. What have you developed?

Quote
and I can't get it to work.

Why not?

burakozen

im not sure , but USE "COMx" instead of your "Serial.list()[1];"as portname . i hope it will be solved.

so you dont need the define portname .
Code: [Select]
String portName = Serial.list()[1];
      println(Serial.list());
      myPort = new Serial(this, portName, 9600);


CHANGE

Code: [Select]
myPort = new Serial(this, "COMx", 9600);

Go Up