#include <TFT.h> // Arduino LCD library
#include <SPI.h>
// pin definition for the Uno
#define cs 10
#define dc 9
#define rst 8
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
// char array to print to the screen
char sensorPrintout[4];
void setup() {
// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255,255,255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text("Sensor Value :\n ",0,0);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}
void loop() {
// Read the value of the sensor on A0
String sensorVal = String(analogRead(A0));
// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);
// set the font color
TFTscreen.stroke(255,255,255);
// print the sensor value
TFTscreen.text(sensorPrintout, 0, 20);
// wait for a moment
delay(250);
// erase the text you just wrote
TFTscreen.stroke(0,0,0);
TFTscreen.text(sensorPrintout, 0, 20);
}
Im totally new with these and totally lost, help me please.
Also beware that the model I quoted runs at 3.3V, so you either have to modify your arduino to run at 3.3/3.6V or make a voltage divider for the data pins.
Since it still took me a while to get it working with this library, please note the following:
The jumper for 3.3v/5v only applies to VCC and the backlight. The input/outputs always have to be 3.3v. The jumper does not apply to the logic pins.
You can use the screen by only connected the pins on the "yellow pin header":
RST -> RST (3.3v)
CE -> CS/SS (3.3v)
D/C -> DC (3.3v)
DIN -> MOSI (3.3v)
CLK -> SCLK (3.3v)
VCC -> VCC (3.3v or 5v, see jumper on back side)
BL -> BL (3.3v or 5v, see jumper on back side)
GND -> GND
Note that the soldable sockets can be used as well, but this configuration is easier/quicker to use.
You can use 2 TFTs (or more) on the SPI pins by only using different CS, DC and RST pins. So instead of 5*2 = 10 pins, you'll be needing 5+3 = 8 pins.
Ragoune:
Since it still took me a while to get it working with this library, please note the following:
The jumper for 3.3v/5v only applies to VCC and the backlight. The input/outputs always have to be 3.3v. The jumper does not apply to the logic pins.
You can use the screen by only connected the pins on the "yellow pin header":
RST -> RST (3.3v)
CE -> CS/SS (3.3v)
D/C -> DC (3.3v)
DIN -> MOSI (3.3v)
CLK -> SCLK (3.3v)
VCC -> VCC (3.3v or 5v, see jumper on back side)
BL -> BL (3.3v or 5v, see jumper on back side)
GND -> GND
Note that the soldable sockets can be used as well, but this configuration is easier/quicker to use.
You can use 2 TFTs (or more) on the SPI pins by only using different CS, DC and RST pins. So instead of 5*2 = 10 pins, you'll be needing 5+3 = 8 pins.
Thanks Ragoune! For me this was the solution, I needed the connections for the yellow connector, works great!
Just one question: I do not quite understand how to connect two displays, what do I have to connect and how to program them?
BTW I am using UTFT library..
Hi everyone,
I've tryed without succes to adapt those S6D02A1 library to ATMEL STUDIO without succes.
I now work on ARDUINO and load the sketch in my standalone chip.
I have a problem makikng this screen work.
Each example i load into my arduino UNO gives me the same result :
I get colored lines on the screen !! (See attachement)
Does anyone obtain the same issue ?
I checked my wiring twice and it's the same with two different units.
I cabled all the lines with 1.3Kohm resistors and the BL is cabled with 47Ohm on VCC (5v)
CLK -> 13
DIN -> 11
D/C -> 8
C/S -> 9
RST -> 7
The User_Setup.h is also set with those pins.
I tryed 2 differents libraries (TFT_S6D02A1 and Adafruit_QDTech-master) with the same issue.