SoftwareSerial: write(data)
描述
透過軟體序列介面傳送資料。運作方式與 Serial.write() 相同。
參數
詳情請看 Serial.write()
回傳
byte:write() 會回傳傳送資料的位元組數量
範例
SoftwareSerial mySerial(10, 11);
void setup()
{
mySerial.begin(9600);
}
void loop()
{
mySerial.write(45); // 傳送值為 45 的字元
int bytesSent = mySerial.write(“hello”); // 傳送字串 "hello" 並且接收回傳的值
}
See also
- SoftwareSerial()
- begin()
- print()
- println()
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
