1.44 tft lcd display

Dependencies:   TFT_fonts mbed-os

Fork of newTFTLCD by madhu sudhana

main.cpp

Committer:
madhusudhana
Date:
2018-10-04
Revision:
29:35482446e4ee
Parent:
28:6ac2fa56f82c

File content as of revision 29:35482446e4ee:

 #include "mbed.h"
 #include "st7735.h"
 #include "lcd_base.h"

  //#include "ili9328.h"
  
  

 
 #if   defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
    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 rotation(int x);

  // LCD  hellow( NC ,NC,p14, p12, p13);
  
  // create the lcd instance
  ST7735_LCD lcd( CS, RST, DC, SCLK, MOSI ); // control pins
 
  int main()
  {  /*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 );
    //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 ); 
 //    }
   
  //}
 
 
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( "B SUGAR=80mg/dl", 2, 90);
      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( "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( "BP=120/80", 95,15);
      lcd.Printinv( "ECG=75", 70,15);
      lcd.Printinv( "B SUGAR=80mg/dl", 40,5);
      }
     
     else if (x==0)
    { 
      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); 
      }
      else
      {
          lcd.Print( "ERROR", 0,0 );
    }
    }