Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

lcd display goes white after fixing gfx
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

lcd display goes white after fixing gfx

by air117 on Wed Feb 12, 2020 3:45 pm

I got the error message of c:\users\drew0\documents\arduino\libraries\adafruit_tftlcd_library\adafruit_tftlcd.cpp:17:0: c:\users\drew0\documents\arduino\libraries\adafruit_tftlcd_library\pin_magic.h:361:5: warning: backslash and newline separated by space

I "fixed" it by reading online to switch the adafruit gfx library from version 1.7.5 to 1.5.3 to be compatible with the Arduino tftlcd library.

I got it to compile but not I am getting the white screen as shown in the pic provided.

After compiling again I got this error message:

In file included from C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:17:0:

C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:360:5: warning: backslash and newline separated by space

\



C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:935:0: warning: "read8" redefined

#define read8(x) x = read8fn()



In file included from C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:17:0:

C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:229:0: note: this is the location of the previous definition

#define read8 read8inline



C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::begin(uint16_t)':

C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:531:12: warning: large integer implicitly truncated to unsigned type [-Woverflow]

lo = (d); \

^

C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:233:25: note: in expansion of macro 'writeRegister16inline'

#define writeRegister16 writeRegister16inline

^~~~~~~~~~~~~~~~~~~~~

C:\Users\drew0\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:354:5: note: in expansion of macro 'writeRegister16'

writeRegister16(ILI9341_VCOMCONTROL1, 0x2B2B);

^~~~~~~~~~~~~~~

LCD Display problem copy.jpg
LCD Display problem copy.jpg (561.08 KiB) Viewed 48 times


Here is my code and idk what I have done wrong...SOS :


#include "HX711.h"
#define calibration_factor -7050.0 //This value is obtained using the SparkFun_HX711_Calibration sketch
#define DOUT1 23
#define CLK1 44
#define DOUT2 25
#define CLK2 46
HX711 scale1;
HX711 scale2;
/*
HX711 scale3;
HX711 scale4;
HX711 scale5;
*/

#include <Adafruit_MAX31856.h>
Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(10, 11, 12, 13);

#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


// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

float load_val_1 = 0.0;

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);


void setup() {

Serial.begin(115200);

//LCD Display stuff
Serial.println(F("TFT LCD test"));
#ifdef USE_ADAFRUIT_SHIELD_PINOUT
Serial.println(F("Using Adafruit 2.8\" TFT Arduino Shield Pinout"));
#else
Serial.println(F("Using Adafruit 2.8\" TFT Breakout Board Pinout"));
#endif
Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(0x9341);
Serial.print(F("Text "));
// Serial.println(testText());
tft.setRotation(2);
tft.fillScreen(BLACK);
//


// Load Cell stuff

Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");

scale1.begin(DOUT1, CLK1);
scale2.begin(DOUT2, CLK2);
scale1.set_scale();
scale2.set_scale();
scale1.tare(); //Reset the scale to 0
scale2.tare(); //Reset the scale to 0

long zero_factor1 = scale1.read_average(); //Get a baseline reading
long zero_factor2 = scale2.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor1);
Serial.println(zero_factor2);
//

// Thermocouple Stuff
maxthermo.begin();
maxthermo.setThermocoupleType(MAX31856_TCTYPE_K);
//

tft.setRotation(4);
tft.fillScreen(BLACK);
unsigned long start = micros();

tft.setCursor(0, 0);
tft.setTextColor(GREEN);
tft.setTextSize(4);
tft.println("Fwd. Thrust: lbs");
tft.println();

tft.setTextColor(WHITE);
tft.setTextSize(4);
tft.println("Vert. Thrust: lbs");
tft.println();

tft.setTextColor(CYAN);
tft.setTextSize(4);
tft.println("Horz. Thrust: lbs");
tft.println();
tft.println();

tft.setTextColor(RED);
tft.setTextSize(5);
tft.println("Temp.: C");
tft.println();

return;
//return micros() - start;
}


void loop() {
// put your main code here, to run repeatedly:

scale1.set_scale(calibration_factor); //Adjust to this calibration factor
scale2.set_scale(calibration_factor);

Serial.print("Reading: ");
Serial.print(scale1.get_units(), 1);
Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();


Serial.print("Reading: ");
Serial.print((scale2.get_units()+scale1.get_units())/2, 1);
Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
Serial.println();

Serial.print("Cold Junction Temp: ");
Serial.println(maxthermo.readCJTemperature());

Serial.print("Thermocouple Temp: ");
Serial.println(maxthermo.readThermocoupleTemperature());

// For Displaying the sensor outputs

unsigned long start = micros();

// Load Cell 1
tft.setCursor(300, 0);
tft.fillRect(0, 40,235,50,BLACK);
tft.setTextColor(GREEN);
tft.setTextSize(6);
tft.println(scale1.get_units(),1);

// Load Cells 2&3
tft.setCursor(315, 85);
tft.fillRect(0, 130,235,50,BLACK);
tft.setTextColor(WHITE);
tft.setTextSize(6);
tft.println(scale2.get_units(),1);

// Load Cells 4&5
tft.setCursor(315, 190);
tft.fillRect(0, 230,235,60,BLACK);
tft.setTextColor(CYAN);
tft.setTextSize(6);
tft.println(scale2.get_units(5)+scale1.get_units(),1);

// Thermocouple
tft.setCursor(0, 360);
tft.fillRect(0, 360,250,50,BLACK);
tft.setTextColor(RED);
tft.setTextSize(6);
tft.println(maxthermo.readThermocoupleTemperature());

return;
//return micros() - start;
}

air117
 
Posts: 1
Joined: Wed Feb 12, 2020 3:31 pm

Please be positive and constructive with your questions and comments.