MCUFRIEND library quirk?


i have tiny program included prints hello world screen , gets touch screen point. later send point x & y serial monitor. code below works fine when un-comment line  //p = ts.getpoint(); screen blanks out.

why getting touch screen point blank screen? 

code: [select]
#include <touchscreen.h>
#include <mcufriend_kbv.h>

#define yp a2  // must analog pin, use "an" notation!
#define xm a3  // must analog pin, use "an" notation!
#define ym 8   // can digital pin
#define xp 9   // can digital pin

mcufriend_kbv tft;
touchscreen ts = touchscreen(xp, yp, xm, ym, 300);
tspoint p;

void setup()
{
  serial.begin(9600);
  tft.begin();
  tft.setrotation(135);
  tft.fillscreen(0x0000);
  tft.settextcolor(0xfe00, 0x0000);
  tft.settextsize(2);
}

void loop()
{
  tft.setcursor(10, 10);
  tft.print("hello world");
  //p = ts.getpoint();
}

the touch pins shared tft controller.
the touchscreen library calls leave yp, xm in analog (input) mode.  ym, xp left in digital (output) mode.

always restore yp, xm pins output after every getpoint() call.

this feature mentioned in every touchscreen example.

david.


Arduino Forum > Using Arduino > Displays > MCUFRIEND library quirk?


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???