Netduino home hardware projects downloads community

Jump to content


Photo

Serial Communication using USB in VB.net rather than C# (Netduino 3)


  • Please log in to reply
No replies to this topic

#1 Greg Chao

Greg Chao

    Member

  • Members
  • PipPip
  • 14 posts

Posted 28 September 2015 - 04:11 PM

I have successfully got serial communication working between Netduino 3 and the computer using the USB port by following the instructions in the forum link

 

http://forums.netdui...=communication

 

Here is the important part of the link: "Purchase a FTDI FT232RL USB to serial card: http://www.sparkfun.com/products/9873 2. Connect the following pins: FTDI.RXI - Netduino.D1 FTDI.TXO - Netduino.D0 FTDI.Gnd - Netduino.Gnd 3. Plug your USB cable into the computer and the FTDI. If your computer can't find the right driver to setup the comm port, try: http://www.ftdichip.com/FTDrivers.htm?"

 

The link gives C# examples so I translated the code to VB.net.  My program on the Netduino (NetDuinoSide.vb below) reads the Digital I/O, codes it as a binary value, and sends the information through the serial cable to the USB port of the computer.  The program on the computer side (ComputerSide.vb below) reads the data and displays it.

 

A few things to note:

 

1. (Computer side) You might need to change the "COM3" on the computer side to whatever port your computer assigns when you plug in the FTDL serial card.  You can find out by going to the control panel under "devices."

2. (Computer side) You will need to drag over the timer tool on to your form.  You then need to set its properties Enabled to "True" and Interval to "1000" (this will allow polling at 1 sec intervals --- you can change this if you like).

3. (both) The binary number representing the Digital I/O states is converted to decimal and then sent over as a string. If you convert this string back to binary, the 1's and 0's will represent the state of the digital port.?

 

Attached File  ComputerSide.vb   2.49KB   9 downloads

Attached File  NetDuinoSide.vb   3.46KB   12 downloads






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.