Demo code and library for teh SSD0139 screen on an arduino header For Oxford University Engineering Coursework Module
Dependencies: LCDTFT_ssd0139 mbed
main.cpp
- Committer:
- cstevens
- Date:
- 2014-09-02
- Revision:
- 0:92feefa9d5ba
- Child:
- 1:e783e326d127
File content as of revision 0:92feefa9d5ba:
#include "mbed.h" #include "LCDTFT.h" //BusOut MyBus(p13,p14,p15,p16,p17,p18,p19,p20,p30,p29,p28,p27,p26,p25,p24,p23); BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9); LCDTFT MyLCD(PTB0,PTB1,PTB2,PTB3,PTC2,&MyBus);//LCDTFT(PinName PIN_RD,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusOut *BUSLCD); int main(){ while(1){ //landscape ? MyLCD.vLCDTFTInit(1); MyLCD.vLCDTFTFillScreen(ColorBlack); MyLCD.vLCDTFTRectangle(3,3,319,157,0,ColorWhite); wait(1); MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorLime,ColorBlack); MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorCian,ColorBlack); MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); wait(5); //portrait MyLCD.vLCDTFTInit(0); wait(1); MyLCD.vLCDTFTFillScreen(ColorWhite); wait(2); short int x,y; y=250; for(x=0;x<240;x++){ MyLCD.vLCDTFTPoint(x,y,ColorGreen); wait_ms(1); } //endfor // red square for(x=100;x<140;x++){ for(y=100;y<140;y++){ MyLCD.vLCDTFTPoint(x,y,ColorRed); }//endfor } // endfor x=40; for(y=0;y<320;y++){ MyLCD.vLCDTFTPoint(x,y,ColorBlue); wait_ms(1); } //endfor y=40; for(x=0;x<240;x++){ MyLCD.vLCDTFTPoint(x,y,ColorBlue); wait_ms(1); } //endfor MyLCD.vLCDTFTLine(0,0,239,319,ColorPurple); wait(1); MyLCD.vLCDTFTRectangle(50,200,150,300,0,ColorNaranja); MyLCD.vLCDTFTRectangle(55,205,145,295,1,ColorYellow); MyLCD.vLCDTFTSetParametersPrintf(5,155,5,239,2,ColorBlue,ColorWhite); MyLCD.printf("Hello mbed!!!"); wait(3); MyLCD.vLCDTFTFillScreen(ColorBlack); MyLCD.vLCDTFTRectangle(3,3,236,157,0,ColorWhite); MyLCD.vLCDTFTRectangle(4,4,235,156,0,ColorWhite); wait(1); MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorLime,ColorBlack); MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorCian,ColorBlack); MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); MyLCD.vLCDTFTSetParametersPrintf(30,200,30,233,2,ColorRed,ColorBlack); MyLCD.printf("Countdown\n"); int a=0; for(a=10;a>0;a--){ MyLCD.vLCDTFTSetParametersPrintf(30,260,30,233,2,ColorRed,ColorBlack); MyLCD.printf("%d ",a); wait(1); } // endfor //landscape ? MyLCD.vLCDTFTInit(1); MyLCD.vLCDTFTFillScreen(ColorWhite); MyLCD.vLCDTFTFillScreen(ColorWhite); MyLCD.vLCDTFTRectangle(3,3,315,157,0,ColorNavy); wait(1); MyLCD.vLCDTFTSetParametersPrintf(8,8,8,155,3,ColorGreen,ColorWhite); MyLCD.printf("PPO2:\n 1.21\n 1.18\n 1.20"); MyLCD.vLCDTFTSetParametersPrintf(110,8,110,233,3,ColorBlue,ColorWhite); MyLCD.printf("fO2 %%:\n 27.3\n 26.5\n 27.1"); wait(5); for(a=0;a<320;a++){ MyLCD.vLCDTFTPoint(a,180,ColorBlue); } }// endwhile } //endmain