Go Down

Topic: COM Port Communication with VB (Read 2694 times) previous topic - next topic

hotti24

Hey Guys,

i'm working for a few hours at the communication between my PC and a Leonardo, but I have a big problem to send data from Arduino to the PC. At first I thought I did a mistake at the serial-read or event function in visual basic. But now I figured out, that the Arduino doesn't send data, if I activate the com-port from my VB-program. However, if I use the standard Arduino serial monitor, I get sent data and the TX LED is blinking. If I'm using my VB script, I can't get a blinking LED, however, the communication in the other direction works well. For example I can send data to the Arduino and the RX LED blinks.

Now the question: Is there any function, I have activate to get the Arduino in a sending mode. I could imagine, It could something have to do with "handshaking"???


Thanks for the help.

PaulS

The Leonardo requires that the DtrEnable flag be true. Are you setting it?

hotti24

No!
I'll test it in the evening.

Thank you.


PaulS

For future reference, perhaps you could post your VB code for opening the port.

PakARD

If I try to use a Terminal program with an Arduino Uno (R3 SMD) under windows 7, I get the message: "The port is not available".

However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port....is this the same issue?

Thank you

PaulS

Quote
is this the same issue?

No.

Quote
However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port

You aren't trying to use the Terminal program at the same time as the Serial Monitor, are you? Have you closed the IDE?

PakARD


Quote
is this the same issue?

No.

Quote
However, when I use the Monitor Serial, I don't get the error and all the data flow fine, so nothing is locking the port

You aren't trying to use the Terminal program at the same time as the Serial Monitor, are you? Have you closed the IDE?


Yes, of course I have tried to connect via Terminal after closing the IDE.
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.

What is it then?


PaulS

Quote
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.

That would be logical. The programming port is for, well, programming the Arduino. You aren't programming the Arduino from the Terminal application, are you?

PakARD


Quote
It happens the same to me, when using the programming port with the Arduino Due, I can only connect to the Native USB.

That would be logical. The programming port is for, well, programming the Arduino. You aren't programming the Arduino from the Terminal application, are you?


I am not, but wouldn't I be able to communicate to Arduino Uno via Serial.print() and Serial.read() commands?

I don't understand why the port is not available when I try to open it from another program different from Serial Monitor (which is supposed to be the same).

zoomkat

Quote
communication between my PC and a Leonardo


Just from looking at other code, the leonardo has some special requirements as to its serial port. probably nothing to do with the comport issue on your pc, but there is something different. If you are using windows, have you looked in device manager at the comport settings for different comports and such? 
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

PaulS

Quote
the leonardo has some special requirements as to its serial port.

The only difference is that DtrEnable must be set to true.

macross

Hi

I have the same problem
arduino leonardo cant send data to VB 6
but I usually use arduino uno and its perfectly works wether its code or its parameter

I have set DTR enable = true (this is usually for uno)
and set RTS enable = true (after googling this for VB net, )

my code
++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Form_Load()
MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
MSComm1.DTREnable = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub


Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvReceive Then
    Label2.Caption = MSComm1.Input
If Label2.Caption = "1" Then
    Shape4.FillColor = vbRed
    Label3.Caption = "1"
ElseIf Label2.Caption = "2" Then
    Shape5.FillColor = vbRed
    Label3.Caption = "1"
ElseIf Label2.Caption = "3" Then
    Shape4.FillColor = vbRed
    Shape5.FillColor = vbRed
    Label3.Caption = "0"
Else
    Shape4.FillColor = vbGreen
    Shape5.FillColor = vbGreen
    Label3.Caption = "2"

End If
End If
End Sub

++++++++++++++++++++++++++++++++++++++++++++++

any more suggestion ?

Go Up