Arduino Leonardo 可以充当USB设备和电脑进行数据通信。因此,凡是USB方面的数据流都可以用它去做。对应的有一些函数,最基本的就是用函数充当鼠标键盘来访问USB上位机。对应的USB控制芯片为32u4, 以及Arduino Due/Zero。下面附上函数库名字便于查询。

对应的输入按键或者鼠标移动数据可以是多种多样的,比如来自三轴加速度计、跳舞机等等,非常有趣。比如这个视频:

http://v.youku.com/v_show/id_XNzU0NjY4Njcy.html

这个视频使用的是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.

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.

Examples 例子

2 条评论

  1. 博主的博客很漂亮,简约大气,黑白搭配,很适合观看。不知博主是基于什么搭建的这个博客,还是自己写的。

    1. 就是用WordPress搭建,使用自带的 Twenty Fifteen 主题,嘿嘿

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注