using System; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; using System.IO.Ports; namespace NetduinoPlusApplication1 { public class Program { static SerialPort serial; static OutputPort Led = new OutputPort(Pins.ONBOARD_LED, false); public static void Main() { // initialize the serial port for COM1 (using D0 & D1) serial = new SerialPort("COM1",9600, Parity.None, 8, StopBits.One); // open the serial-port, so we can send & receive data serial.Open(); // add an event-handler for handling incoming data serial.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived); // wait forever... Thread.Sleep(Timeout.Infinite); } static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { int bytesToRead = serial.BytesToRead; //start reading the stream if (bytesToRead > 0) { // get the waiting data byte[] buffer = new byte[bytesToRead]; serial.Read(buffer, 0, buffer.Length); serial.Write(buffer, 0, buffer.Length); Led.Write(true); } Led.Write(false); } } }
- Netduino Forums
- → Viewing Profile: Topics: efrain7805
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.
Community Stats
- Group Members
- Active Posts 3
- Profile Views 4920
- Member Title New Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
Neutral
User Tools
Friends
efrain7805 hasn't added any friends yet.
Topics I've Started
UART communication Netduino Plus
12 July 2012 - 03:35 AM
I'm new to netduino need to establish a communication with COM1 netduino and PC serial Port area using "Tera Term" but communication does not work I press the letter "a" on the keyboard and returns me another character. I'm working with a Baude Rate of 9600. Alguine I can say I'm doing wrong? Thank you. I leave the source code.
- Netduino Forums
- → Viewing Profile: Topics: efrain7805
- Privacy Policy