我想找...

搜尋

分享

目錄

SoftwareSerial: write(data)

[SoftwareSerial]

描述

Prints data to the transmit pin of the software serial port as raw bytes. Works the same as the Serial.write() function.

參數

See Serial.write() for details

回傳

byte
write() will return the number of bytes written, though reading that number is optional

範例

SoftwareSerial mySerial(10, 11);
 
void setup()
{
  mySerial.begin(9600);
}
 
void loop()
{
  mySerial.write(45); // send a byte with the value 45
 
   int bytesSent = mySerial.write("hello"); //send the string "hello" and return the length of the string.
}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

返回頂端