Test program for TM1638 LED controller. Supports LED&KEY, QYF-TM1638 and JY-LKM1638 module.

Dependencies:   TM1638 mbed

See here for more information.

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Fri Jan 15 19:10:16 2016 +0000
Parent:
1:12dadbc0017d
Child:
3:f1484bfa0574
Commit message:
Refactored display and keyboard defines, added ASCII font.

Changed in this revision

TM1638.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TM1638.lib	Sat Jan 09 14:34:16 2016 +0000
+++ b/TM1638.lib	Fri Jan 15 19:10:16 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/wim/code/TM1638/#1f2453ed85d7
+https://developer.mbed.org/users/wim/code/TM1638/#532ce15ea9ec
--- a/main.cpp	Sat Jan 09 14:34:16 2016 +0000
+++ b/main.cpp	Fri Jan 15 19:10:16 2016 +0000
@@ -1,5 +1,6 @@
 /* mbed TM1638 Test program, for TM1638 LED controller
  * Copyright (c) 2015, v01: WH, Initial version
+ *               2016, v02: WH, Added ASCII alphabet test 
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -103,16 +104,30 @@
 //          LEDKEY8.cls(); 
 //          LEDKEY8.writeData(mbed_str);
 
-#if(0)
+#if(1)
+//test to show all chars
+          pc.printf("Show all alpha chars\r\n");
+          wait(1);          
+          LEDKEY8.cls(); 
+         
+          for (int i=0; i<26; i++) {
+            LEDKEY8.printf("%c", char(i + 'A'));
+//            LEDKEY8.printf("%c", char(i + 'a'));            
+            wait(0.25);                      
+          }
+          pc.printf("Show all alpha chars done\r\n");                    
+#endif            
+
+#if(1)
 //test to show all chars
           pc.printf("Show all chars\r\n");
           wait(1);          
           LEDKEY8.cls(); 
-         
-          for (int i=0; i<26; i++) {
-            LEDKEY8.writeData(0, FONT_16S[i][0]);
-            LEDKEY8.writeData(1, FONT_16S[i][1]);
-            wait(1);                      
+
+          for (int i=FONT_7S_START; i<FONT_7S_END; i++) {
+            LEDKEY8.printf("%c", char(i));
+//            wait(0.25);
+            cmd = pc.getc(); // wait for key            
           }
           pc.printf("Show all chars done\r\n");                    
 #endif            
@@ -203,12 +218,14 @@
 
         if (keydata[LEDKEY8_SW5_IDX] == LEDKEY8_SW5_BIT) { //sw5  
           LEDKEY8.cls(); // clear all, preserve Icons
-          LEDKEY8.writeData(hello_str);           
+//          LEDKEY8.writeData(hello_str);
+          LEDKEY8.printf("hello");                  
         }
 
         if (keydata[LEDKEY8_SW6_IDX] == LEDKEY8_SW6_BIT) { //sw6  
           LEDKEY8.cls(); // clear all, preserve Icons
-          LEDKEY8.writeData(bye_str);                   
+//          LEDKEY8.writeData(bye_str);
+          LEDKEY8.printf("Bye");          
         }
         
         if (keydata[LEDKEY8_SW7_IDX] == LEDKEY8_SW7_BIT) { //sw7