{"id":881,"date":"2016-05-13T15:01:19","date_gmt":"2016-05-13T07:01:19","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=881"},"modified":"2016-05-13T15:01:19","modified_gmt":"2016-05-13T07:01:19","slug":"arduino-4x4-%e8%96%84%e8%86%9c%e9%8d%b5%e7%9b%a4","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=881","title":{"rendered":"[ Arduino ] &#8211; 4&#215;4 \u8584\u819c\u9375\u76e4"},"content":{"rendered":"<p>library \u4e0b\u8f09\u7db2\u5740\uff1a<a href=\"http:\/\/cnlearn.linksprite.com\/wp-content\/uploads\/2014\/03\/keypad.zip\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/cnlearn.linksprite.com\/wp-content\/uploads\/2014\/03\/keypad.zip<\/a><br \/>\n\u7a0b\u5f0f\u78bc\uff1a<br \/>\n[javascript]<br \/>\n#include &lt;Keypad.h&gt;<br \/>\nconst byte ROWS = 4;<br \/>\nconst byte COLS = 4;<br \/>\n\/\/define the symbols on the buttons of the keypads<br \/>\nchar Keys[ROWS][COLS] =<br \/>\n{<br \/>\n  {&#8216;1&#8242;,&#8217;2&#8242;,&#8217;3&#8242;,&#8217;A&#8217;},<br \/>\n  {&#8216;4&#8242;,&#8217;5&#8242;,&#8217;6&#8242;,&#8217;B&#8217;},<br \/>\n  {&#8216;7&#8242;,&#8217;8&#8242;,&#8217;9&#8242;,&#8217;C&#8217;},<br \/>\n  {&#8216;*&#8217;,&#8217;0&#8242;,&#8217;#&#8217;,&#8217;D&#8217;}<br \/>\n};\/\/\u4ee5\u4e0a 4&#215;4 \u9663\u5217\u53ef\u81ea\u8a02\u6210\u4f60\u8981\u7684\u5b57\u5143<br \/>\nbyte rowPins[ROWS] = {2,3,4,5};\/\/\u5217\u8173\u4f4d<br \/>\nbyte colPins[COLS] = {6,7,8,9};\/\/\u884c\u8173\u4f4d<br \/>\n\/\/initialize an instance of class NewKeypad<br \/>\nKeypad customKeypad = Keypad(makeKeymap(Keys),rowPins,colPins,ROWS,COLS);<br \/>\nvoid setup()<br \/>\n{<br \/>\n  Serial.begin(9600);\/\/\u958b\u555f\u5e8f\u5217<br \/>\n  Serial.println(&quot;Please press the keyboard:&quot;);<br \/>\n}<br \/>\nvoid  loop()<br \/>\n{<br \/>\n  char key = customKeypad.getKey();<br \/>\n  if(key!=NO_KEY)<br \/>\n  {<br \/>\n    Serial.print(&quot;Key Value : &quot;);<br \/>\n    Serial.println(key);\/\/\u5370\u51fa\u6240\u6309\u4e0b\u7684\u5b57\u5143<br \/>\n  }<br \/>\n}<br \/>\n[\/javascript]<br \/>\n\u539f\u6587\u7db2\u5740\uff1a<br \/>\n<a href=\"http:\/\/learn.linksprite.com\/arduino\/4x4-keyboard-for-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/learn.linksprite.com\/arduino\/4&#215;4-keyboard-for-arduino\/<\/a>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>library \u4e0b\u8f09\u7db2\u5740\uff1ahttp:\/\/cnlea&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[80,1144],"class_list":["post-881","post","type-post","status-publish","format-standard","hentry","category-arduino","tag-4x4","tag-1144"],"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=881"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/881\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}