so a i have a gsm cellular sheild connected to a netduino com1 and i want to read data from com1, but i have failed to convert the bytes output to string, the method:
string result =System.Text.Encoding.UTF8.GetSTring(bytes);
doesnt seem to exist in the microframe work library so i tried to use this:
static void port_DataReceived(object sender, SerialDataReceivedEventArgs e) {
byte[] bytes = new byte[1];
while (port.BytesToRead > 0)
{
port.Read(bytes, 0 , bytes.Length);
//port.Write(bytes, 0, bytes.Length);
}
try
{
char[] cc = Encoding.UTF8.GetChars(bytes, 0, bytes.Length);
string s = new string(cc);
Debug.Print(s);
Debug.Print("then");
}
catch(Exception ex) {
Debug.Print(ex.Message);
Debug.Print("n");
Debug.Print(ex.StackTrace);
}
}
but it throws a system.exception and i dont why.
HELP PLIZ