Menu para a IHM

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Revision:
4:a3e4bb2053cb
Parent:
3:f238b4f7874f
Child:
5:9936706721a8
--- a/main.cpp	Sun Aug 24 09:01:56 2014 +0000
+++ b/main.cpp	Sun Mar 29 13:12:07 2015 +0000
@@ -1,448 +1,76 @@
-// Hello World! for the TextLCD
+/* Hello World! for the TextLCD Enhanced Library*/
 
 #include "mbed.h"
 #include "TextLCD.h"
-
+ 
 // Host PC Communication channels
 Serial pc(USBTX, USBRX); // tx, rx
-
-void show_menu() {
-    pc.printf("0: Exit\n\r");
-    pc.printf("1: Show Menu\n\r");    
-    pc.printf("2: Goto 0,0\n\r"); 
-    pc.printf("3: Goto columns(),rows()\n\r");    
-    pc.printf("4: cls()\n\r");        
-    pc.printf("5: UDCs \n\r");            
-    pc.printf("6: Fill\n\r");                
-    pc.printf("7: Cursor On\n\r");                    
-    pc.printf("8: Cursor Off\n\r");                        
-    pc.printf("9: Text\n\r");                            
-    pc.printf("A: Display On\n\r");                    
-    pc.printf("B: Display Off\n\r");                        
-    pc.printf("C: Backlight On\n\r");                    
-    pc.printf("D: Backlight Off\n\r");                           
-    pc.printf("P: init \n\r");                        
-    pc.printf("Q: contrast \n\r");                            
-    pc.printf("\n\r");                
-}
-
-
+ 
 // I2C Communication
-I2C i2c_lcd(p28,p27); // SDA, SCL
-//I2C i2c_lcd(p9,p10); // SDA, SCL
-
+I2C i2c_lcd(p9,p10); // SDA, SCL
+//I2C i2c_lcd(p28,p27); // SDA, SCL
+ 
 // SPI Communication
 SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
-//DigitalOut cs(p8);
-//DigitalOut cs2(p9);
 
-//4 Bit bus
-//TextLCD lcd2(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x4); // rs, e, d4-d7  =ok
-//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x2); // rs, e, d4-d7 =ok
-//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7 =ok
-//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD24x2); // rs, e, d4-d7 =ok
-//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD24x4D, TextLCD::KS0078); // rs, e, d4-d7 =ok
-//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD40x2); // rs, e, d4-d7 =ok
-
-//I2C Expander PCF8574
-//TextLCD_I2C lcd(&i2c_lcd, 0x40, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type =ok
-//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type =ok
+// LCD instantiation 
+//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x2);        // 4bit bus: rs, e, d4-d7
+TextLCD_I2C lcd(&i2c_lcd, 0x40, TextLCD::LCD20x4);                  // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type
+//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type, Ctrl Type
+//TextLCD_I2C lcd(&spi_lcd, p8, TextLCD::LCD24x4D);                   // I2C exp: SPI bus, CS pin, LCD Type
+//TextLCD_SPI_N lcd(&spi_lcd, p8, p9, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // SPI native: SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032
+//TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C native: I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032 =Ok
+//TextLCD_I2C_N lcd(&i2c_lcd, SSD1803_SA1, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // I2C native: I2C bus, slaveaddress, LCDType=LCD20x4D, BL=NC, LCDTCtrl=SSD1803 =Ok
+ 
+int main() {   
+  Timer t;
 
-// I2C Expander MCP23008, Adafruit module (change #define !!)
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD16x3F); // I2C bus, MCP23008 Slaveaddress, LCD Type =Ok
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD20x4); // I2C bus, MCP23008 Slaveaddress, LCD Type =OK
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, MCP23008 Slaveaddress, LCD Type =Ok
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD24x4D, TextLCD::KS0078); // I2C bus, MCP23008 Slaveaddress, LCD Type =ok
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD16x1C); // I2C bus, MCP23008 Slaveaddress, LCD Type =Ok
-
-
-//SPI Expander
-//TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD8x2B); // SPI bus, CS pin, LCD Type =ok
-//TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD16x1C); // SPI bus, CS pin, LCD Type =ok 
-//TextLCD_SPI lcd2(&spi_lcd, p9, TextLCD::LCD16x2); // SPI bus, CS pin, LCD Type (VFD) =ok
-//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x2); // SPI bus, CS pin, LCD Type =ok
-//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, CS pin, LCD Type =ok
-//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4, TextLCD::HD44780); // SPI bus, CS pin, LCD Type, LCD Ctrl =ok
-//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD24x4D, TextLCD::KS0078); // SPI bus, CS pin, LCD Type =ok
+  pc.printf("TextLCD Enhanced Test. Columns=%d, Rows=%d\n\r", lcd.columns(), lcd.rows());
+    
+  for (int row=0; row<lcd.rows(); row++) {
+    int col=0;
+      
+    pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
+//    lcd.putc('-');
+    lcd.putc('0' + row);      
+      
+    for (col=1; col<lcd.columns()-1; col++) {    
+      lcd.putc('*');
+    }
+ 
+    pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
+    lcd.putc('+');       
+  }    
 
