EDIT: Done some more searching (a lot more lol) and managed to work out the wiring, and also get the adafruit libs installed and now it is working, very impressive little screen!
I notice when you send data to the screen it stays until something is written over it. When sending variable data text strings to the TFT, the results just keep overlaying each other. Sending tft.fillScreen(ST7735_BLACK); is very slow and it seems pointless re-writing any static text also.
Is there a simple way around it? I guess you could just write black squares over areas but that sounds like a nightmare to implement
Also the wrong as some of you mentioned would be the case.
Is that using the hardware SPI pins? I have just looked at the code and again and realised I am not using them?
// You can use any (4 or) 5 pins
#define sclk 4
#define mosi 5
#define cs 6
#define dc 7
#define rst 8 // you can also connect this to the Arduino reset
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
// Option 1: use any pins but a little slower
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
// Option 2: must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
//Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
The answer to the overlaid printing is to first print a blank line over the text you are refreshing.
Glcd.print(" "); or something similar. I'm not at home now so I can't share the example code. If you need it I'll be happy to post it later today.
@zachwiej - How do you connect up the display to the hw SPI on the arduino?
// Option 2: must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
I guess 13 goes to SCK on the lcd, but I'm not sure what pins 11 and 10 need to be wired to on the screen?
@Docedison - Thanks Bob I would quite like to see the code if you don't mind.
LCD MISO goes to arduino MISO, MOSI to MOSI, SCK to SCK, CS to CS and there will be one signal left so connect it to any other pin. Like in Adafruit tutorial
The TFT connections are labelled SDA, SCL, CS, AO. The SD card connections are labelled MOSI, MISO, SCK, CS.
At first glance it looks like the TFT is I2C (SDA and SCL) but these actually correspond to he TFT's MOSI and SCK inputs. AO is the DC in the Adafruit tutorial.
There are two CS, but one is clearly marked inside an area labelled 'SD' while the other (TFT) is outside that area.
I have now connected 3 data pins as such and it is not working
Pin 10 to TFT CS
Pin 11 to TFT SDA
Pin 13 to TFT SCK
Where do I connect A0 or reset? The adafruit tutorial says "sclk = 13 and sid = 11) and pin 10 must be an output".
// You can use any (4 or) 5 pins
#define sclk 1
#define mosi 5
#define cs 6
#define dc 7
#define rst 8 // you can also connect this to the Arduino reset
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <math.h>
// Option 1: use any pins but a little slower
//Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
// Option 2: must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
Will the above work or do I have to change the #define pins, or does something in the library set it up?
Hi
If You want to use hardware SPI use this definition (You can change those pins) #define cs 10 #define dc 9 #define rst 8
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
That's a good idea, so I guess you would print the old text again to overwrite it (inverted color), then set the cursor position back and print the new?
It should work with other SPI Devices, as the SD card example shows.
As long as each device is assigned to it's own CS pin and the correct confit declared in the constructor or library.
As said above though, there can be issues with Wiznet 5100 based board as there is a bug with it where it doesn't release the SPI bus after use. Some shields have a fix implemented to ensure the CS is switched correctly.
I had an Ethernet shield clone that seemed to work OK alongside an nRF24L01+ transceiver on the same SPI bus, so your mileage an vary.
I just received this LCD on PCB and I think that there is no voltage level conversion ! only 10k ohm resistor on SD card lines!
So I don't think that it's safe to connect this lcd to arduino directly !