![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
uLCD_test
Dependencies: 4DGL-uLCD-SE mbed
Fork of uLCD_test by
main.cpp@0:53bbc6d1d4de, 2017-08-26 (annotated)
- Committer:
- jacksugar
- Date:
- Sat Aug 26 23:35:29 2017 +0000
- Revision:
- 0:53bbc6d1d4de
Version_0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jacksugar | 0:53bbc6d1d4de | 1 | // Demo for the uLCD-144-G2 based on the work by Jim Hamblen |
jacksugar | 0:53bbc6d1d4de | 2 | |
jacksugar | 0:53bbc6d1d4de | 3 | #include "mbed.h" |
jacksugar | 0:53bbc6d1d4de | 4 | #include "uLCD_4DGL.h" |
jacksugar | 0:53bbc6d1d4de | 5 | |
jacksugar | 0:53bbc6d1d4de | 6 | uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin; |
jacksugar | 0:53bbc6d1d4de | 7 | |
jacksugar | 0:53bbc6d1d4de | 8 | int main() |
jacksugar | 0:53bbc6d1d4de | 9 | { |
jacksugar | 0:53bbc6d1d4de | 10 | // basic printf demo = 16 by 18 characters on screen |
jacksugar | 0:53bbc6d1d4de | 11 | uLCD.printf("\nHello uLCD World\n"); //Default Green on black text |
jacksugar | 0:53bbc6d1d4de | 12 | uLCD.printf("\n Starting Demo..."); |
jacksugar | 0:53bbc6d1d4de | 13 | uLCD.text_width(4); //4X size text |
jacksugar | 0:53bbc6d1d4de | 14 | uLCD.text_height(4); |
jacksugar | 0:53bbc6d1d4de | 15 | uLCD.color(RED); |
jacksugar | 0:53bbc6d1d4de | 16 | for (int i=5; i>=0; --i) { |
jacksugar | 0:53bbc6d1d4de | 17 | uLCD.locate(1,2); |
jacksugar | 0:53bbc6d1d4de | 18 | uLCD.printf("%2D",i); |
jacksugar | 0:53bbc6d1d4de | 19 | wait(.5); |
jacksugar | 0:53bbc6d1d4de | 20 | } |
jacksugar | 0:53bbc6d1d4de | 21 | uLCD.cls(); |
jacksugar | 0:53bbc6d1d4de | 22 | uLCD.printf("Change baudrate......"); |
jacksugar | 0:53bbc6d1d4de | 23 | uLCD.baudrate(9600); //jack up baud rate to max for fast display |
jacksugar | 0:53bbc6d1d4de | 24 | //if demo hangs here - try lower baud rates |
jacksugar | 0:53bbc6d1d4de | 25 | |
jacksugar | 0:53bbc6d1d4de | 26 | wait(0.5); |
jacksugar | 0:53bbc6d1d4de | 27 | //demo graphics commands |
jacksugar | 0:53bbc6d1d4de | 28 | uLCD.background_color(BLACK); |
jacksugar | 0:53bbc6d1d4de | 29 | uLCD.cls(); |
jacksugar | 0:53bbc6d1d4de | 30 | uLCD.background_color(DGREY); |
jacksugar | 0:53bbc6d1d4de | 31 | uLCD.filled_circle(60, 50, 30, 0xFF00FF); |
jacksugar | 0:53bbc6d1d4de | 32 | uLCD.triangle(120, 100, 40, 40, 10, 100, 0x0000FF); |
jacksugar | 0:53bbc6d1d4de | 33 | uLCD.line(0, 0, 80, 60, 0xFF0000); |
jacksugar | 0:53bbc6d1d4de | 34 | uLCD.filled_rectangle(50, 50, 100, 90, 0x00FF00); |
jacksugar | 0:53bbc6d1d4de | 35 | uLCD.pixel(60, 60, BLACK); |
jacksugar | 0:53bbc6d1d4de | 36 | uLCD.read_pixel(120, 70); |
jacksugar | 0:53bbc6d1d4de | 37 | uLCD.circle(120, 60, 10, BLACK); |
jacksugar | 0:53bbc6d1d4de | 38 | uLCD.set_font(FONT_7X8); |
jacksugar | 0:53bbc6d1d4de | 39 | uLCD.text_italic(ON); |
jacksugar | 0:53bbc6d1d4de | 40 | uLCD.text_mode(TRANSPARENT); |
jacksugar | 0:53bbc6d1d4de | 41 | uLCD.text_string("This", 1, 4, FONT_7X8, WHITE); |
jacksugar | 0:53bbc6d1d4de | 42 | wait(.5); |
jacksugar | 0:53bbc6d1d4de | 43 | uLCD.text_italic(ON); |
jacksugar | 0:53bbc6d1d4de | 44 | uLCD.text_string("STUFF", 8, 8, FONT_7X8, BLACK); |
jacksugar | 0:53bbc6d1d4de | 45 | wait(.5); |
jacksugar | 0:53bbc6d1d4de | 46 | // uLCD.text_width(2); //4X size text |
jacksugar | 0:53bbc6d1d4de | 47 | // uLCD.text_height(2); |
jacksugar | 0:53bbc6d1d4de | 48 | uLCD.text_string("ROCKS", 5, 13, FONT_7X8, RED); |
jacksugar | 0:53bbc6d1d4de | 49 | wait(200); |
jacksugar | 0:53bbc6d1d4de | 50 | } |