GLCD can not show my keypad 's act

I want to send my data from keypad to GLCD ST7920, but it don't work, could you tell me what the problem here ?
link libra "basicGLCD":Personal.Library.GLCD_QY_12864BG/basicGLCD.h at master · KwangryeolPark/Personal.Library.GLCD_QY_12864BG · GitHub

<pre>
<font color="#5e6d03">#include</font> <font color="#434f54">&lt;</font><b><font color="#d35400">Keypad</font></b><font color="#434f54">.</font><font color="#000000">h</font><font color="#434f54">&gt;</font>
<font color="#5e6d03">#include</font> <font color="#434f54">&lt;</font><b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#000000">h</font><font color="#434f54">&gt;</font>
<font color="#5e6d03">#include</font> <font color="#434f54">&lt;</font><b><font color="#d35400">basicGLCD</font></b><font color="#434f54">.</font><font color="#000000">h</font><font color="#434f54">&gt;</font>

<b><font color="#d35400">basicGLCD</font></b> <font color="#000000">GLCD</font><font color="#000000">;</font>

<font color="#00979c">long</font> <font color="#000000">four</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>
<font color="#00979c">long</font> <font color="#000000">three</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>
<font color="#00979c">long</font> <font color="#000000">two</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>
<font color="#00979c">long</font> <font color="#000000">one</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>

<font color="#00979c">int</font> <font color="#000000">address</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47; gia tri dia chi luu du lieu</font>
<font color="#00979c">const</font> <font color="#00979c">byte</font> <font color="#000000">rows</font> <font color="#434f54">=</font> <font color="#000000">4</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47;so hang</font>
<font color="#00979c">const</font> <font color="#00979c">byte</font> <font color="#000000">columns</font> <font color="#434f54">=</font> <font color="#000000">4</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47; so cot</font>

<font color="#00979c">int</font> <font color="#000000">holdDelay</font> <font color="#434f54">=</font> <font color="#000000">700</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47; thoi gian tre de xem la nhan 1 nut de tranh nhieu~</font>
<font color="#00979c">int</font> <font color="#000000">n</font> <font color="#434f54">=</font> <font color="#000000">3</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47;</font>
<font color="#00979c">int</font> <font color="#000000">state</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47; neu state=0 khong nhan, state=1 nhan thoi gian nho , state = 2 nhan giu lau</font>
<font color="#00979c">char</font> <font color="#000000">key</font><font color="#000000">;</font>
<font color="#00979c">char</font> <font color="#000000">temp</font><font color="#000000">;</font>
<font color="#00979c">int</font> <font color="#000000">i</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>
<font color="#00979c">int</font> <font color="#000000">k</font> <font color="#434f54">=</font> <font color="#000000">1</font><font color="#000000">;</font>

