I was able to get everything working including the graphics test and the paint example!
One thing I noticed is that every time I power cycle, as in unplug the USB cable and then plug it back in, the screen is just blank white. I need to manually press the reset pin and then it will load properly.
I would of course like to avoid this and just be able to plug it in and go. I have the same problem even if using a USB power bank.
This also happens regardless of the code used. I.e. it happens with all working examples.
What can I do to fix this so that the Arduino and Screen work right after plugging it in every time?
I see a lot of talk of different versions and reset pins though I am not sure what may be wrong after working on it this afternoon.
Here is the basic code I am using to display a black screen and then a green screen if touched. Works great until I power cycle then it's bricked until I hit the reset pin.
Code: Select all
////////////////////////////////////////////////////////////////////////////////
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_FT6206.h>
Adafruit_FT6206 ts = Adafruit_FT6206();
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
////////////////////////////////////////////////////////////////////////////////
void setup() {
tft.begin();
if (!ts.begin(40)) {
// Serial.println("Unable to start touchscreen.");
}
else {
// Serial.println("Touchscreen started.");
}
tft.fillScreen(ILI9341_BLACK);
} // End Setup
////////////////////////////////////////////////////////////////////////////////
void loop() {
if (ts.touched())
{
tft.fillScreen(ILI9341_GREEN);
} else {
tft.fillScreen(ILI9341_BLACK);
}
} // End Loop
////////////////////////////////////////////////////////////////////////////////