I spent the weekend trying to get a simple C# program to send data via serial to my Arduino Diecimila. I'm just trying to send a very simple stream of 12 bytes - however my timing seems to be off. Most of the time, it misses all the data, and sometimes it catches the last couple.
The code worked fine when that's all it did, but when I included the code into the rest of my work it suddenly stopped working.
I can't, for the life of me, understand why. The rest of the code in the loop() section only activates when ldrPin (2) changes state... So I don't see how I could possibly miss so much data. I even included 5 "dummy" bytes in hopes of giving the arduino a chance to catch up.
If anybody would mind taking a look at this code, I would greatly appreciate it.http://pastebin.com/m405d7d44
- arduino codehttp://pastebin.com/m13775e0a
- C# code
Thanks in advance.