用户工具

站点工具


m:sk:mcu:arduino:serial

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
m:sk:mcu:arduino:serial [2015/11/07 13:18]
admin
m:sk:mcu:arduino:serial [2015/12/06 19:47] (当前版本)
admin 已恢复为旧版 (2015/11/19 16:55)
行 4: 行 4:
  
 ---- ----
 +<code C>
 #include <​stdio.h>​ #include <​stdio.h>​
  
 String inputString = ""; ​        // a string to hold incoming data String inputString = ""; ​        // a string to hold incoming data
 +
 boolean stringComplete = false; ​ // whether the string is complete boolean stringComplete = false; ​ // whether the string is complete
  
行 17: 行 19:
  
 void loop() { void loop() {
-  //​serialEvent();​ //call the function 
   // print the string when a newline arrives:   // print the string when a newline arrives:
   int num = 0;   int num = 0;
行 30: 行 31:
 } }
  
-/* +
-  SerialEvent occurs whenever a new data comes in the +
- ​hardware serial RX.  This routine is run between each +
- time loop() runs, so using delay inside loop can delay +
- ​response. ​ Multiple bytes of data may be available. +
- */+
 void serialEvent() { void serialEvent() {
   while (Serial.available()) {   while (Serial.available()) {
行 49: 行 45:
   }   }
 } }
 +</​code>​
 ---- ----
  
 +[[:​sp|另一个例子]]
· 最后更改: 2015/11/07 13:18