极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10999|回复: 2

请问Arduino nano如何使用Keyboard.begin();

[复制链接]
发表于 2015-2-15 22:20:45 | 显示全部楼层 |阅读模式
本帖最后由 不灭的心 于 2015-2-15 22:39 编辑

下载了论坛里的usbkeyboard的库显示不支持nano,自带的库包含进来很多错误,最后说Keyboard不存在,
请教下坛友nano可不可以用Keyboard,想用nano做一个向屏幕上打字的程序

使用了论坛里的UsbKeyboard的库,错误如下
Arduino: 1.6.0 (Windows 7), Board: "Arduino Nano, ATmega328"

In file included from D:\Arduino1.6\libraries\UsbKeyboard/UsbKeyboard.h:13:0,
                 from sketch_feb15a.ino:27:
D:\Arduino1.6\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:\Arduino1.6\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:\Arduino1.6\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:\Arduino1.6\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:\Arduino1.6\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:\Arduino1.6\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:\Arduino1.6\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_feb15a.ino:27:0:
D:\Arduino1.6\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 */
                                       ^
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
回复

使用道具 举报

发表于 2015-2-16 09:07:07 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-2-16 13:48:21 | 显示全部楼层
林定祥 发表于 2015-2-16 09:07
请参考:
http://www.geek-workshop.com/thread-1137-1-1.html

我就是看的这个帖子,只是用那个库编译时出了很多错,能否给指导下如何解决?
回复 支持 反对

使用道具 举报

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

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-17 12:01 , Processed in 0.078800 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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