Connect Particle Photon to 2.2" Adafruit Display

Hi I am attempting to connect my particle photon to a 2.2" Adafruit TFT display.

I am attempting this project.

Like the author, I am using 2 breadboard and jumper cables to accomplish this.

However, the author is using a different TFT display. I am also trying to incorporate a button but I do not know anything about the electricals.

How would I correctly wire my particle photon to the TFT display? Thank you.

There is a library in the WebIDE called ADAFRUIT_ILI9341 which might work for your display (which is the ILI9340) Give that a try first and report back.

@harrisonhjones sorry for not mentioning, I am using the ADAFRUIT_ILI9341 library already. I have this so far…

(Spark: TFT Display)

A0: RST
A1: D/C
A2: CS
A3: SCK
A4: MISO
A5: MOSI

GND: GND
VIN: VIN

I am directly wiring via breadboard from photon to TFT display
I have not connected SDCS nor BL.
I get a white screen after flashing and running this code below, not sure what the issue is:

// This #include statement was automatically added by the Particle IDE.

#include "Adafruit_mfGFX/Adafruit_mfGFX.h"
#include "Adafruit_ILI9341/Adafruit_ILI9341.h"
#include "application.h"

unsigned int nextTime = 0;

int switchPin = D1;

//Adafruit_ILI9341 display = Adafruit_ILI9341(A0, A2, A1);
Adafruit_ILI9341 display = Adafruit_ILI9341(A2, A1, A0); //different method

void printText(String text) {
    display.fillScreen(ILI9341_BLACK);
    display.setCursor(0, 0);
    display.setTextColor(ILI9341_WHITE);
    display.setTextSize(3);
    display.println(text);
}

void setup() {
    Serial.begin(9600);
    display.begin();
    //pinMode(switchPin, INPUT_PULLUP);
    Time.zone(+1); //set timezone for bst
    display.setRotation(3); // rotate screen for landscape orientation
    display.fillScreen(ILI9341_YELLOW); // flash screen yellow to ensure screen is working
}

void loop() {
    display.fillScreen(ILI9341_RED);
    printText("hello!");
}

Thank you!

Can you give the example from that library a try? It can be found in both the Web IDE and here.

You may need to pull in the changes mentioned here. The easiest way to do that would be to download the version mentioned in the pull request and then add it, file by file, to your app (make sure to also remove the library reference as well). Give that a try.

I am using the web IDE and I am unsure how to run this code without running into compiler errors.

After I locate the file I click "use this example"
Then I verify the code and encounter this compiler error: "testgfx.cpp:18:43: fatal error: Adafruit_mfGFX/Adafruit_mfGFX.h: No such file or directory
#line 2 "

What is the workaround here?
Thanks!

You need to go back in and also add the Adafruit mfGFX library.

1 Like

Successfully verified and flashed the photon with the example from the library.
After flashing, I waited and only noticed that the screen was still white.

I incorporated the git pull request and got this error message:

"In file included from Adafruit_ILI9341.cpp:17:0:
Adafruit_ILI9341.h:24:0: warning: "pgm_read_byte" redefined [enabled by default]
 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
 ^
In file included from ../wiring/inc/spark_wiring.h:37:0,
                 from ./inc/application.h:36,
                 from Adafruit_mfGFX/Adafruit_mfGFX.h:13,
                 from Adafruit_ILI9341.h:21,
                 from Adafruit_ILI9341.cpp:17:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
 #define pgm_read_byte(x)      (*(x))
 ^
In file included from Adafruit_ILI9341.cpp:17:0:
Adafruit_ILI9341.h:25:0: warning: "pgm_read_word" redefined [enabled by default]
 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
 ^
In file included from ../wiring/inc/spark_wiring.h:37:0,
                 from ./inc/application.h:36,
                 from Adafruit_mfGFX/Adafruit_mfGFX.h:13,
                 from Adafruit_ILI9341.h:21,
                 from Adafruit_ILI9341.cpp:17:
../wiring/inc/spark_wiring_arduino.h:33:0: note: this is the location of the previous definition
 #define pgm_read_word(x)      ((uint16_t)(*(x)))
 ^
Adafruit_ILI9341.cpp:22:17: error: redefinition of 'STM32_Pin_Info* PIN_MAP'
 STM32_Pin_Info* PIN_MAP = HAL_Pin_Map(); // Pointer required for highest access speed
                 ^

In file included from ./inc/application.h:66:0,
                 from Adafruit_mfGFX/Adafruit_mfGFX.h:13,
                 from Adafruit_ILI9341.h:21,
                 from Adafruit_ILI9341.cpp:17:
../wiring/inc/fast_pin.h:113:24: error: 'STM32_Pin_Info* PIN_MAP' previously declared here
 static STM32_Pin_Info* PIN_MAP = HAL_Pin_Map();
                        ^

make[1]: *** […/build/target/user/platform-6Adafruit_ILI9341.o] Error 1
make: *** [user] Error 2
Error: Could not compile. Please review your code."

What do I need to do?
Thanks!