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