SoftwareSerial: begin(speed)
描述
設定軟體序列介面的鮑率(baud rate)。支援的鮑率有:300、600、1200、2400、4800、9600、14400、19200。
參數
speed:鮑率,型態為 long
回傳
無回傳值
範例
#include <SoftwareSerial.h>
#define rxPin 10
#define txPin 11
// 創建新的 SoftwareSerial 物件
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
void setup() {
// 設定 RX 腳位為輸入,TX 腳位為輸出
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// 設定軟體序列介面的鮑率
mySerial.begin(9600);
}
void loop() {
// ...
}
See also
- SoftwareSerial()
- read()
- 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.
