library 下載網址:http://cnlearn.linksprite.com/wp-content/uploads/2014/03/keypad.zip
程式碼:
[javascript]
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
//define the symbols on the buttons of the keypads
char Keys[ROWS][COLS] =
{
{‘1′,’2′,’3′,’A’},
{‘4′,’5′,’6′,’B’},
{‘7′,’8′,’9′,’C’},
{‘*’,’0′,’#’,’D’}
};//以上 4×4 陣列可自訂成你要的字元
byte rowPins[ROWS] = {2,3,4,5};//列腳位
byte colPins[COLS] = {6,7,8,9};//行腳位
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad(makeKeymap(Keys),rowPins,colPins,ROWS,COLS);
void setup()
{
Serial.begin(9600);//開啟序列
Serial.println("Please press the keyboard:");
}
void loop()
{
char key = customKeypad.getKey();
if(key!=NO_KEY)
{
Serial.print("Key Value : ");
Serial.println(key);//印出所按下的字元
}
}
[/javascript]
原文網址:
http://learn.linksprite.com/arduino/4×4-keyboard-for-arduino/
[ Arduino ] – 4×4 薄膜鍵盤
評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]
評等結果
點擊便能為這篇文章進行評等!
[評等總次數: 0,平均評等: 0]
手指伸縮狼爪 伸縮爪 機械爪 狼爪 伸縮爪子
3M 日本原裝進口 速效型 防水噴霧 170ml 衣物 鞋子 皮革 透氣 防水 團購
維力 素飄香 野菜多 素排骨雞 素紅燒牛肉 麻辣燙 麻油當歸枸杞 蔘湯麵 素食 泡麵 單包
義美e家小館-素食炒飯270g/包