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.
