Mac Lobdell / Mbed 2 deprecated testSerialDisplay

Dependencies:   mbed

Committer:
maclobdell
Date:
Thu Jan 07 20:06:36 2016 +0000
Revision:
0:7c02f96b0f96
Child:
1:3eabffe99403
initial;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maclobdell 0:7c02f96b0f96 1 #include "mbed.h"
maclobdell 0:7c02f96b0f96 2
maclobdell 0:7c02f96b0f96 3 int display(char* buffer);
maclobdell 0:7c02f96b0f96 4
maclobdell 0:7c02f96b0f96 5 DigitalOut myled(LED1);
maclobdell 0:7c02f96b0f96 6
maclobdell 0:7c02f96b0f96 7 Serial lcd(D1,D0);
maclobdell 0:7c02f96b0f96 8
maclobdell 0:7c02f96b0f96 9
maclobdell 0:7c02f96b0f96 10 int main() {
maclobdell 0:7c02f96b0f96 11
maclobdell 0:7c02f96b0f96 12 char buffer[32];
maclobdell 0:7c02f96b0f96 13
maclobdell 0:7c02f96b0f96 14 lcd.baud(9600); //default
maclobdell 0:7c02f96b0f96 15
maclobdell 0:7c02f96b0f96 16 /* LOLShield only handles upper case and doesn't handle ? */
maclobdell 0:7c02f96b0f96 17
maclobdell 0:7c02f96b0f96 18 // sprintf(buffer, " HOLA MUNDO, WHATS UP \n");
maclobdell 0:7c02f96b0f96 19
maclobdell 0:7c02f96b0f96 20 // lcd.printf(buffer);
maclobdell 0:7c02f96b0f96 21
maclobdell 0:7c02f96b0f96 22 /*test of spark fun serial display */
maclobdell 0:7c02f96b0f96 23
maclobdell 0:7c02f96b0f96 24 /* you can move the cursor dumb ass!!*/
maclobdell 0:7c02f96b0f96 25 /* https://www.sparkfun.com/tutorials/246 */
maclobdell 0:7c02f96b0f96 26
maclobdell 0:7c02f96b0f96 27 //turn on the display
maclobdell 0:7c02f96b0f96 28 //can I have a FET turn on the display power?
maclobdell 0:7c02f96b0f96 29
maclobdell 0:7c02f96b0f96 30 //turn off the splash screen
maclobdell 0:7c02f96b0f96 31 lcd.sendbyte(124); //send special character
maclobdell 0:7c02f96b0f96 32 lcd.sendbyte(9);// send special character to turn off splash screen
maclobdell 0:7c02f96b0f96 33
maclobdell 0:7c02f96b0f96 34 wait (0.5); //wait for display to boot up
maclobdell 0:7c02f96b0f96 35
maclobdell 0:7c02f96b0f96 36 //change cursor location
maclobdell 0:7c02f96b0f96 37 lcd.sendbyte(254); //send special character to change cursor location
maclobdell 0:7c02f96b0f96 38 lcd.sendbyte(128);// send special character to set cursor to beginning of first line
maclobdell 0:7c02f96b0f96 39
maclobdell 0:7c02f96b0f96 40 //display message
maclobdell 0:7c02f96b0f96 41 sprintf(buffer, " BYE FROM MAC \n");
maclobdell 0:7c02f96b0f96 42 lcd.printf(buffer);
maclobdell 0:7c02f96b0f96 43
maclobdell 0:7c02f96b0f96 44 lcd.sendbyte(124); //send special character to change cursor location
maclobdell 0:7c02f96b0f96 45 lcd.sendbyte(9);// send special character to change brightnes 128 - 157
maclobdell 0:7c02f96b0f96 46
maclobdell 0:7c02f96b0f96 47 lcd.sendbyte(254); //send special character to change cursor location
maclobdell 0:7c02f96b0f96 48 lcd.sendbyte(1);// send special character to clear display
maclobdell 0:7c02f96b0f96 49
maclobdell 0:7c02f96b0f96 50
maclobdell 0:7c02f96b0f96 51 while(1) {
maclobdell 0:7c02f96b0f96 52
maclobdell 0:7c02f96b0f96 53 myled = 1;
maclobdell 0:7c02f96b0f96 54 wait(0.5);
maclobdell 0:7c02f96b0f96 55 myled = 0;
maclobdell 0:7c02f96b0f96 56 wait(0.5);
maclobdell 0:7c02f96b0f96 57 }
maclobdell 0:7c02f96b0f96 58 }
maclobdell 0:7c02f96b0f96 59 /*
maclobdell 0:7c02f96b0f96 60 int display(char* buffer)
maclobdell 0:7c02f96b0f96 61 {
maclobdell 0:7c02f96b0f96 62 uint32_t i = 0;
maclobdell 0:7c02f96b0f96 63 for (i = 0; i<32; i++)
maclobdell 0:7c02f96b0f96 64 { lcd.printf(" ");
maclobdell 0:7c02f96b0f96 65 }
maclobdell 0:7c02f96b0f96 66 for (i = 0; i<32; i++)
maclobdell 0:7c02f96b0f96 67 { lcd.printf("\b");
maclobdell 0:7c02f96b0f96 68 }
maclobdell 0:7c02f96b0f96 69 for (i = 0; i<32; i++)
maclobdell 0:7c02f96b0f96 70 { lcd.printf("%s",buffer[i]);
maclobdell 0:7c02f96b0f96 71 }
maclobdell 0:7c02f96b0f96 72 }
maclobdell 0:7c02f96b0f96 73 */
maclobdell 0:7c02f96b0f96 74
maclobdell 0:7c02f96b0f96 75