<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;dinh nghia cac gia tri tra ve</font>
<font color="#00979c">char</font> <font color="#000000">keys</font><font color="#000000">[</font><font color="#000000">rows</font><font color="#000000">]</font><font color="#000000">[</font><font color="#000000">columns</font><font color="#000000">]</font> <font color="#434f54">=</font>
<font color="#000000">{</font>
 &nbsp;<font color="#000000">{</font><font color="#00979c">&#39;1&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;2&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;3&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;A&#39;</font><font color="#000000">}</font><font color="#434f54">,</font>
 &nbsp;<font color="#000000">{</font><font color="#00979c">&#39;4&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;5&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;6&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;B&#39;</font><font color="#000000">}</font><font color="#434f54">,</font>
 &nbsp;<font color="#000000">{</font><font color="#00979c">&#39;7&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;8&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;9&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;C&#39;</font><font color="#000000">}</font><font color="#434f54">,</font>
 &nbsp;<font color="#000000">{</font><font color="#00979c">&#39;*&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;0&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;#&#39;</font><font color="#434f54">,</font> <font color="#00979c">&#39;D&#39;</font><font color="#000000">}</font><font color="#434f54">,</font>
<font color="#000000">}</font><font color="#000000">;</font>

<font color="#00979c">byte</font> <font color="#000000">rowPins</font><font color="#000000">[</font><font color="#000000">rows</font><font color="#000000">]</font> <font color="#434f54">=</font> <font color="#000000">{</font><font color="#000000">9</font><font color="#434f54">,</font> <font color="#000000">8</font><font color="#434f54">,</font> <font color="#000000">7</font><font color="#434f54">,</font> <font color="#000000">6</font><font color="#000000">}</font><font color="#000000">;</font> <font color="#434f54">&#47;&#47; cách noi chan Arduino &nbsp;&nbsp;9, 8, 7, 6(mega)</font>
<font color="#00979c">byte</font> <font color="#000000">columnPins</font><font color="#000000">[</font><font color="#000000">columns</font><font color="#000000">]</font> <font color="#434f54">=</font> <font color="#000000">{</font><font color="#000000">13</font><font color="#434f54">,</font> <font color="#000000">12</font><font color="#434f54">,</font> <font color="#000000">11</font><font color="#434f54">,</font> <font color="#000000">10</font><font color="#000000">}</font><font color="#000000">;</font><font color="#434f54">&#47;&#47; cách noi chan Arduino &nbsp;&nbsp;13, 12, 11, 10(mega)</font>

<font color="#434f54">&#47;&#47;cài đặt thư viện keypad</font>
<b><font color="#d35400">Keypad</font></b> <font color="#d35400">keypad</font> <font color="#434f54">=</font> <b><font color="#d35400">Keypad</font></b><font color="#000000">(</font><font color="#d35400">makeKeymap</font><font color="#000000">(</font><font color="#000000">keys</font><font color="#000000">)</font><font color="#434f54">,</font> <font color="#000000">rowPins</font><font color="#434f54">,</font> <font color="#000000">columnPins</font><font color="#434f54">,</font> <font color="#000000">rows</font><font color="#434f54">,</font> <font color="#000000">columns</font><font color="#000000">)</font><font color="#000000">;</font>
<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;</font>
<font color="#00979c">void</font> <font color="#5e6d03">setup</font><font color="#000000">(</font><font color="#000000">)</font>
<font color="#000000">{</font>
 &nbsp;<b><font color="#d35400">Serial</font></b><font color="#434f54">.</font><font color="#d35400">begin</font><font color="#000000">(</font><font color="#000000">9600</font><font color="#000000">)</font><font color="#000000">;</font><font color="#434f54">&#47;&#47;bật serial, baudrate 9600</font>

 &nbsp;<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;START</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">0</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendString</font><font color="#000000">(</font><font color="#005c5f">&#34;WELCOME....&#34;</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">delay</font><font color="#000000">(</font><font color="#000000">1000</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">clear</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">;</font>

 &nbsp;<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;SET PIN GLCD 128x64</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setDataPins</font><font color="#000000">(</font><font color="#000000">23</font><font color="#434f54">,</font> <font color="#000000">25</font><font color="#434f54">,</font> <font color="#000000">27</font><font color="#434f54">,</font> <font color="#000000">29</font><font color="#434f54">,</font> <font color="#000000">31</font><font color="#434f54">,</font> <font color="#000000">33</font><font color="#434f54">,</font> <font color="#000000">35</font><font color="#434f54">,</font> <font color="#000000">37</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setRSPin</font><font color="#000000">(</font><font color="#000000">A2</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCSPins</font><font color="#000000">(</font><font color="#000000">A0</font><font color="#434f54">,</font> <font color="#000000">A1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setENPin</font><font color="#000000">(</font><font color="#000000">A4</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setRWPin</font><font color="#000000">(</font><font color="#000000">A3</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#5e6d03">while</font> <font color="#000000">(</font><font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">init</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">!=</font> <font color="#000000">1</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">0</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendString</font><font color="#000000">(</font><font color="#005c5f">&#34;Set all pins&#34;</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">return</font> <font color="#000000">0</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#d35400">delay</font><font color="#000000">(</font><font color="#000000">1000</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">}</font>

 &nbsp;<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;NHAP THONG SO CHO IVT</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendString</font><font color="#000000">(</font><font color="#005c5f">&#34;Loai IVT: &#34;</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">2</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendString</font><font color="#000000">(</font><font color="#005c5f">&#34;TIME LM : &#34;</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">3</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendString</font><font color="#000000">(</font><font color="#005c5f">&#34;CSM IVT :&#34;</font><font color="#000000">)</font><font color="#000000">;</font>


<font color="#000000">}</font>
<font color="#434f54">&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;&#47;</font>
<font color="#00979c">void</font> <font color="#5e6d03">loop</font><font color="#000000">(</font><font color="#000000">)</font>
<font color="#000000">{</font>
 &nbsp;<font color="#00979c">char</font> <font color="#000000">temp</font> <font color="#434f54">=</font> <font color="#d35400">keypad</font><font color="#434f54">.</font><font color="#d35400">getKey</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">;</font>

 &nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#00979c">int</font><font color="#000000">)</font><font color="#d35400">keypad</font><font color="#434f54">.</font><font color="#d35400">getState</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">==</font> &nbsp;<font color="#00979c">PRESSED</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">temp</font> <font color="#434f54">!=</font> <font color="#000000">0</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">key</font> <font color="#434f54">=</font> <font color="#000000">temp</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>

 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#00979c">int</font><font color="#000000">)</font><font color="#d35400">keypad</font><font color="#434f54">.</font><font color="#d35400">getState</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">==</font> &nbsp;<font color="#00979c">HOLD</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">state</font><font color="#434f54">++</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">state</font> <font color="#434f54">=</font> <font color="#d35400">constrain</font><font color="#000000">(</font><font color="#000000">state</font><font color="#434f54">,</font> <font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">n</font> <font color="#434f54">-</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#d35400">delay</font><font color="#000000">(</font><font color="#000000">holdDelay</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>

 &nbsp;&nbsp;&nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#00979c">int</font><font color="#000000">)</font><font color="#d35400">keypad</font><font color="#434f54">.</font><font color="#d35400">getState</font><font color="#000000">(</font><font color="#000000">)</font> <font color="#434f54">==</font> &nbsp;<font color="#00979c">RELEASED</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">key</font> <font color="#434f54">+=</font> <font color="#000000">state</font><font color="#000000">;</font>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#000000">state</font> <font color="#434f54">=</font> <font color="#000000">0</font><font color="#000000">;</font>

 &nbsp;&nbsp;&nbsp;<font color="#000000">}</font>

 &nbsp;<font color="#000000">}</font>
 &nbsp;<font color="#434f54">&#47;&#47;Xuat len LCD</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setPage</font><font color="#000000">(</font><font color="#d35400">RIGHT</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">setCursor</font><font color="#000000">(</font><font color="#000000">3</font><font color="#434f54">,</font> <font color="#000000">k</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">GLCD</font><font color="#434f54">.</font><font color="#d35400">sendChar</font><font color="#000000">(</font><font color="#000000">key</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#d35400">delay</font><font color="#000000">(</font><font color="#000000">700</font><font color="#000000">)</font><font color="#000000">;</font>

 &nbsp;<font color="#5e6d03">if</font> <font color="#000000">(</font><font color="#000000">temp</font> <font color="#434f54">==</font> <font color="#00979c">&#39;D&#39;</font><font color="#000000">)</font> <font color="#000000">{</font>
 &nbsp;&nbsp;&nbsp;<font color="#000000">k</font><font color="#434f54">++</font><font color="#000000">;</font>

 &nbsp;<font color="#000000">}</font>


<font color="#000000">}</font>

<font color="#00979c">void</font> <font color="#000000">WritelongtoEEPROM</font><font color="#000000">(</font><font color="#00979c">int</font> <font color="#000000">adress</font><font color="#434f54">,</font> <font color="#00979c">long</font> <font color="#000000">key</font><font color="#000000">)</font>
<font color="#000000">{</font>
 &nbsp;<font color="#00979c">byte</font> <font color="#000000">four</font> <font color="#434f54">=</font> <font color="#000000">(</font><font color="#000000">key</font> <font color="#434f54">&amp;</font> <font color="#000000">0xFF</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">byte</font> <font color="#000000">three</font> <font color="#434f54">=</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">key</font> <font color="#434f54">&gt;&gt;</font> <font color="#000000">8</font><font color="#000000">)</font> <font color="#434f54">&amp;</font> <font color="#000000">0xFF</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">byte</font> <font color="#000000">two</font> <font color="#434f54">=</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">key</font> <font color="#434f54">&gt;&gt;</font> <font color="#000000">16</font><font color="#000000">)</font> <font color="#434f54">&amp;</font> <font color="#000000">0xFF</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#00979c">byte</font> <font color="#000000">one</font> <font color="#434f54">=</font> <font color="#000000">(</font><font color="#000000">(</font><font color="#000000">key</font> <font color="#434f54">&gt;&gt;</font> <font color="#000000">24</font><font color="#000000">)</font> <font color="#434f54">&amp;</font> <font color="#000000">0xFF</font><font color="#000000">)</font><font color="#000000">;</font>

 &nbsp;<font color="#434f54">&#47;&#47;ghi 4 bytes vào EEPROM</font>
 &nbsp;<b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">write</font><font color="#000000">(</font><font color="#000000">adress</font><font color="#434f54">,</font> <font color="#000000">four</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">write</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">1</font><font color="#434f54">,</font> <font color="#000000">three</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">write</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">2</font><font color="#434f54">,</font> <font color="#000000">two</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">write</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">3</font><font color="#434f54">,</font> <font color="#000000">one</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#434f54">&#47;&#47;đọc 4 bytes từ EEPROM</font>
 &nbsp;<font color="#000000">four</font> <font color="#434f54">=</font> <b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">read</font><font color="#000000">(</font><font color="#000000">adress</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">three</font> <font color="#434f54">=</font> <b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">read</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">1</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">two</font> <font color="#434f54">=</font> <b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">read</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">2</font><font color="#000000">)</font><font color="#000000">;</font>
 &nbsp;<font color="#000000">one</font> <font color="#434f54">=</font> <b><font color="#d35400">EEPROM</font></b><font color="#434f54">.</font><font color="#d35400">read</font><font color="#000000">(</font><font color="#000000">adress</font> <font color="#434f54">+</font> <font color="#000000">3</font><font color="#000000">)</font><font color="#000000">;</font>

 &nbsp;<font color="#434f54">&#47;&#47;GLCD.setCursor(1,5);</font>
 &nbsp;<font color="#434f54">&#47;&#47;GLCD.sendData(</font>

<font color="#000000">}</font>

</pre>

image

Your keypad handling looks strange. I recommend you start with one of the Keypad library examples (File->Examples->Keypad) and build from there.

This is how your sketch should have been posted:

#include <Keypad.h>
#include <EEPROM.h>
#include <basicGLCD.h>

basicGLCD GLCD;

long four = 0;
long three = 0;
long two = 0;
long one = 0;

int address = 0; // gia tri dia chi luu du lieu
const byte rows = 4; //so hang
const byte columns = 4; // so cot

int holdDelay = 700; // thoi gian tre de xem la nhan 1 nut de tranh nhieu~
int n = 3; //
int state = 0; // neu state=0 khong nhan, state=1 nhan thoi gian nho , state = 2 nhan giu lau
char key;
char temp;
int i = 0;
int k = 1;

////////////dinh nghia cac gia tri tra ve
char keys[rows][columns] =
{
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'},
};

byte rowPins[rows] = {9, 8, 7, 6}; // cách noi chan Arduino   9, 8, 7, 6(mega)
byte columnPins[columns] = {13, 12, 11, 10};// cách noi chan Arduino   13, 12, 11, 10(mega)

//cài đặt thư viện keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, columnPins, rows, columns);
//////////////////////////////////////////////////////
void setup()
{
  Serial.begin(9600);//bật serial, baudrate 9600

  //////////////START
  GLCD.setCursor(1, 0);
  GLCD.sendString("WELCOME....");
  delay(1000);
  GLCD.clear();

  //////SET PIN GLCD 128x64
  GLCD.setDataPins(23, 25, 27, 29, 31, 33, 35, 37);
  GLCD.setRSPin(A2);
  GLCD.setCSPins(A0, A1);
  GLCD.setENPin(A4);
  GLCD.setRWPin(A3);
  while (GLCD.init() != 1)
  {
    GLCD.setCursor(1, 0);
    GLCD.sendString("Set all pins");
    return 0;
    delay(1000);
  }

  //////////////////////////////////////////NHAP THONG SO CHO IVT
  GLCD.setCursor(1, 1);
  GLCD.sendString("Loai IVT: ");
  GLCD.setCursor(1, 2);
  GLCD.sendString("TIME LM : ");
  GLCD.setCursor(1, 3);
  GLCD.sendString("CSM IVT :");
}

//////////////////////////////////////////
void loop()
{
  char temp = keypad.getKey();

  if ((int)keypad.getState() ==  PRESSED)
  {
    if (temp != 0)
    {
      key = temp;
    }

    if ((int)keypad.getState() ==  HOLD)
    {
      state++;
      state = constrain(state, 1, n - 1);
      delay(holdDelay);
    }

    if ((int)keypad.getState() ==  RELEASED)
    {
      key += state;
      state = 0;
    }
  }
  
  //Xuat len LCD
  GLCD.setPage(RIGHT);
  GLCD.setCursor(3, k);
  GLCD.sendChar(key);
  delay(700);

  if (temp == 'D')
  {
    k++;
  }
}

void WritelongtoEEPROM(int adress, long key)
{
  byte four = (key & 0xFF);
  byte three = ((key >> 8) & 0xFF);
  byte two = ((key >> 16) & 0xFF);
  byte one = ((key >> 24) & 0xFF);

  //ghi 4 bytes vào EEPROM
  EEPROM.write(adress, four);
  EEPROM.write(adress + 1, three);
  EEPROM.write(adress + 2, two);
  EEPROM.write(adress + 3, one);
  //đọc 4 bytes từ EEPROM
  four = EEPROM.read(adress);
  three = EEPROM.read(adress + 1);
  two = EEPROM.read(adress + 2);
  one = EEPROM.read(adress + 3);

  //GLCD.setCursor(1,5);
  //GLCD.sendData(

}

Well, i met the same problem, when i run serial in keypad library and see in the monitor it's right , but i use that code to show in LCD it doesn't work . It has trouble in GLCD library right ?
when i press button LCD show strange characters.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.