10 years, 6 months ago.

How to transfer AD sensor data through serialUSB to VB2010?

I am having trouble reading serial ports on the VB2010.

Has anyone done transfering AD sensor data to PC through VB2010 program?

My VB module is

Module Module1 Function ReceiveSerialData() As String ' Receive strings from a serial port Dim returnStr As String = ""

Dim com1 As IO.Ports.SerialPort = Nothing With com1 .BaudRate = 9600 .DataBits = 8 .Parity = IO.Ports.Parity.None .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None End With Try com1 = My.Computer.Ports.OpenSerialPort("COM7") com1.ReadTimeout = 10000 Do. Dim Incoming As String = com1.ReadLine.

If Incoming Is Nothing Then returnStr = "Error: Serial Port read got nothing." Exit Do Else returnStr &= Incoming & vbCrLf End If Loop Catch ex As TimeoutException returnStr = "Hello Error: Serial Port read timed out." Finally If com1 IsNot Nothing Then com1.Close() End Try

Return returnStr End Function.

End Module

mbed program is

  1. include "mbed.h"

Serial pc(USBTX,USBRX); AnalogIn Dat(PTB0);

int main() { while(1) { if (pc.writeable()){ DigitalOut myled(LED1); pc.putc(Dat.read()); } else{ DigitalOut myled(LED2);

} } }

When I click Get data button on the VB program mbed is blinking the D4 led but not receiving anything on the VB program.

Can anyone help

Be the first to answer this question.