Hi, people Im Luis from argentina,
First I apologize for me english, in my country speek spanish.
I have the same problem that bryant. Can you help me ?. thanks
using
System;
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 Microsoft.SPOT.IO;
using
System.IO.Ports;// el libro esta mal antes usaba SPOT ahora usa este, pero igual hay que agregar el ...SPOT.HARDWARE.SerialPort.
?
?
namespace
puerto_serie_netduino
{
public class Program
{
public static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
static SerialPort serial1;
public static void Main()
{
try
{
SerialPort serial1 = new SerialPort("com2", 9600, Parity.None, 8, StopBits.One);
serial1.Open();
serial1.DataReceived +=
new SerialDataReceivedEventHandler(serial1_DataReceived);
}
catch (Exception ex)
{
string msg = ex.Message;
}
Thread.Sleep(Timeout.Infinite);
}
static void serial1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
byte[] buffer = new byte[3];
if (serial1.BytesToRead > 0)
{
led.Write(
true);
}
}
}
}