Hello,
I'm trying to use the serial port of Embedded Master, and for this, I took an example from :
http://www.tinyclr.com/downloads/Beginners%20guide%20to%20NETMF.pdf ,page 76/144
My code is the following one
using System;
using System.Threading;
using System.Text;
using Microsoft.SPOT;
using System.IO.Ports;
namespace SerialPort
{
public class SerialPort
{
public static void Main()
{
SerialPort UART = new SerialPort("COM1", 115200);
int counter=0;
UART.Open();
while (true)
{
// create a string
string counter_string = "Count: " + counter.ToString() + "\r\n";
// convert the string to bytes
byte[] buffer = Encoding.UTF8.GetBytes(counter_string);
// send the bytes on the serial port
UART.Write(buffer, 0, buffer.Length);
// increment the counter;
counter++;
//wait...
Thread.Sleep(100);
}
}
}
}
You can see my references in the picture that I had (References) and there is a picture of my code too (Code). As the picture shows it, I have a problem with the creation of a new object in relation with "SerialPort", but I don't understand why... If someone can light me please ?
Thanks, John.