Gear indigator(problem with tft st7735)

Hello,
I am trying to make a gear indicator with hall switch sensor.The code works but when i write the last
else if

else if (FirstGear == LOW && SecondGear == LOW && ThirdGear == LOW && ForthGear == LOW && FiveGear == LOW && ReverseGear == LOW) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("N");
}

the tft flashing the font.The other problem that i noticed is when i touch the input this it activated.
I use arduino uno with tft ST7735. I don’t decided yet the hall switch sensor which i use.

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#define cs   10
#define dc   9
#define rst  8 

#define BLACK           0x0000
#define BLUE            0xC01F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0  
#define WHITE           0xFFFF

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
const int FirstHall = 2; //The number of the hall switch sensor 
const int SecondHall = 3; //The number of the hall switch sensor
const int ThirdHall = 4; //The number of the hall switch sensor
const int ForthHall = 5; //The number of the hall switch sensor
const int FiveHall = 6; //The number of the hall switch sensor
const int ReverseHall = 7; //The number of the hall switch sensor

int FirstGear =0; //Variable for reading the hall switch sensor status
int SecondGear =0; //Variable for reading the hall switch sensor status
int ThirdGear =0; //Variable for reading the hall switch sensor status
int ForthGear =0; //Variable for reading the hall switch sensor status
int FiveGear =0; //Variable for reading the hall switch sensor status
int ReverseGear =0; //Variable for reading the hall switch sensor status

void setup() {
 tft.initR(INITR_BLACKTAB); // Initialize a ST7735S chip, black tab
 pinMode(FirstHall, INPUT); // Initialize the hal switch sensor pin as an input
 pinMode(SecondHall, INPUT); // Initialize the hal switch sensor pin as an input
 pinMode(ThirdHall, INPUT); // Initialize the hal switch sensor pin as an input
 pinMode(ForthHall, INPUT); // Initialize the hal switch sensor pin as an input
 pinMode(FiveHall, INPUT); // Initialize the hal switch sensor pin as an input
 pinMode(ReverseHall, INPUT); // Initialize the hal switch sensor pin as an input
}
void loop(){
 FirstGear = digitalRead(FirstHall); // Read the state of the hal switch sensor value
 SecondGear = digitalRead(SecondHall); // Read the state of the hal switch sensor value
 ThirdGear = digitalRead(ThirdHall); // Read the state of the hal switch sensor value
 ForthGear = digitalRead(ForthHall); // Read the state of the hal switch sensor value
 FiveGear = digitalRead(FiveHall); // Read the state of the hal switch sensor value
 ReverseGear = digitalRead(ReverseHall); // Read the state of the hal switch sensor value
 
 if (FirstGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("1");
 }
 else if (SecondGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("2");
 }
 else  if (ThirdGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("3");
 }
 else if (ForthGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("4");
 }
 else if (FiveGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("5");
 }
 else if (ReverseGear == HIGH) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("R");
}
 else if (FirstGear == LOW && SecondGear == LOW && ThirdGear == LOW && ForthGear == LOW && FiveGear == LOW && ReverseGear == LOW) {
   tft.fillScreen(ST7735_BLACK); // Clear the screen with a black background
   tft.setCursor(40, 10); // Set cursor position
   tft.setTextColor(ST7735_WHITE); // Set the font color to white
   tft.setTextSize(10); // Set the font size
   tft.println("N");
}
}

Hi,

Can you please post a copy of your sketch, using code tags.

Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

A quick explanation of what the gear lever is on and how you are detecting its position, also how are you are displaying the information. Also hall effect type and display type as well as which arduino controller. As you are close to it working, there would be quite a few readers of this forum would be interested in adapting it to their own applications. Hope to help Tom...... :)

Can anyone help me?

I think Tom is waiting for some kind of detail about how you have things wired up.

The picture show the connection diagram of tft without connect the sd card.