Thank you David for your help. I got the TFT screen working with using the software SPI setup with the TFT screen pinned up directly ('the convenient way') into the Arduino UNO.
I have a question.
I tried hooking up using the HW (hardware) constructor using the analog pins. Can I use the analog pins here for the HW constructor? Because right now I am getting just a blinking screen, ie the screen is refreshing (led backlight is blinking) but nothing is showing up. I also tried hooking this up with the digital pinout with my code as follows:
#include "SPI.h"
#include "TFT_22_ILI9225.h"
#define TFT_RST 4
#define TFT_RS 3
#define TFT_CS 2 // SS
#define TFT_SDI A2 // MOSI
#define TFT_CLK A1 /// SCK
#define TFT_LED 5 /// 0 if wired to +5V directly
// size of screen is 176x 220
/// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED);
/// Use software SPI (slower)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);// USE THIS IF DISPLAY IS HOOKED DIRECTLY INTO ARDUINO
int CircleRadius = 16;
const int n =1;
float x = 0;
float x1=0;
float y1 = 0;
int b = 0;
int x5;
int x4;
int x3;
int x2;
int y5;
int y4;
int y3;
int y2;
int a1 = 106; int a2 = 70; int a3; int a4; int a5; int b1 = 120; int b2 = 100; int bc3; int bd4; int be5;
// Setup
void setup()
{
int CircleRadius = 16;
Serial.begin(9600);
Serial.println("Hello jaflue");
tft.begin();
tft.setFont(Terminal6x8);
tft.drawText(10, 10, "Hello jaflue !", COLOR_BLUE);
delay(1000);
tft.clear();
}
void loop()
{
if(b <5) {
tft.drawRectangle(a1, b1, a2, b2, COLOR_BLUE);
x1 = x1 + n;
y1 = 2*(x1) + 1;
Serial.begin(9600);
Serial.println("Hello jaflue");
//tft.clear();
//tft.setFont(Terminal2x1);
//tft.drawText(10, 10, "Hello jaflue !")
//tft.setBackgroundColor(COLOR_GREEN);
//delay(1000);
//Serial.println("What radius do you want for the circle?"); //Prompt User for Input
//while(Serial.available()==0) { }// Wait for User to Input Data
//CircleRadius=Serial.parseInt(); //Read the data the user has input
tft.drawPixel(x1, y1, COLOR_BLUE);
tft.drawCircle(110, 88, CircleRadius, COLOR_GREEN); //uint16_t 110, uint16_t 88, uint16_t 16, uint16_t blue
x5 = x1;
b = b +1;
delay(1000);
}
else if(b>=5){
tft.drawRectangle(a1, b1, a2, b2, COLOR_BLACK);
a1 = a1 +1;
b1 = b1+1;
a2 = a2-1;
b2 = b2-1;
tft.drawRectangle(a1, b1, a2, b2, COLOR_BLUE);
tft.drawPixel(x1, y1, COLOR_BLACK);
x5 = x5 +1;
y5 = 2*(x5)+1;
x4 = x5;
x3 = x4-1;
x2 = x3-1;
x1 = x2-1;
y4 = 2*(x4) +1;
y3 = 2*(x3) +1;
y2 = 2*(x2) +1;
y1 = 2*(x1) +1;
tft.drawPixel(x5, y5, COLOR_BLUE);
tft.drawPixel(x4, y4, COLOR_BLUE);
tft.drawPixel(x3, y3, COLOR_BLUE);
tft.drawPixel(x2, y2, COLOR_BLUE);
tft.drawPixel(x1, y1, COLOR_BLUE);
delay(50);
}
}
Is there something obvious I am missing? Do I need to use resistors at all? Right now I am simply directly connecting the ports here.
Best,
Ian