6523| 2
|
[求助] 关于 println输出数组 的问题 |
关于 println输出数组 的问题,请教:(最后目的是想输出字符,如最后一张图里的第二句)----------------------------------------------------------------------------------------------------------- #include <Arduino.h> #include <Servo.h> #define backbone_h int val; void setup() { Serial.begin(115200); } void loop() { char ao[]={'#1','P1000','#2','p1000','#3','p1000','#4','p1000','#11','p1000','#12','p1000','#13','p1000','#14','p1000','#21','p1000','#22','p1000','#23','p1000','#24','p1000','t1000','\r\n'}; val=Serial.read(); switch (val) { case '1': Serial.println(ao); delay(300); break; case '2': Serial.println("#1P1500#2p1500#3p1500#4p1500#11P1500#12p1500#13p1500#14p1500#21p1500#22p1500#23p1500#24p1500T1000\r\n"); delay(300); break; } } 复制代码 ----------------------------------------------------------------------------------------------------- 然而在测试时发生了 监视窗口:1020304010203040102030400 #1P1000#2p1000#3p1000#4p1500#11P1500#12p1500#13p1500#14p1500#21p1500#22p1500#23p1500#24p1500T500 ---------------------------------------------------------------------------------------------------- |
安卓机器人 发表于 2016-7-3 17:10 :lol 你解决了我的big 问题 void setup() { Serial.begin(115200); } void loop() { char AO[]={'#','1','P','1','5','0','0', '#','2','p','1','5','0','0', '#','3','P','1','5','0','0', '#','4','p','1','5','0','0', 'T','5','0','0','\r','\n'}; char BO[]={'#','1','1','P','1','5','0','0', '#','1','2','p','1','5','0','0', '#','1','3','P','1','5','0','0', '#','1','4','p','1','5','0','0', 'T','5','0','0','\r','\n'}; char CO[]={'#','2','1','P','1','5','0','0', '#','2','2','p','1','5','0','0', '#','2','3','P','1','5','0','0', '#','2','4','p','1','5','0','0', 'T','5','0','0','\r','\n'}; char DO[]={'#','2','8','P','1','5','0','0', '#','2','9','p','1','5','0','0', '#','3','0','P','1','5','0','0', '#','3','1','p','1','5','0','0', 'T','5','0','0','\r','\n'}; val=Serial.read(); switch (val) { case '1': Serial.println(AO); Serial.println(BO); Serial.println(CO); Serial.println(DO); delay(1000); |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed