a

Dependencies:   mbed 4DGL-uLCD-SE

Committer:
apaks180
Date:
Fri Mar 29 16:07:20 2019 +0000
Revision:
10:e8c9dbbcb397
Parent:
8:31e63caf37e2
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 8:31e63caf37e2 1 // uLCD-144-G2 demo program for uLCD-4GL LCD driver library
4180_1 0:cfcf73272647 2 //
4180_1 0:cfcf73272647 3 #include "mbed.h"
4180_1 2:75727e89a717 4 #include "uLCD_4DGL.h"
4180_1 0:cfcf73272647 5
4180_1 2:75727e89a717 6 uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin;
apaks180 10:e8c9dbbcb397 7 Serial pc(USBTX, USBRX);
4180_1 2:75727e89a717 8 int main()
4180_1 2:75727e89a717 9 {
4180_1 3:454d1f4c8fd7 10 // basic printf demo = 16 by 18 characters on screen
4180_1 3:454d1f4c8fd7 11 uLCD.printf("\nHello uLCD World\n"); //Default Green on black text
4180_1 3:454d1f4c8fd7 12 uLCD.printf("\n Starting Demo...");
4180_1 3:454d1f4c8fd7 13 uLCD.text_width(4); //4X size text
4180_1 3:454d1f4c8fd7 14 uLCD.text_height(4);
4180_1 3:454d1f4c8fd7 15 uLCD.color(RED);
4180_1 3:454d1f4c8fd7 16 for (int i=10; i>=0; --i) {
4180_1 3:454d1f4c8fd7 17 uLCD.locate(1,2);
4180_1 3:454d1f4c8fd7 18 uLCD.printf("%2D",i);
4180_1 3:454d1f4c8fd7 19 wait(.5);
4180_1 3:454d1f4c8fd7 20 }
4180_1 3:454d1f4c8fd7 21 uLCD.cls();
4180_1 8:31e63caf37e2 22 uLCD.printf("Change baudrate......");
4180_1 8:31e63caf37e2 23 uLCD.baudrate(3000000); //jack up baud rate to max for fast display
4180_1 6:f752accd632c 24 //if demo hangs here - try lower baud rates
4180_1 8:31e63caf37e2 25 //
4180_1 7:7bd7397ab89f 26 // printf text only full screen mode demo
4180_1 7:7bd7397ab89f 27 uLCD.background_color(BLUE);
4180_1 7:7bd7397ab89f 28 uLCD.cls();
4180_1 7:7bd7397ab89f 29 uLCD.locate(0,0);
4180_1 7:7bd7397ab89f 30 uLCD.color(WHITE);
4180_1 7:7bd7397ab89f 31 uLCD.textbackground_color(BLUE);
4180_1 7:7bd7397ab89f 32 uLCD.set_font(FONT_7X8);
4180_1 7:7bd7397ab89f 33 uLCD.text_mode(OPAQUE);
4180_1 7:7bd7397ab89f 34 int i=0;
4180_1 7:7bd7397ab89f 35 while(i<64) {
4180_1 7:7bd7397ab89f 36 if(i%16==0) uLCD.cls();
4180_1 7:7bd7397ab89f 37 uLCD.printf("TxtLine %2D Page %D\n",i%16,i/16 );
4180_1 7:7bd7397ab89f 38 i++; //16 lines with 18 charaters per line
4180_1 7:7bd7397ab89f 39 }
4180_1 7:7bd7397ab89f 40 wait(0.5);
4180_1 6:f752accd632c 41 //demo graphics commands
4180_1 7:7bd7397ab89f 42 uLCD.background_color(BLACK);
4180_1 7:7bd7397ab89f 43 uLCD.cls();
4180_1 2:75727e89a717 44 uLCD.background_color(DGREY);
4180_1 8:31e63caf37e2 45 uLCD.filled_circle(60, 50, 30, 0xFF00FF);
4180_1 2:75727e89a717 46 uLCD.triangle(120, 100, 40, 40, 10, 100, 0x0000FF);
4180_1 2:75727e89a717 47 uLCD.line(0, 0, 80, 60, 0xFF0000);
4180_1 8:31e63caf37e2 48 uLCD.filled_rectangle(50, 50, 100, 90, 0x00FF00);
4180_1 2:75727e89a717 49 uLCD.pixel(60, 60, BLACK);
4180_1 2:75727e89a717 50 uLCD.read_pixel(120, 70);
4180_1 2:75727e89a717 51 uLCD.circle(120, 60, 10, BLACK);
4180_1 3:454d1f4c8fd7 52 uLCD.set_font(FONT_7X8);
4180_1 2:75727e89a717 53 uLCD.text_mode(TRANSPARENT);
4180_1 6:f752accd632c 54 uLCD.text_bold(ON);
4180_1 2:75727e89a717 55 uLCD.text_char('B', 9, 8, BLACK);
4180_1 2:75727e89a717 56 uLCD.text_char('I',10, 8, BLACK);
4180_1 2:75727e89a717 57 uLCD.text_char('G',11, 8, BLACK);
4180_1 6:f752accd632c 58 uLCD.text_italic(ON);
4180_1 3:454d1f4c8fd7 59 uLCD.text_string("This is a test of string", 1, 4, FONT_7X8, WHITE);
4180_1 3:454d1f4c8fd7 60 wait(2);
4180_1 6:f752accd632c 61 }
4180_1 7:7bd7397ab89f 62
4180_1 7:7bd7397ab89f 63
4180_1 8:31e63caf37e2 64