简体   繁体   English

Arduino串行输出不正确

[英]Arduino Serial Output is Incorrect

I have an arduino uno connected to two stepper motors and an arduino mega. 我有一个arduino uno连接到两个步进电机和一个arduino mega。 The mega needs to communicate with the arduino uno. 巨型需要与arduino uno沟通。 When I run the program and open the Serial monitor, the serial monitor displays the output of the other program. 当我运行程序并打开串行监视器时,串行监视器显示另一个程序的输出。 I'm setting up the monitor on both sketches (the sketch for the uno and the mega) using Serial.begin(9600); 我正在使用Serial.begin(9600);在两个草图(uno和mega的草图)上设置监视器Serial.begin(9600); If I run the code for the mega, the serial output of the uno will be displayed and vice versa. 如果我运行mega的代码,将显示uno的串行输出,反之亦然。 What can I do to fix this? 我该怎么做才能解决这个问题?

If you dont want to display any of the Arduino UNO output, you should connect the Arduino UNO to the Serail 2 of the Arduino MEGA. 如果你不想显示任何Arduino UNO输出,你应该将Arduino UNO连接到Arduino MEGA的Serail 2。

"The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX)" “Arduino Mega有三个额外的串行端口:引脚19(RX)和18(TX)上的Serial1,引脚17(RX)和16(TX)上的Serial2,引脚15(RX)和14(TX)上的Serial3”

Make sure you will change into your script, otherwise you wont read the Arduino UNO output. 确保您将更改为您的脚本,否则您将不会阅读Arduino UNO输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM