a
Dependencies: mbed 4DGL-uLCD-SE
main.cpp
- Committer:
- apaks180
- Date:
- 2019-03-29
- Revision:
- 10:e8c9dbbcb397
- Parent:
- 8:31e63caf37e2
File content as of revision 10:e8c9dbbcb397:
// uLCD-144-G2 demo program for uLCD-4GL LCD driver library // #include "mbed.h" #include "uLCD_4DGL.h" uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin; Serial pc(USBTX, USBRX); int main() { // basic printf demo = 16 by 18 characters on screen uLCD.printf("\nHello uLCD World\n"); //Default Green on black text uLCD.printf("\n Starting Demo..."); uLCD.text_width(4); //4X size text uLCD.text_height(4); uLCD.color(RED); for (int i=10; i>=0; --i) { uLCD.locate(1,2); uLCD.printf("%2D",i); wait(.5); } uLCD.cls(); uLCD.printf("Change baudrate......"); uLCD.baudrate(3000000); //jack up baud rate to max for fast display //if demo hangs here - try lower baud rates // // printf text only full screen mode demo uLCD.background_color(BLUE); uLCD.cls(); uLCD.locate(0,0); uLCD.color(WHITE); uLCD.textbackground_color(BLUE); uLCD.set_font(FONT_7X8); uLCD.text_mode(OPAQUE); int i=0; while(i<64) { if(i%16==0) uLCD.cls(); uLCD.printf("TxtLine %2D Page %D\n",i%16,i/16 ); i++; //16 lines with 18 charaters per line } wait(0.5); //demo graphics commands uLCD.background_color(BLACK); uLCD.cls(); uLCD.background_color(DGREY); uLCD.filled_circle(60, 50, 30, 0xFF00FF); uLCD.triangle(120, 100, 40, 40, 10, 100, 0x0000FF); uLCD.line(0, 0, 80, 60, 0xFF0000); uLCD.filled_rectangle(50, 50, 100, 90, 0x00FF00); uLCD.pixel(60, 60, BLACK); uLCD.read_pixel(120, 70); uLCD.circle(120, 60, 10, BLACK); uLCD.set_font(FONT_7X8); uLCD.text_mode(TRANSPARENT); uLCD.text_bold(ON); uLCD.text_char('B', 9, 8, BLACK); uLCD.text_char('I',10, 8, BLACK); uLCD.text_char('G',11, 8, BLACK); uLCD.text_italic(ON); uLCD.text_string("This is a test of string", 1, 4, FONT_7X8, WHITE); wait(2); }