i am reading and writing Command AT using the serial port of netduino, the problem is that when the program have made some reads and writes, the information begins to split into several lines and I can not capture the answers because it is in two lines.
For example, i am waiting for "+CHTTPACT: REQUEST" but instead i catch two lines:
+CHTTPACT: R
EQUEST
Enclosed my code if anybody can give me some guidance,
Thanks so much
static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { while (serial.BytesToRead > 0) { serial.Flush(); byte[] bytes = new byte[serial.BytesToRead]; serial.Read(bytes, 0, bytes.Length); String cadena = new string(Encoding.UTF8.GetChars(bytes)); Respuestas(cadena); printscreen(bytes); } serial.Flush(); }
Edited by Chris Walker, 15 August 2012 - 10:43 AM.
added [code][/code] tags