Keyboard.begin()
描述
初始化 HID 键盘。begin()
要在尚未呼叫任何键盘控制函式前呼叫。
要结束 HID 键盘的模拟行为,必需呼叫 Keyboard.end()。
语法
Keyboard.begin()
参数
回传
无回传值
范例
void setup(){ // 将 pin 2 设定为 INPUT_PULLUP 状态 // 这样它就会在外部按钮被按下时 // 呈现 LOW 的状态 pinMode(2, INPUT_PULLUP); Keyboard.begin(); } void loop(){ // 假如外部按钮被按下 if(digitalRead(2)==LOW){ // 印出讯息 Keyboard.print("Hello!"); } }
See also
- Keyboard.end()
- Keyboard.press()
- Keyboard.print()
- Keyboard.println()
- Keyboard.release()
- Keyboard.releaseAll()
- Keyboard.write()
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.