Advertisement

2021-07-10 arduino 处理矩阵键盘 keypad.h开源库函数使用说明

阅读量:

首先创建一个键盘实例:
明确行引脚的配置
确认列引脚的设置

复制代码
    const byte rows = 4; //4行
    const byte cols = 4; //4列
    char keys[rows][cols] = {
      {'1','2','3','A'},
      {'4','5','6','K'},
      {'7','8','9','M'},
      {'#','0','*','O'}
    };
    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 );//构建库函数,参数是制作键盘矩阵地图,行引脚,列引脚,行数,列数)
    
    

全部评论 (0)

还没有任何评论哟~