[AVR] Arduino Uno and 2.8" TFT (mcufriend) interface issue

Status
Not open for further replies.

ecaits

Member level 4
Joined
Jan 16, 2014
Messages
76
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
579
Hi,

I want to interface 2.8" TFT which is of mcufriend, images attached for reference, with arduino uno.

I have written code as per below given but it display on white screen.

I have used SPI interfacing. Is there any library missing or anything else is the issue?

Code:
#include <TFT.h>
#include <SPI.h>

#define cs   A3
#define dc   A2
#define rst  A4

TFT TFTscreen = TFT(cs, dc, rst);

char sensorPrintout[4];

void setup() {

  TFTscreen.begin();

  TFTscreen.background(0, 0, 0);

  TFTscreen.stroke(255, 255, 255);

  TFTscreen.setTextSize(2);

  TFTscreen.text("Sensor Value :\n ", 0, 0);

  TFTscreen.setTextSize(5);
}

void loop() {

  String sensorVal = String(analogRead(A0));

  sensorVal.toCharArray(sensorPrintout, 4);

  TFTscreen.stroke(255, 255, 255);
 
  TFTscreen.text(sensorPrintout, 0, 20);

  delay(250);

  TFTscreen.stroke(0, 0, 0);
  TFTscreen.text(sensorPrintout, 0, 20);
}
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…