我没看到问题,请帮我 最初按钮盒有更多代码,但我将编码器剪掉了
Arduino:1.8.7(Windows 10),开发板:“ Arduino / Genuino Micro”
构建选项已更改,所有重建 28.01.2018 \ Arduino \ ARDUINO_BUTTON_BOXV2a \ ARDUINO_BUTTON_BOXV2a.ino:在函数'void setup()'中:
ARDUINO_BUTTON_BOXV2a:103:13:错误:在'{'标记之前不允许在函数定义
void loop(){
^
ARDUINO_BUTTON_BOXV2a:111:29:错误:在'{'标记之前不允许在此处进行功能定义
void CheckAllButtons(void){
^
ARDUINO_BUTTON_BOXV2a:133:1:错误:在输入末尾预期为'}'
}
^
退出状态1 '{'令牌
之前的功能定义在这里是不允许的此报告将包含更多信息 “在编译期间显示详细输出” 文件->首选项中启用了此选项。
#include <Keypad.h>
#include <Joystick.h>
#define ENABLE_PULLUPS
#define NUMROTARIES 0
#define NUMBUTTONS 16
#define NUMROWS 4
#define NUMCOLS 4
byte buttons[NUMROWS][NUMCOLS] = {
{0,1,2,3},
{4,5,6,7},
{8,9,10,11},
{12,13,14,15},
};
byte rowPins[NUMROWS] = {15,14,16,10};
byte colPins[NUMCOLS] = {A3,A2,A1,A0};
Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS);
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_JOYSTICK, 32, 0,
false, false, false, false, false, false,
false, false, false, false, false);
void setup() {
Joystick.begin();
// rotary_init();}
void loop() {
// CheckAllEncoders();
CheckAllButtons();
}
void CheckAllButtons(void) {
if (buttbx.getKeys())
{
for (int i=0; i<LIST_MAX; i++)
{
if ( buttbx.key[i].stateChanged )
{
switch (buttbx.key[i].kstate) {
case PRESSED:
case HOLD:
Joystick.setButton(buttbx.key[i].kchar, 1);
break;
case RELEASED:
case IDLE:
Joystick.setButton(buttbx.key[i].kchar, 0);
break;
}
}
}
}
}
答案 0 :(得分:1)
更改第101行
// rotary_init();}
到
// rotary_init();
}
您的注释中包含'}',因此编译器不希望使用新功能