Mac Lobdell / Mbed 2 deprecated testSerialDisplay

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 #define LOLSHIELDSERIALDISPLAY 0
00004 #define SFSERIALDISPLAY  1
00005 
00006 int display(char* buffer);
00007 
00008 DigitalOut myled(LED1);
00009 
00010 Serial lcd(D1,D0);
00011 
00012 
00013 int main() {
00014     
00015     char buffer[32];
00016    
00017     lcd.baud(9600);  //default
00018 
00019 #if LOLSHIELDSERIALDISPLAY
00020    /* Serial Interface to Arduino R3 w/ firmware to drive LOLShield*/
00021    /* LOLShield library only handles upper case and doesn't handle ? */
00022 
00023     sprintf(buffer, " HOLA MUNDO, WHATS UP      \n");
00024     
00025     lcd.printf(buffer);
00026 #endif
00027 
00028 #if SFSERIALDISPLAY
00029 
00030 /*test of spark fun serial display */
00031 
00032 /* you can move the cursor!*/
00033 /* https://www.sparkfun.com/tutorials/246 */
00034 
00035    //turn on the display
00036    //can I have a FET turn on the display power?
00037    
00038    //turn off the splash screen
00039    lcd.sendbyte(124); //send special character
00040    lcd.sendbyte(9);// send special character to turn off splash screen
00041 
00042     wait (0.5);  //wait for display to boot up
00043    
00044    //change cursor location
00045    lcd.sendbyte(254); //send special character to change cursor location 
00046    lcd.sendbyte(128);// send special character to set cursor to beginning of first line
00047  
00048    //display message
00049    sprintf(buffer, " BYE FROM MAC      \n");
00050    lcd.printf(buffer);
00051 
00052    lcd.sendbyte(124); //send special character to change cursor location 
00053    lcd.sendbyte(9);// send special character to change brightnes 128 - 157
00054 
00055    lcd.sendbyte(254); //send special character to change cursor location 
00056    lcd.sendbyte(1);// send special character to clear display
00057 #endif
00058 
00059     while(1) {
00060         
00061         myled = 1;
00062         wait(0.5);
00063         myled = 0;
00064         wait(0.5); 
00065     }
00066 }
00067 /*
00068 int display(char* buffer)
00069 {
00070         uint32_t i = 0;
00071         for (i = 0; i<32; i++)
00072         {    lcd.printf(" ");
00073         }
00074         for (i = 0; i<32; i++)
00075         {    lcd.printf("\b");
00076         }
00077         for (i = 0; i<32; i++)
00078         {    lcd.printf("%s",buffer[i]);
00079         }
00080 }
00081 */      
00082         
00083