-
-//WS0010
-//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, LCD Ctrl           =Ok
-//TextLCD_SPI_N_3_10 lcd(&spi_lcd, p8, TextLCD::LCD16x2, NC, TextLCD::WS0010); // SPI bus, CS, LCDType=LCD16x2, BL=NC, LCDTCtrl=WS0010 =Ok
-
-//ST7032
-//TextLCD_SPI_N lcd(&spi_lcd, p8, p9, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032 =ok
-//TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032 =Ok
-
-//ST7036
-//TextLCD_I2C lcd(&i2c_lcd, MCP23008_SA0, TextLCD::LCD16x3G, TextLCD::ST7036_3V3); // I2C bus, MCP23008 Slaveaddress, LCD Type, LCDTCtrl=ST7036
-//TextLCD_SPI_N lcd(&spi_lcd, p8, p9, TextLCD::LCD16x3G, NC, TextLCD::ST7036_3V3); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7036 =Ok
+// Fill screen again and time it
+  t.start();
 
-//SSD1803A
-//TextLCD_I2C_N lcd(&i2c_lcd, SSD1803_SA1, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=SSD1803 =Ok
-TextLCD_SPI_N_3_24 lcd(&spi_lcd, p8, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // SPI bus, CS pin, LCDType=LCD20x4, BL=NC, LCDTCtrl=SSD1803 =Ok
-
-//Test PCF2113
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x2, NC, TextLCD::PCF2113_3V3); // I2C bus, slaveaddress, LCDType=LCD12x2, BL=NC, LCDTCtrl=PCF2113 
+  for (int row=0; row<lcd.rows(); row++) {
+    int col=0;
+      
+    lcd.putc('0' + row);      
+      
+    for (col=1; col<lcd.columns()-1; col++) {    
+      lcd.putc('*');
+    }
+ 
+    lcd.putc('+');       
+  }    
+  t.stop();    
+  pc.printf("All my hard work took %f sec\r\n", t.read());          
 
-//PCF2116
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x3D1, NC, TextLCD::PCF2116_5V); // I2C bus, slaveaddress, LCDType=LCD12x3D1, BL=NC, LCDTCtrl=PCF2116 (experimental)
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x3D1, NC, TextLCD::PCF2116_3V3); // I2C bus, slaveaddress, LCDType=LCD12x3D1, BL=NC, LCDTCtrl=PCF2116 
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA1, TextLCD::LCD12x3D1, NC, TextLCD::PCF2116_3V3); // I2C bus, slaveaddress, LCDType=LCD12x3D1, BL=NC, LCDTCtrl=PCF2116 
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD12x4D, NC, TextLCD::PCF2116_3V3); // I2C bus, slaveaddress, LCDType=LCD12x4D, BL=NC, LCDTCtrl=PCF2116 
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD24x1, NC, TextLCD::PCF2116_3V3); // I2C bus, slaveaddress, LCDType=LCD24x1, BL=NC, LCDTCtrl=PCF2116 
-//TextLCD_I2C_N lcd(&i2c_lcd, PCF21XX_SA0, TextLCD::LCD24x2, NC, TextLCD::PCF21116_3V3); // I2C bus, slaveaddress, LCDType=LCD24x2, BL=NC, LCDTCtrl=PCF2116 
-
-//AIP31068
-//TextLCD_I2C_N lcd(&i2c_lcd, AIP31068_SA, TextLCD::LCD16x2, NC, TextLCD::AIP31068); // I2C bus, slaveaddress, LCDType=LCD16x2, BL=NC, LCDTCtrl=AIP31068  =Ok
-//TextLCD_SPI_N_3_9 lcd(&spi_lcd, p8, TextLCD::LCD16x2, NC, TextLCD::AIP31068); // SPI bus, CS, LCDType=LCD16x2, BL=NC, LCDTCtrl=AIP31068                 Niet Ok   
+// Show cursor as blinking character
+   lcd.setCursor(TextLCD::CurOff_BlkOn);
+ 
+// Set and show user defined characters. A maximum of 8 UDCs are supported by the HD44780.
+// They are defined by a 5x7 bitpattern. 
+  lcd.setUDC(0, (char *) udc_0);  // Show |>
+  lcd.putc(0);    
+  lcd.setUDC(1, (char *) udc_1);  // Show <|
+  lcd.putc(1);    
+    
+  pc.printf("Bye now\r\n");          
+}
 
 
 
