极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: Ansifa

Arduino学习笔记A11 - Arduino模拟电脑键盘(基于AVR-USB的USB-HID设备)

  [复制链接]
发表于 2014-7-12 00:49:00 | 显示全部楼层
这个做法非常非常奇怪,后边一根完好的Uusb线插电脑已装好驱动还从那里取电,不闻不问从板子左右又接出一个usb头插回电脑里
回复 支持 反对

使用道具 举报

发表于 2014-7-21 10:00:41 | 显示全部楼层
果断买材料做啊
回复 支持 反对

使用道具 举报

发表于 2014-11-22 11:07:28 | 显示全部楼层
我的库文件一直报错误,错误信息:
Arduino:1.5.7 (Windows 7), 板:"Arduino Leonardo"

In file included from C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:13:0,
                 from UsbKeyboardDemo1.pde:1:
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:479:26: error: variable 'usbDescriptorDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorDevice[];
                          ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:485:33: error: variable 'usbDescriptorConfiguration' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorConfiguration[];
                                 ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:491:29: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorHidReport[];
                             ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:497:27: error: variable 'usbDescriptorString0' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorString0[];
                           ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:503:31: error: variable 'usbDescriptorStringVendor' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringVendor[];
                               ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:509:31: error: variable 'usbDescriptorStringDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringDevice[];
                               ^
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/usbdrv.h:515:37: error: variable 'usbDescriptorStringSerialNumber' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringSerialNumber[];
                                     ^
In file included from UsbKeyboardDemo1.pde:1:0:
C:\Users\Administrator\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:36:39: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM char usbHidReportDescriptor[35] = { /* USB report descriptor */
                                       ^
回复 支持 反对

使用道具 举报

发表于 2014-12-20 00:36:35 | 显示全部楼层
楼主 我有问题 为什么

In file included from sketch_dec20a.ino:5:
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h: In constructor 'UsbKeyboardDevice::UsbKeyboardDevice()':
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:146: error: 'usbSetInterrupt' was not declared in this scope
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h: In member function 'void UsbKeyboardDevice::sendKeyStroke(byte, byte)':
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:159: error: 'usbInterruptIsReady' was not declared in this scope
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:170: error: 'usbSetInterrupt' was not declared in this scope
D:\Documents\Arduino\libraries\UsbKeyboard/UsbKeyboard.h:172: error: 'usbInterruptIsReady' was not declared in this scope
回复 支持 反对

使用道具 举报

发表于 2014-12-20 00:38:01 | 显示全部楼层
没问题了  原来是 那个 添加库 的问题 我是 MINI  用TTL 的  接5V  GND  RX DX  要怎么改》
回复 支持 反对

使用道具 举报

发表于 2014-12-26 20:37:13 | 显示全部楼层
请教楼主,该方法在widows系统下没问题。但是windows启动前比如想自动输入Bios密码时没反应,而一般的usb键盘可以。请问有办法在windows启动前也能用吗?
回复 支持 反对

使用道具 举报

发表于 2015-1-11 22:54:01 | 显示全部楼层
我可以用USB 转TTL 的线做么?
回复 支持 反对

使用道具 举报

发表于 2015-2-25 21:19:13 | 显示全部楼层
想试试看,我的UNO可以做吗?
回复 支持 反对

使用道具 举报

发表于 2015-2-26 11:15:06 | 显示全部楼层
xinxinzhihuo 发表于 2015-2-25 21:19
想试试看,我的UNO可以做吗?

当然可以.如果有3.3V的电池(磷酸铁锂)或两个1.5V的干电池串起来做电源,就只需要一个2.2K(或1.5K)的电阻.
回复 支持 反对

使用道具 举报

发表于 2015-2-26 20:13:02 | 显示全部楼层
http://player.youku.com/player.php/sid/XOTAwMjM2NDAw/v.swf

没有合适的稳压管, 不过仔细看看,稳压管是电平转换用的,只要电平合适不用也可.思路有两个
1.用3.3V的铁锂供电,(USB口vcc悬空),如视频,除UNO和USB公头,必要的杜邦线外,只有一个2.2K电阻,顺利实现windows开机密码输入
2. USB口引出5V,1117,317等IC稳压到3.3给UNO供电,这个还没试验.
回复 支持 反对

使用道具 举报

发表于 2015-4-6 20:28:42 | 显示全部楼层
弱弱的问一句↑↓←→,shift,ctrl,alt是哪几个?
回复 支持 反对

使用道具 举报

发表于 2015-4-8 07:33:57 | 显示全部楼层
eysajan 发表于 2014-11-22 11:07
我的库文件一直报错误,错误信息:
Arduino:1.5.7 (Windows 7), 板:"Arduino Leonardo"

问一下,你的问题解决了吗?
回复 支持 反对

使用道具 举报

发表于 2015-4-15 19:48:16 | 显示全部楼层
Arduino:1.5.7 (Windows XP), 板:"Arduino Mini, ATmega328"

Build options changed, rebuilding all

In file included from D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/UsbKeyboard.h:13:0,
                 from sketch_apr15a.ino:27:
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:479:26: error: variable 'usbDescriptorDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorDevice[];
                          ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:485:33: error: variable 'usbDescriptorConfiguration' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorConfiguration[];
                                 ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:491:29: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorHidReport[];
                             ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:497:27: error: variable 'usbDescriptorString0' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
char usbDescriptorString0[];
                           ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:503:31: error: variable 'usbDescriptorStringVendor' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringVendor[];
                               ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:509:31: error: variable 'usbDescriptorStringDevice' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringDevice[];
                               ^
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/usbdrv.h:515:37: error: variable 'usbDescriptorStringSerialNumber' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
int usbDescriptorStringSerialNumber[];
                                     ^
In file included from sketch_apr15a.ino:27:0:
D:\arduino-1.5.7-windows\arduino-1.5.7\libraries\UsbKeyboard/UsbKeyboard.h:36:39: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
PROGMEM char usbHidReportDescriptor[35] = { /* USB report descriptor */
                                       ^

出现这样的错误,怎么解决??
回复 支持 反对

使用道具 举报

发表于 2015-4-17 23:28:17 | 显示全部楼层
成功了。但是焊接的时候根据你的焊点焊的,貌似有问题,后来根据电路图焊接就对了。你的焊点绿白貌似反了
回复 支持 反对

使用道具 举报

发表于 2015-4-19 09:56:45 | 显示全部楼层
看起来很棒,做一个试试
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-3-29 02:40 , Processed in 0.043483 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表