亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码

標題: arduino如何從串口監視器用發送字符串 [打印本頁]

作者: alan51hei    時間: 2020-8-18 15:03
標題: arduino如何從串口監視器用發送字符串
我從串口監視器發送 數字123,arduino得到的是1,2,3,獨立的三個數字 。
如果需要發送一個字符串怎么發送?arduino又要怎樣接收字符串?
截圖:


代碼:
/*
  verify the function and serial port.
*/

int isodd(int a )
{
  if (a % 2 == 0)
    return 1;
  else
    return 0;
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(13, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available())
  {
    int a = Serial.read() - '0';

    if (isodd(a))
    {
      digitalWrite(13, HIGH);
      Serial.print(a);
      Serial.println(" 是偶數");
    }
    else
    {
      Serial.print(a);
      Serial.println(" 是奇數");
      digitalWrite(13, LOW);
    }
  }
}

通信截圖.png (5.06 KB, 下載次數: 75)

通信截圖.png





歡迎光臨 (http://www.denmoz.com/bbs/) Powered by Discuz! X3.1