Помогите с ili9328

Нет ответов
James
Offline
Зарегистрирован: 26.02.2016

есть Arduino 2.4 tft на ili9328 и mega 2560. Вот такой код. При изменении значений и их отрисовки экран мигает. как избавиться?

#define TOUCH_ORIENTATION  PORTRAIT
#define USE_UTOUCH         0

#if !(USE_UTOUCH)
#define TITLE "TouchScreen.h Calibration"
#include <Adafruit_GFX.h>
#include <UTFTGLUE.h>            //we are using UTFT display methods
UTFTGLUE myGLCD(0x9328, A2, A1, A3, A4, A0);


// MCUFRIEND UNO shield shares pins with the TFT.   Due does NOT work
#define YP A3   //A3 for ILI9320
#define YM 9   //9
#define XM A2
#define XP 8    //8  



#else
#define TITLE "UTouch.h Calibration"
#include <SPI.h>
#include <UTFT.h>



#endif

// ************************************
// DO NOT EDIT ANYTHING BELOW THIS LINE
// ************************************

// Declare which fonts we will be using
//extern uint8_t SmallFont[];

uint32_t cx, cy;
uint32_t rx[8], ry[8];
int32_t clx, crx, cty, cby;
float px, py;
int dispx, dispy, text_y_center, swapxy;
uint32_t calx, caly, cals;
char buf[13];


void setup()
{

  Serial.begin(9600);
  digitalWrite(A0, HIGH);
  pinMode(A0, OUTPUT);
  myGLCD.InitLCD(TOUCH_ORIENTATION);


  myGLCD.setRotation(LANDSCAPE);
  myGLCD.setFont(BigFont);
  myGLCD.clrScr();
}




void loop()
{
  int val = analogRead(A15);
  int val1 = analogRead(A14);
  val = map(val, 0, 1023, 0, 319);
  val1 = map(val1, 0, 1023, 0, 319);




  myGLCD.setColor(25, 25, 255);
  myGLCD.setBackColor(25, 25, 255);
  myGLCD.fillRect( 0, 0, val, 15); //  //(x1,y1,x2,y2)
  myGLCD.fillRect( 0, 15, val, 30);
  myGLCD.fillRect( 0, 30, val, 45);
  myGLCD.fillRect( 0, 45, val, 60);
  
  myGLCD.setColor(0, 0, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.fillRect( 319, 0, val, 15);
  myGLCD.fillRect( 319, 15, val, 30);
  myGLCD.fillRect( 319, 30, val, 45);
  myGLCD.fillRect( 319, 45, val, 60);


  myGLCD.setColor(25, 25, 255);
  myGLCD.setBackColor(25, 25, 255);
  myGLCD.fillRect( 0, 210, val1, 239 ); //  //(x1,y1,x2,y2)
  myGLCD.fillRect( 0, 180, val1, 210 );
  myGLCD.fillRect( 0, 150, val1, 180 );
  myGLCD.fillRect( 0, 120, val1, 150);
  myGLCD.setColor(0, 0, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.fillRect( 319, 210, val1, 239);
  myGLCD.fillRect( 319, 180, val1, 210);
  myGLCD.fillRect( 319, 150, val1, 180);
  myGLCD.fillRect( 319, 120, val1, 150);


}