新手試試 --- 4×4 matrix keypad 之 Arduino Hello Keypad試作

本帖最後由 zonebaby 於 2010-5-22 18:27 編輯

今次試下砌個4×4既matrix keypad

就係好似E張線路圖咁砌。

4×4 matrix keypad Schematic Diagram
matixkeypad.jpg

砌好左就係咁

4×4 matrix keypad
keypad.jpg


ps 更改圖片

本帖最後由 zonebaby 於 2010-5-22 17:36 編輯

用番Arduino個Matrix Keypad library試下。個library可以係依度搵倒。

http://www.arduino.cc/playground/Main/KeypadTutorial

將個library放係..\libraries下便就可以用倒。

再改下個附帶既例子HelloKeypad試下。
打開個code睇下,原來都好易改,就係改左依幾句,
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

變成依幾句,去配合個matrix keypad既matrix大小,按鍵字符,同埋接口既pin no。


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

compile完再upload就可以試下啱唔啱。
用ardiuno既serial monitor就睇郅個matrix keypad既輸出。

serial monitor
serialmonitor.jpg

4×4 matrix keypad試機成功......

ps:加番張圖

TOP

後記:暫時未有...

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

ching都唔算係新手喇  咁多Arduino既post都係你出
我要向你學野  前幾日買左返黎都未玩過  
e家諗住寫紅綠燈玩

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

回復 7# nietzsche


    你咁都講得出,
話時話我買左ARDUINO後唔知用黎做咩好

TOP

提示: 作者被禁止或刪除 內容自動屏蔽

TOP

回復 9# nietzsche


    你地果邊ARDUINO要幾錢??
(Duemilanove)

TOP