Problem running Gobetwino

What is the purpose of this code, which i believe is not part of the supplied sample code :

  while(!Serial){
    ;
  };

What is the purpose of this code, which i believe is not part of the supplied sample code :

On the Leonardo, it waits for the serial port to be ready. On other models, it does nothing.

I installed GoBetwino, set up the necessary commands, and compiled and linked that code for the Mega. GoBetwino caught all the serial data, and logged it as it was supposed to.

I then changed the board type to Leonardo, and connected the Leonardo. I uploaded the sketch, started GoBetwino and changed the com port to the correct port. No communication with the Leonardo appears in the top window. Opening the Serial Monitor fails, because the COM port (COM10) is in use.

MikMo, what's going on? Any ideas?

In my case i think gobetwino comunicates with Leonardo, since the only message it gives is: Serial port : COM9 opened at 9600 baud

But nothing more than that....

In my case i think gobetwino comunicates with Leonardo, since the only message it gives is: Serial port : COM9 opened at 9600 baud

All that that means is that GoBetwino connected to the serial port. It isn't clear that any communication actually takes place.

If MikMo doesn't get back to us today, I'll try my C# application, to see if the Leonardo and PC are actually communicating. Right now, I'd suspect that there is something about the COM port setup that isn't what the Leonardo expects.

I'm afraid i have no idea right now.

I do not have a Leonardo to try out.

Is there any known difference in the serial communication between the UNO and the Leonardo ?

Thi is the VB.net code that opens the serial port in GoBetwino:

  Public Sub serialPortOpen()

        'Configure and open the serial port

        'If the port is already open, close it first
        If serialPort.IsOpen Then
            serialPort.Close()
        End If

        Try
            With serialPort
                .PortName = settings.getSetting("serialPortName")
                .BaudRate = CInt(settings.getSetting("serialPortbaud"))
                'WARNING DO NOT CHANGE BELOW SETTINGS FOR USE WITH ARDUINO
                .Parity = CInt(settings.getSetting("serialPortParity"))
                .DataBits = CInt(settings.getSetting("serialPortDataBits"))
                .StopBits = CInt(settings.getSetting("serialPortStopBits"))
                .Handshake = CInt(settings.getSetting("serialPortHandShake"))
                'WARNING END :-)
                .Encoding = System.Text.Encoding.ASCII
                .NewLine = Chr(13) + Chr(10)
            End With

            'Open the port and clear any junck in the input buffer
            serialPort.Open()
            serialPort.DiscardInBuffer()
            statusAndLog("Serial port : " + serialPort.PortName + " opened at " + settings.getSetting("serialPortbaud") + " baud")

        Catch Ex As Exception
            statusAndLog("Can not open serial port : " + serialPort.PortName)
            statusAndLog(Ex.Message)
        End Try
    End Sub

MikMo:
I'm afraid i have no idea right now.

I do not have a Leonardo to try out.

Is there any known difference in the serial communication between the UNO and the Leonardo ?

Must be as there seems to have been a new serial function added in version 1.0.1 to support the Leonardo:

Lefty

This is my C# callback to open the serial port:

		private void btnConnect_Click(object sender, EventArgs e)
		{
			System.ComponentModel.IContainer components = 
				new System.ComponentModel.Container();
			port = new System.IO.Ports.SerialPort(components);
			port.PortName = comPort.SelectedItem.ToString();
			port.BaudRate = Int32.Parse(baudRate.SelectedItem.ToString());
			port.DtrEnable = true;
			port.ReadTimeout = 5000;
			port.WriteTimeout = 500;
			port.Open();

			readThread = new Thread(new ThreadStart(this.Read));
			readThread.Start();
			this.hardWorker.RunWorkerAsync();

			btnConnect.Text = "<Connected>";

			btnConnect.Enabled = false;
			comPort.Enabled = false;
			sendBtn.Enabled = true;
		}

With this, the C# application is able to receive data sent by the Arduino:

Text: #S|CPTEST|[]#
Text: #S|LOGTEST|[851;349;305]#
Text: #S|LOGTEST|[172;976;867]#
Text: #S|LOGTEST|[311;756;941]#
Text: #S|LOGTEST|[917;637;713]#
Text: #S|LOGTEST|[933;707;769]#
Text: #S|LOGTEST|[112;701;456]#
Text: #S|LOGTEST|[837;12;744]#

Hmmm.

I wonder if it is the dtr enable that makes it work ?

I wonder if it is the dtr enable that makes it work ?

Worth a try. I'll test it for you, if you create a new executable.

Guys i am starting to be somehow frustrated with this Leonardo board :frowning:

Tried to run MegunoLink, can t get live data...

Tried to run Fetch, cant get live data...

Don t know if this deserves a new thread....

Thanks for your help.

Don t know if this deserves a new thread....

Not yet. Lets see if we can't get GoBetwino working first. If so, then the change that needs to be made to GoBetwino probably needs to be made to the other classes you are having issues with.

You can then create new topics for each of them.

i will try to put the dtr enable in gobetwino, just give me a tiny little time :slight_smile:

MikMo sent me a link to the new version of GoBetwino to test. It works with the Mega, the Duemilanove, AND the Leonardo. I'm sure he'll be making it available for all, soon.

Ok so it was the DTR that should be enabled.

Thanks for testing Paul :slight_smile:

I will repackage GoBetwino ASAP.

There is also a little bug that was discovered recently that i will fix.

There is also a little bug that was discovered recently that i will fix.

While you're at it...

It would be nice to change the serial port, and have that close the existing port, if opened, and open the new one, without having to restart GoBetwino.

That is in 06 8)

I'm sure he'll be making it available for all, soon.

Wonderfull :slight_smile: Can t wait to try then.

Thanks.

And by the way, when fixed could you explain what was the problem(s)?

I would like to understand. And think other people would too.

Thanks again.