-int main() {
-  int i=0;
-  int count=0;
-  bool running=true;
-  char command;    
-    
-    pc.printf("LCD Test. Colums=%d, Rows=%d\n\r", lcd.columns(), lcd.rows());
-      
-//while (1) {
-    for (int row=0; row<lcd.rows(); row++) {
-      int col=0;
-      
-      pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
-//      lcd.putc('-');
-      lcd.putc('0' + row);      
-      
-      for (col=1; col<lcd.columns()-1; col++) {    
-        lcd.putc('*');
-      }
-
-      pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
-      lcd.putc('+');
-        
-    }    
-
-//   wait_ms(500);    
-//   lcd.cls();    // Test timing
-//}
-
-    lcd.setCursor(TextLCD::CurOff_BlkOn);
-
-#if(0)
-    lcd.setUDC(0, (char *) udc_AA);
-    lcd.putc(0);    
-    lcd.setUDC(1, (char *) udc_0E);
-    lcd.putc(1);    
-    lcd.setUDC(0, (char *) udc_0);
-    lcd.putc(0);    
-    lcd.setUDC(1, (char *) udc_1);
-    lcd.putc(1);    
-    lcd.setUDC(2, (char *) udc_2);
-    lcd.putc(2);    
-#endif
-
-#if(0)
-    lcd.setUDC(0, (char *) udc_None);    
-    lcd.setUDC(1, (char *) udc_None);    
-    lcd.setUDC(2, (char *) udc_None);    
-    lcd.setUDC(3, (char *) udc_None);    
-    lcd.setUDC(4, (char *) udc_None);    
-    lcd.setUDC(5, (char *) udc_None);    
-    lcd.setUDC(6, (char *) udc_None);    
-    lcd.setUDC(7, (char *) udc_None);                                
-#endif
-
-#if(0)
-    lcd.setUDC(0, (char *) udc_All);    
-    lcd.setUDC(1, (char *) udc_All);    
-    lcd.setUDC(2, (char *) udc_All);    
-    lcd.setUDC(3, (char *) udc_All);    
-    lcd.setUDC(4, (char *) udc_All);    
-    lcd.setUDC(5, (char *) udc_All);    
-    lcd.setUDC(6, (char *) udc_All);    
-    lcd.setUDC(7, (char *) udc_All);                                
-#endif
-
-#if(1)
-    lcd.setUDC(0, (char *) udc_Bat_Hi);
-    lcd.setUDC(1, (char *) udc_Bat_Ha);
-    lcd.setUDC(2, (char *) udc_Bat_Lo);
-    lcd.setUDC(3, (char *) udc_AC);
-    lcd.setUDC(4, (char *) udc_4);
-    lcd.setUDC(5, (char *) udc_5);
-    lcd.setUDC(6, (char *) udc_6);
-    lcd.setUDC(7, (char *) udc_7);
-#endif
-
-#if(0)
-    lcd.setUDC(0, (char *) udc_ch_1);
-    lcd.setUDC(1, (char *) udc_ch_2);
-    lcd.setUDC(2, (char *) udc_ch_3);
-    lcd.setUDC(3, (char *) udc_ch_4);
-    lcd.setUDC(4, (char *) udc_ch_yr);
-    lcd.setUDC(5, (char *) udc_ch_mo);
-    lcd.setUDC(6, (char *) udc_ch_dy);
-    lcd.setUDC(7, (char *) udc_ch_mi);
-#endif
-
-#if(0)
-    lcd.putc(0);    
-    lcd.putc(1);    
-    lcd.putc(2);    
-    lcd.putc(3);    
-    lcd.putc(4);    
-    lcd.putc(5);    
-    lcd.putc(6);    
-    lcd.putc(7);    
-#endif
-
-#if(0)
-    lcd2.setUDC(0, (char *) udc_Bat_Hi);
-    lcd2.setUDC(1, (char *) udc_Bat_Ha);
-    lcd2.setUDC(2, (char *) udc_Bat_Lo);
-    lcd2.setUDC(3, (char *) udc_AC);
-    lcd2.putc(0);    
-    lcd2.putc(1);    
-    lcd2.putc(2);    
-    lcd2.putc(3);    
-#endif    
-
-#if(0)    
-    while (1) {
-      lcd.locate(4, 2);      
-      lcd.printf("Count=%3d", i);      
-      i++;
-      if (i==100) i=0; 
-      
-      wait(1); 
-    }
-#endif    
-    
-    pc.printf("Hello World!\n\r");
-    show_menu();
-      
-    while(running) {     
-       count++;
-    
-       if(pc.readable()) {
-         command = pc.getc();       
-//         pc.printf("command= %c \n\r", command);         
-         pc.printf("\n\r");         
-         switch (command) {
-          case '0' :
-                     pc.printf("Done\n\r");                    
-                     running = false;  
-                     break;
-          
-          case '1' :
-                     show_menu();
-                     break;
-                    
-          case '2' :
-                     pc.printf("Goto 0,0\n\r"); 
-                     lcd.locate(0, 0);                           
-//                     lcd2.locate(0, 0);                                                
-                     break;
-          
-          case '3' :
-                     pc.printf("Goto Col,Row\n\r"); 
-                     lcd.locate( (lcd.columns() - 1), (lcd.rows() - 1));                           
-//                     lcd2.locate( (lcd.columns() - 1), (lcd.rows() - 1));                                                
-                     break;
-
-          case '4' :
-                     pc.printf("cls()\n\r");        
-                     lcd.cls();                           
-//                     lcd2.cls();                                                
-                     break;
-
-          case '5' :
-                     pc.printf("UDCs\n\r");                  
-                     lcd.locate(2, 0);      
-                     lcd.putc(0);    
-                     lcd.putc(1);                         
-                     lcd.putc(2);                         
-                     lcd.putc(3);    
-                     lcd.putc(4);                         
-                     lcd.putc(5);                         
-                     lcd.putc(6);    
-                     lcd.putc(7);                         
-                                          
-//                     lcd.locate(4, lcd.rows()-1);      
-//                     lcd.putc(0);    
-//                     lcd.putc(1);                         
-//                     lcd.putc(2);                         
-//                     lcd.putc(3);                                              
-
-
-//                     lcd2.locate(4, lcd.rows()-1);      
-//                     lcd2.putc(0);    
-//                     lcd2.putc(1);                         
-//                     lcd2.putc(2);                         
-//                     lcd2.putc(3);                                              
-         
-                     break;
-          case '6' :
-                     pc.printf("Fill\n\r");                            
-                     lcd.locate(0, 0);                
-                     for (int row=0; row<lcd.rows(); row++) {
-                       int col=0;
-      
-//                       pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
-                       //      lcd.putc('-');
-                       lcd.putc('0' + row);      
-      
-                       for (col=1; col<lcd.columns()-1; col++) {    
-                         lcd.putc('*');
-                       }
-
-//                       pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
-                       lcd.putc('+');
-                     }  
-          
-                     break;
-
-          case '7' :
-                     pc.printf("Cursor 0n\n\r");    
-                     lcd.setCursor(TextLCD::CurOff_BlkOn);                                             
-//                     lcd2.setCursor(TextLCD::CurOff_BlkOn);                                                       
-                     break;
-
-          case '8' :
-                     pc.printf("Cursor 0ff\n\r");    
-                     lcd.setCursor(TextLCD::CurOff_BlkOff);                                             
-//                     lcd2.setCursor(TextLCD::CurOff_BlkOff);                                                       
-                     break;
-
-          case '9' :
-                     pc.printf("Text\n\r");    
-                     lcd.locate(0, 0);                                                
-
-#if(1)
-//                               01234567890123456789
-                     lcd.printf("Hello mbed\n");
-                     lcd.printf(" SSD1803 Native I2C\n");                     
-                     lcd.printf(" LCD20x4D\n");    
-                     lcd.printf("TextLCD lib");                                                           
-#endif
-
-#if(0)
-                     lcd.printf("Hello mbed\n");
-                     lcd.printf("I2C Exp MCP23008");                     
-                     lcd.printf(" 16x3F (=24x2)\n");                                          
-//                     lcd.printf("  OLED I2C Exp\n");
-//                     lcd.printf("   Native I2C\n");                                                 
-//                     lcd2.printf("Hello mbed\n");                            
-#endif
-
-#if(0)  
-  // Needed for PCF2116C and PCF2116K
-                     lcd.putc('H' ^ 0x80);
-                     lcd.putc('e' ^ 0x80);
-                     lcd.putc('l' ^ 0x80);
-                     lcd.putc('l' ^ 0x80);
-                     lcd.putc('o' ^ 0x80);
-                     lcd.putc(' ' ^ 0x80);
-                     lcd.putc('m' ^ 0x80);
-                     lcd.putc('b' ^ 0x80);
-                     lcd.putc('e' ^ 0x80);
-                     lcd.putc('d' ^ 0x80);                      
-                     lcd.putc('\n');                      
-                     lcd.putc('I' ^ 0x80);
-                     lcd.putc('2' ^ 0x80);
-                     lcd.putc('C' ^ 0x80);
-                     lcd.putc(' ' ^ 0x80);
-                     lcd.putc('P' ^ 0x80);
-                     lcd.putc('C' ^ 0x80);
-                     lcd.putc('F' ^ 0x80);
-                     lcd.putc('2' ^ 0x80);                      
-                     lcd.putc('1' ^ 0x80);
-                     lcd.putc('1' ^ 0x80);
-                     lcd.putc('6' ^ 0x80);                     
-                     lcd.putc('\n');
-
-                     lcd.putc(' ' ^ 0x80);
-                     lcd.putc('(' ^ 0x80);                      
-                     lcd.putc('N' ^ 0x80);
-                     lcd.putc('o' ^ 0x80);
-                     lcd.putc(' ' ^ 0x80);
-                     lcd.putc('A' ^ 0x80);
-                     lcd.putc('c' ^ 0x80);
-                     lcd.putc('k' ^ 0x80);
-                     lcd.putc(')' ^ 0x80);
-                     lcd.putc(' ' ^ 0x80);
-                     lcd.putc(' ' ^ 0x80);                     
-#endif                                                   
-                     break;
-
-          case 'A' :
-                     pc.printf("Display On\n\r");   
-                     lcd.setMode(TextLCD::DispOn);                                 
-//                     lcd2.setMode(TextLCD::DispOn);                                                      
-                     break;
-
-          case 'B' :
-                     pc.printf("Display Off\n\r");                                 
-                     lcd.setMode(TextLCD::DispOff);                                                     
-//                     lcd2.setMode(TextLCD::DispOff);                                                                          
-                     break;
-
-          case 'C' :
-                     pc.printf("Backlight On\n\r");   
-                     lcd.setBacklight(TextLCD::LightOn);                                 
-//                     lcd2.setBacklight(TextLCD::LightOn);                                                      
-                     break;
-
-          case 'D' :
-                     pc.printf("Backlight Off\n\r");                                 
-                     lcd.setBacklight(TextLCD::LightOff);                                                     
-//                     lcd2.setBacklight(TextLCD::LightOff);                                                                          
-                     break;
-
-
-//          case 'E' :
-//                     pc.printf("Test nibble\n\r");                                 
-//                     for (int i=0; i<16; i++) {
-//                       lcd._writeNibble(i);
-//                       wait(1);
-//                     }
-//                     break;
-
-          case 'P' :
-                     pc.printf("Init Ctrl test\n\r");                                           
-//test
-//                    lcd._initCtrl();
-                    break;
-                    
-
-          case 'Q' :
-                     pc.printf("Contrast test\n\r");                                           
-                     for (i=0; i<64; i++) {
-                       lcd.setContrast(i);
-                       pc.printf("Contrast = %d\r", i);                                                                  
-                       wait(0.5);
-                     }  
-
-                    pc.printf("\n\rMax Contrast\n\r");
-                    wait(1);
-//                    lcd.setContrast(LCD_CONTRAST); //set default
-                    lcd.setContrast(); //set default                    
-                    pc.printf("\n\rContrast test done\n\r");                                           
-                                          
-                    break;
-                    
-          default :
-                    lcd.putc(command);          
-//                    lcd.putc(command ^ 0x80);   // Needed for PCF2116C and PCF2116K
-//                    lcd2.putc(command);                              
-                    break;
-
-                              
-        } //switch
-      }//if
-    }//while
-
-    pc.printf("Bye World!\n\r");      
-}
\ No newline at end of file