This was fine for testing but with the delay on the main thread it slows everything down whenever I write to the LCD. So I thought it might be a good idea to put the write operation on its own thread like this:
private void Write(byte[] data) { new Thread(delegate { this._Write(data); }).Start(); } private void _Write(byte[] data) { this.port.Write(data, 0, data.Length); Thread.Sleep(80); }
This code works fine as long as the debugger is attached but as soon as I deploy and reset the Netduino, the display ceases to function. The code itself is still operational (no exceptions, as far as I can tell) but the display thread doesn't seem to be doing anything. If I remove the threading and write to the device directly everything is fine again.
Is this expected behaviour? Is there some better way of doing this that I don't know about?
- Adam
[N+ firmware v4.1.1.0 ALPHA7]