Erik van de Coevering
/
Opensmart_LCD_UC1701
Sample program for the UC1701 library, written for the mbed LPC1768
Diff: main.cpp
- Revision:
- 0:b43dc6434530
- Child:
- 2:9abdd1b8a82a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 18 21:14:09 2016 +0000 @@ -0,0 +1,45 @@ +// -- Example program for the UC1701 library - written for LPC1768 + +#include "mbed.h" +#include "UC1701.h" + +SPI lcd(p5, NC, p7); // mosi (PIN 9 on LCD), miso (nc), sclk (PIN 8 on LCD) +DigitalOut cs(p8); // chip select (active low) +DigitalOut cd(p10); // command/data (0=command, 1=data) PIN 10 on the LCD (named RS) + +UC1701 uc1701(lcd, cs, cd); // Create UC1701 instance + +int main() +{ + uc1701.init(); + wait(1); + uc1701.fill(); + wait(1); + uc1701.clear(); + wait(1); + char str[40]; + int n = 6; + n = sprintf(str, "01234ABCdefghijk"); + while(1) { + uc1701.drawBitmap(test); + wait(1); + uc1701.drawBitmap(einstein); + wait(1); + uc1701.drawBitmap(biohazard); + wait(1); + uc1701.drawBitmap(highvoltage); + wait(1); + uc1701.drawBitmap(copter); + wait(1); + uc1701.clear(); + uc1701.writeText(0,0, font_6x6, str, n); + uc1701.writeText(0,1, font_7x7, str, n); + uc1701.writeText(0,2, bold_font, str, n); + uc1701.writeText(0,3, font_5x8, str, n); + uc1701.writeText2d(0,4, font2d_hunter, str, n); + uc1701.writeText(0,5, font_8x8_1, str, n); + uc1701.writeText2d(0,6, font2d_formplex12, str, n); + uc1701.writeText(0,7, font_4x5, str, n); + wait(5); + } +}