1.44 tft lcd display

Dependencies:   TFT_fonts mbed-os

Fork of newTFTLCD by madhu sudhana

Revision:
29:35482446e4ee
Parent:
28:6ac2fa56f82c
--- a/main.cpp	Thu May 24 07:55:36 2018 +0000
+++ b/main.cpp	Thu Oct 04 05:11:28 2018 +0000
@@ -1,78 +1,104 @@
  #include "mbed.h"
  #include "st7735.h"
  #include "lcd_base.h"
+
   //#include "ili9328.h"
+  
+  
+
  
  #if   defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
-  PinName const p14 = PTE3;
-  PinName const p13 = PTE4;
-  PinName const p12 = PTB0;
-  PinName const p11 = PTE2;
-  PinName const p10 = PTE1;
+    PinName const CS= PTE3;
+  PinName const RST = PTE4;
+  PinName const DC = PTB0;
+  PinName const SCLK = PTE2;
+
+  PinName const MOSI = PTE1;
 #else
   #error TARGET NOT DEFINED
 #endif
-void ratation(int x);
+void rotation(int x);
 
   // LCD  hellow( NC ,NC,p14, p12, p13);
   
   // create the lcd instance
-  ST7735_LCD lcd( p14, p13, p12, p11, p10 ); // control pins
+  ST7735_LCD lcd( CS, RST, DC, SCLK, MOSI ); // control pins
  
   int main()
-  {  
-   while(1){
-lcd.Initialize();//Display initialization
-lcd.FillRect( 0, 0, 128, 128 );//fills the screen with zero "function does screen clearing
-lcd.DrawRect( 1, 1,128, 128);//co-ordinates(x1,y1,x2,y2)
+  {  /*int x1,x2,i,y1=0,y2;
+   
+lcd.Initialize();
+while(1)
+{
+ lcd.FillRect( 0, 0, 128, 128 );//Display initialization
+for( i=1;i<25;i++)
+    {y1=i*5;
+      y2=y1;
+lcd.DrawLine( 0, y1,127,y2);//changed to -2 by madhu
+  }wait_ms(3250);
+  lcd.FillRect( 0, 0, 128, 128 );//Display initialization
+  rotation(0);
+wait_ms( 2250 );
+wait_ms( 2250 );
+*/
+int MASS=100;
+ lcd.Print(MASS, 2, 90);
+while(1){}
+    }
+
+return 0;
+}
+//lcd.DrawRect( 1, 1,128, 128);//co-ordinates(x1,y1,x2,y2)
 //lcd.SetFont(); //function has to modify
-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 
-wait_ms( 5250 );//delay 5.250sec
-lcd.FillRect( 0, 0, 128, 128 );//again clear screen
-ratation(-1);//text invertion
-wait_ms( 5250 );//again delay
-lcd.FillRect( 0, 0, 128, 128 );//lear screen
-wait_ms( 5250 );
-lcd.DrawRoundRect( 25, 25, 100, 100);//colours can be changed from function in lcd_base.h file
- wait_ms( 1250 );
-lcd.FillRect( 0, 0, 128, 128 );
-lcd.DrawLine( 0,0, 128, 128);
-wait_ms( 5250 );
-lcd.FillRect( 0, 0, 128, 128 );
+//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 
+//wait_ms( 5250 );//delay 5.250sec
+//lcd.FillRect( 0, 0, 128, 128 );//again clear screen
+//ratation(-1);//text invertion
+//wait_ms( 5250 );//again delay
+//lcd.FillRect( 0, 0, 128, 128 );//lear screen
+//wait_ms( 5250 );
+//lcd.DrawRoundRect( 25, 25, 100, 100);//colours can be changed from function in lcd_base.h file
+ //wait_ms( 1250 );
+//lcd.FillRect( 0, 0, 128, 128 );//
+//lcd.DrawLine( 0,0, 128, 128);
+//wait_ms( 5250 );
+//lcd.FillRect( 0, 0, 128, 128 );
     //lcd.Sleep( );
-lcd.DrawCircle( 64, 64, 50);
-wait_ms( 5250 );
-lcd.FillRect( 0, 0, 128, 128 );
-lcd.FillCircle( 64, 64, 60,COLOR_RED );
-wait_ms( 5250 );  
-lcd.FillCircle( 64, 64, 50,COLOR_GREEN );
-lcd.FillCircle( 64, 64, 20,COLOR_YELLOW );
-wait_ms( 5250 ); 
-wait_ms( 5250 ); 
-     }
+//lcd.DrawCircle( 64, 64, 50);
+//wait_ms( 5250 );
+//lcd.FillRect( 0, 0, 128, 128 );
+//lcd.FillCircle( 64, 64, 60,COLOR_RED );
+//wait_ms( 5250 );  
+//lcd.FillCircle( 64, 64, 50,COLOR_GREEN );
+//lcd.FillCircle( 64, 64, 20,COLOR_YELLOW );/
+
+//wait_ms( 5250 ); 
+//wait_ms( 5250 ); 
+ //    }
    
-  }
+  //}
  
  
- void ratation(int x)
+void rotation(int x)
  {   
     if (x==90)
-    { lcd.Print( "READINGS ARE", 5, 5 );//vallue of deg in print function in lcd_base.h file be 0
+    { lcd.Print( "READINGS ARE ", 5, 5 );//vallue of deg in print function in lcd_base.h file be 0
       lcd.Print( "B SUGAR=80mg/dl", 2, 90);
-      lcd.Print( "ECG=75", 30, 30);
+      lcd.Print( "ECG=75", 30, 30);//30,30
       lcd.Print( "BP=120/80", 30,60); 
       }
+      
      
       else if(x==180)
       {
       lcd.Printinv( "  READINGS ARE", 123, 110 );//vallue of deg in printinv function in lcd_base.h file be 180
-       lcd.Printinv( "BP=120/80", 123,15);
+    lcd.Printinv( "BP=120/80", 123,15);
       lcd.Printinv( "ECG=75", 123, 40);
       lcd.Printinv( "B SUGAR=80mg/dl", 126, 75);
       }
       else if(x==-1)
       {
-      lcd.Printinv( "  READINGS ARE", 120, 5);//vallue of deg in printinv function in lcd_base.h file be 90
+      lcd.Printinv( "  READINGS ARE ", 120, 5);//vallue of deg in printinv function in lcd_base.h file be 90
        lcd.Printinv( "BP=120/80", 95,15);
       lcd.Printinv( "ECG=75", 70,15);
       lcd.Printinv( "B SUGAR=80mg/dl", 40,5);
@@ -80,7 +106,7 @@
      
      else if (x==0)
     { 
-      lcd.Print( "READINGS ARE", 25, 110 );//vallue of deg in print function in lcd_base.h file be 270
+      lcd.Print( "READINGS ARE \n hello madhu ", 25, 110 );//vallue of deg in print function in lcd_base.h file be 270
       lcd.Print( "B SUGAR=80mg/dl", 110, 120);
       lcd.Print( "ECG=75", 85, 100);
       lcd.Print( "BP=120/80", 60,100); 
@@ -89,4 +115,5 @@
       {
           lcd.Print( "ERROR", 0,0 );
     }
-    }      
\ No newline at end of file
+    }
+          
\ No newline at end of file