Programming Help

Hello, I am using a TFT LCD shield and its set up and working just fine. However, I realized that the RGB565 color definitions are all correct, but if I do the tft.fillScreen(MAGENTA);, or any other color, the TFT screen shows a background of the exact color opposite to that on the color wheel, like instead of magenta, it shows green. Please help

Is there anything you feel you ought to be sharing?

Not any more information, why, is it necessary?

No, we don't need to know anything else.

We're all psychic.

Please just forget I asked.

Actually

#include <LiquidCrystal.h>

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library


#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin


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

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;


void setup() {
Serial.begin(9600);
Serial.println(F("TFT LCD test"));

tft.reset();


uint16_t identifier = tft.readID();
if(identifier == 0x9325) {
 Serial.println(F("Found ILI9325 LCD driver"));
} else if(identifier == 0x9328) {
 Serial.println(F("Found ILI9328 LCD driver"));
} else if(identifier == 0x4535) {
 Serial.println(F("Found LGDP4535 LCD driver"));
}else if(identifier == 0x7575) {
 Serial.println(F("Found HX8347G LCD driver"));
} else if(identifier == 0x9341) {
 Serial.println(F("Found ILI9341 LCD driver"));
}else if(identifier == 0x7783) {
 Serial.println(F("Found ST7781 LCD driver"));
}else if(identifier == 0x8230) {
 
}
else if(identifier == 0x8357) {

} else if(identifier==0x0101)
{     
   identifier=0x9341;
   
}else if(identifier==0x9481)
{     
    
}
else if(identifier==0x9486)
{     
    
}
else {
 identifier=0x9486;
}

tft.begin(identifier);

}

void loop()                     // run over and over again
{
   tft.fillScreen(MAGENTA);
}

Moderator edit: why doesn't anyone read the guidelines?

Would it be too much to ask to see some links to the device you are using?
The results of the serial prints?

Please remember to use code tags etc, etc.

I should think that it is obvious. Those #define's came from a different version or different hardware which interprets the numbers differently. Maybe red and green are swapped or something.

Either work out manually what values should be used in the #define or redefine them to use the color565() function.

You may even find that the library has already defined those constants and you can simply delete the incorrect definitions from your code.

rudey2145:
Moderator edit: why doesn't anyone read the guidelines?

Perhaps the ability to post should depend upon reading and eeacknowledging having read the Guideline first?

We're all psychic.

Not all of us. Some of us are psychotic.