3
我从C#prog发送数字到Arduino(当时的一个值)有问题。 我注意到,如果我发送的值低于128,那么问题就从更高的值开始。从C#程序发送数据到Arduino
C#线:
shinput = Convert.ToInt16(line2); // shinput = short.
byte[] bytes = BitConverter.GetBytes(shinput);
arduino.Write(bytes, 0, 2);
的Arduino线:
Serial.readBytes(reciver,2);
inByte[counter]= reciver[0]+(reciver[1]*256);
我会很感激的任何帮助。
是您的C#程序和Arduino的代码在相同的波特率传输? – 2013-03-02 14:10:41