Arduino Due同士の通信・シリアル通信を用いて送信した文字が受信側でうまく表示されない
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Arduino Due同士でシリアル通信をさせたいです.
送信側Arduinoはmatlabで,受信側ArduinoはArduino IDEでプログラムします.
そこで送信側Arduinoには以下のプログラムを書きました.
device = serialport("COM3",9600);
for i=1:2000
i
pause(20);
write(device,"1000","int8");
end
受信側Arduinoには以下のプログラムを書きました.
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int incomingByte = Serial1.read();
Serial1.println("number");
Serial1.println(incomingByte);
int b = incomingByte +2;
Serial.println(b);
}
}
受信側Arduinoのシリアルモニタで結果をみたところ,100010001000と改行されてない結果が羅列されていくだけで
bの値も表示してくれません.
どのようにすればよいでしょうか.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!