首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Teensy 3.2 Hellokeypad草图编译错误

Teensy 3.2 Hellokeypad草图编译错误
EN

Stack Overflow用户
提问于 2015-12-16 03:18:41
回答 1查看 387关注 0票数 0

当我尝试编译HelloKeypad演示草图时,我得到了一个编译器错误。

我使用的是一台Windows7计算机,使用的是一个很小的3.2主板。

我买了一个像这样的键盘:https://www.adafruit.com/products/1824

我从这里下载了keypad.zip文件:https://www.pjrc.com/teensy/td_libs_Keypad.html,我使用的是同一个网页上的示例草图:

代码语言:javascript
复制
/* @file HelloKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates the simplest use of the matrix Keypad library.
|| #
*/
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
}

void loop(){
  char key = keypad.getKey();

  if (key){
    Serial.println(key);
  }
}

以下是编译器消息。

代码语言:javascript
复制
Arduino: 1.6.6 (Windows 7), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial + Keyboard + Mouse + Joystick, 96 MHz optimized (overclock), US English"

In file included from C:\Users\FRESH1~1\AppData\Local\Temp\arduino_827e3ed6878980f03915bd59f832243c\HelloKeypad.ino:10:0:
C:\Users\fresh1011\Documents\Arduino\libraries\Keypad/Keypad.h:80:27: error: expected class-name before '{' token
class Keypad : public Key {
^
C:\Users\fresh1011\Documents\Arduino\libraries\Keypad/Keypad.h:90:2: error: 'Key' does not name a type
Key key[LIST_MAX];
^
C:\Users\fresh1011\Documents\Arduino\libraries\Keypad/Keypad.h:95:2: error: 'KeyState' does not name a type
KeyState getState();
^
C:\Users\fresh1011\Documents\Arduino\libraries\Keypad/Keypad.h:119:28: error: 'KeyState' has not been declared
void transitionTo(byte n, KeyState nextState);
^
Multiple libraries were found for "Keypad.h"
 Used: C:\Users\fresh1011\Documents\Arduino\libraries\Keypad
 Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Keypad
exit status 1
Error compiling.

Keypad.zip文件是否已过期?

谢谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2015-12-21 16:24:39

可以使用Arduino IDE 1.6.3而不是1.6.6。

根据pjrc forum中的以下post,它解决了库支持的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34297589

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档