Arduino Leonardo 可以充当USB设备和电脑进行数据通信。因此,凡是USB方面的数据流都可以用它去做。对应的有一些函数,最基本的就是用函数充当鼠标键盘来访问USB上位机。对应的USB控制芯片为32u4, 以及Arduino Due/Zero。下面附上函数库名字便于查询。
对应的输入按键或者鼠标移动数据可以是多种多样的,比如来自三轴加速度计、跳舞机等等,非常有趣。比如这个视频:
这个视频使用的是D2数字口做了个开关,其实不用D2数字口也行,让连接到设备上的Arduino马上工作就行。有时候如果需要开关控制,像用一个数字口即可。这个例子的教程在这里:http://www.alsrobot.cn/article-572.html
将板子插在某些手机上,手机会识别出位键盘设备,让你选择输入法。如果你之前对这个提示程序进行了更换,那么插上设备就可以调用对应程序了,甚至可以免密码hack进入,很强大。如果把Leonardo伪装成最常用的“打印机”,系统就可以自动安装驱动了,对驱动动个手脚就可以hack了。
Mouse 鼠标
The mouse functions enable a Leonardo, Micro, or Due to control cursor movement on a connected computer. When updating the cursor position, it is always relative to the cursor’s previous location.
- Mouse.begin()
- Mouse.click()
- Mouse.end()
- Mouse.move()
- Mouse.press()
- Mouse.release()
- Mouse.isPressed()
Keyboard 键盘
The keyboard functions enable a Leonardo, Micro, or Due to send keystrokes to an attached computer.
Note: Not every possible ASCII character, particularly the non-printing ones, can be sent with the Keyboard library. The library supports the use of modifier keys. Modifier keys change the behavior of another key when pressed simultaneously. See here for additional information on supported keys and their use.
- Keyboard.begin()
- Keyboard.end()
- Keyboard.press()
- Keyboard.print()
- Keyboard.println()
- Keyboard.release()
- Keyboard.releaseAll()
- Keyboard.write()
Examples 例子
- KeyboardAndMouseControl: Demonstrates the Mouse and Keyboard commands in one program.
- KeyboardMessage: Sends a text string when a button is pressed.
- KeyboardLogout : Logs out the current user with key commands
- KeyboardSerial: Reads a byte from the serial port, and sends back a keystroke.
- KeyboardReprogram : opens a new window in the Arduino IDE and reprograms the board with a simple blink program
- ButtonMouseControl: Control cursor movement with 5 pushbuttons.
- JoystickMouseControl: Controls a computer’s cursor movement with a Joystick when a button is pressed.
博主的博客很漂亮,简约大气,黑白搭配,很适合观看。不知博主是基于什么搭建的这个博客,还是自己写的。
就是用WordPress搭建,使用自带的 Twenty Fifteen 主题,嘿嘿