Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TFT_fonts mbed-os
Fork of newTFTLCD by
main.cpp
00001 #include "mbed.h" 00002 #include "st7735.h" 00003 #include "lcd_base.h" 00004 00005 //#include "ili9328.h" 00006 00007 00008 00009 00010 #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) 00011 PinName const CS= PTE3; 00012 PinName const RST = PTE4; 00013 PinName const DC = PTB0; 00014 PinName const SCLK = PTE2; 00015 00016 PinName const MOSI = PTE1; 00017 #else 00018 #error TARGET NOT DEFINED 00019 #endif 00020 void rotation(int x); 00021 00022 // LCD hellow( NC ,NC,p14, p12, p13); 00023 00024 // create the lcd instance 00025 ST7735_LCD lcd( CS, RST, DC, SCLK, MOSI ); // control pins 00026 00027 int main() 00028 { /*int x1,x2,i,y1=0,y2; 00029 00030 lcd.Initialize(); 00031 while(1) 00032 { 00033 lcd.FillRect( 0, 0, 128, 128 );//Display initialization 00034 for( i=1;i<25;i++) 00035 {y1=i*5; 00036 y2=y1; 00037 lcd.DrawLine( 0, y1,127,y2);//changed to -2 by madhu 00038 }wait_ms(3250); 00039 lcd.FillRect( 0, 0, 128, 128 );//Display initialization 00040 rotation(0); 00041 wait_ms( 2250 ); 00042 wait_ms( 2250 ); 00043 */ 00044 int MASS=100; 00045 lcd.Print(MASS, 2, 90); 00046 while(1){} 00047 } 00048 00049 return 0; 00050 } 00051 //lcd.DrawRect( 1, 1,128, 128);//co-ordinates(x1,y1,x2,y2) 00052 //lcd.SetFont(); //function has to modify 00053 //ratation(0);//text withought any rotation and here we can write any text with no rotation and with colour but there is limit to display character 00054 //wait_ms( 5250 );//delay 5.250sec 00055 //lcd.FillRect( 0, 0, 128, 128 );//again clear screen 00056 //ratation(-1);//text invertion 00057 //wait_ms( 5250 );//again delay 00058 //lcd.FillRect( 0, 0, 128, 128 );//lear screen 00059 //wait_ms( 5250 ); 00060 //lcd.DrawRoundRect( 25, 25, 100, 100);//colours can be changed from function in lcd_base.h file 00061 //wait_ms( 1250 ); 00062 //lcd.FillRect( 0, 0, 128, 128 );// 00063 //lcd.DrawLine( 0,0, 128, 128); 00064 //wait_ms( 5250 ); 00065 //lcd.FillRect( 0, 0, 128, 128 ); 00066 //lcd.Sleep( ); 00067 //lcd.DrawCircle( 64, 64, 50); 00068 //wait_ms( 5250 ); 00069 //lcd.FillRect( 0, 0, 128, 128 ); 00070 //lcd.FillCircle( 64, 64, 60,COLOR_RED ); 00071 //wait_ms( 5250 ); 00072 //lcd.FillCircle( 64, 64, 50,COLOR_GREEN ); 00073 //lcd.FillCircle( 64, 64, 20,COLOR_YELLOW );/ 00074 00075 //wait_ms( 5250 ); 00076 //wait_ms( 5250 ); 00077 // } 00078 00079 //} 00080 00081 00082 void rotation(int x) 00083 { 00084 if (x==90) 00085 { lcd.Print( "READINGS ARE ", 5, 5 );//vallue of deg in print function in lcd_base.h file be 0 00086 lcd.Print( "B SUGAR=80mg/dl", 2, 90); 00087 lcd.Print( "ECG=75", 30, 30);//30,30 00088 lcd.Print( "BP=120/80", 30,60); 00089 } 00090 00091 00092 else if(x==180) 00093 { 00094 lcd.Printinv( " READINGS ARE", 123, 110 );//vallue of deg in printinv function in lcd_base.h file be 180 00095 lcd.Printinv( "BP=120/80", 123,15); 00096 lcd.Printinv( "ECG=75", 123, 40); 00097 lcd.Printinv( "B SUGAR=80mg/dl", 126, 75); 00098 } 00099 else if(x==-1) 00100 { 00101 lcd.Printinv( " READINGS ARE ", 120, 5);//vallue of deg in printinv function in lcd_base.h file be 90 00102 lcd.Printinv( "BP=120/80", 95,15); 00103 lcd.Printinv( "ECG=75", 70,15); 00104 lcd.Printinv( "B SUGAR=80mg/dl", 40,5); 00105 } 00106 00107 else if (x==0) 00108 { 00109 lcd.Print( "READINGS ARE \n hello madhu ", 25, 110 );//vallue of deg in print function in lcd_base.h file be 270 00110 lcd.Print( "B SUGAR=80mg/dl", 110, 120); 00111 lcd.Print( "ECG=75", 85, 100); 00112 lcd.Print( "BP=120/80", 60,100); 00113 } 00114 else 00115 { 00116 lcd.Print( "ERROR", 0,0 ); 00117 } 00118 } 00119
Generated on Tue Jul 12 2022 16:01:48 by
