Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

From Netduino to PC's USB-to-Serial

Serial COM

Best Answer tridy, 15 May 2015 - 05:38 PM

Ok, got it working.

 

Now I know that my USB-to-Serial works! It was really as simple as I thought :).

 

private static SerialPort _serial = null;

 public static void Main()
        {
            using(_serial = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One))
            {

                _serial.Open();

                for(int i = 65; i < 85; i++)
                {
                    _serial.Write(new[] { (byte)i }, 0, 1);
                    Thread.Sleep(1000);
                }

                _serial.Close();
            }
        }
Go to the full post


  • Please log in to reply
1 reply to this topic

#1 tridy

tridy

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationStockholm, Sweden

Posted 15 May 2015 - 12:13 PM

Hello.

I have a USB-to-Serial adapter and would like to test it. So, I would like to send a basic command from Netduino to PC and be able to read it.

 

Attached File  USB-To-SERIAL.jpg   19.89KB   2 downloads

 

so, Putty will be listening on the PC's side and Netduino will be sending a signal.

 

should it be wired like that?

 

Digital 0  > TXT

Digital 1 > RXD

 

(The adapter is connected to USB, so I think it's getting its power from USB)

 

Then from the code, use a SerialPort with COM1 and then send a signal?

 

Does this sound right?

 

Thanks!



#2 tridy

tridy

    Advanced Member

  • Members
  • PipPipPip
  • 68 posts
  • LocationStockholm, Sweden

Posted 15 May 2015 - 05:38 PM   Best Answer

Ok, got it working.

 

Now I know that my USB-to-Serial works! It was really as simple as I thought :).

 

Attached File  putty_com_4_listening.jpg   127.21KB   1 downloads

private static SerialPort _serial = null;

 public static void Main()
        {
            using(_serial = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One))
            {

                _serial.Open();

                for(int i = 65; i < 85; i++)
                {
                    _serial.Write(new[] { (byte)i }, 0, 1);
                    Thread.Sleep(1000);
                }

                _serial.Close();
            }
        }






Also tagged with one or more of these keywords: Serial, COM

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.