Connecting Adafruit 2.8" TFT Touch Shield to a Photon


Just to make sure the SD-Slot doesn’t interfere, you might also want to explicitly deactivate it via TF_CS (odd name for an SD slot ;-)) at pin D4 on the board by adding this to your setup()

#define SD_CS D0  // accroding to your white wire in the pic above

void setup()
  // or if you intend to use the SD slot some time
  pinMode(SD_CS, OUTPUT);
  digitalWrite(SD_CS, HIGH);  // since it's an active LOW logic

Or just remove any card that might be in the slot :sunglasses:

According to the LinkSprite schematics there seems to be a not-marked RESET pin on the board you could also try pulling this pin high.
And could you also provide a pic how you’ve powered the shield?


@rossdeane, I’ve just realized that there is also a v2 of that board which has more pins

(source of pic

This is the pinout of an Arduino shield (seen from the top - needs to be flipped to fit the above pic)

(source of pic

Could it be that you’ve got this one?
If so, your wiring would be two pins off, which would explain a lot :wink:


Hey guys, I have read this discussion and I find it really interesting. But, because I’m totally new at this. I still don’t know what pins are wired to which and what wire. Can someone please guide me step to step on the wire and placement on the board? Thank you :grin:


To answer that, you’d need to give us some info.
As mentioned in my last post - there are two versions of that shied, which one have you got?
Are you using the Photon Shield Shield or not?
Do you want/need to use the SD slot?


Hey ScruffR! I figured how to connect to my 2.8" TFT Touch Shield with the help of a teacher. However I don’t know how to change the code of arduino to be able to use to the Photon. This will in turn make the TFT shield display a clock. The guide I was using is here: I don’t know how to change the code they gave at step 5 and 10. When I try to test the code it tells me there is a error that says " air/pgmspace.h: No such file or directory.


There already is a library ported for Particle

There are also some threads that deal with porting from Arduino to Particle
Porting from Arduino to (Simplified-Hopefully)

And there even is a github repo with some basic tips (including PGMSPACE)

Although some info got obsolete already since some things have been incorporated in the framework already
pgmspace.h: No such file or directory can easily be cured with

#ifdef __AVR__
#include <avr/pgmspace.h>
/* this block is not required anymore
 * #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
 * #define pgm_read_byte_near(addr) (*(const unsigned char *)(addr))
 * #define pgm_read_word(addr) (*(const unsigned short *)(addr))
 * #define pgm_read_word_near(addr) (*(const unsigned short *)(addr))

Same for the F() macro - it’s already there.

Arduino Yun code to Photon code help

This is my
Display Pinout
Photon TFT touch shield
A2 D10
A3 D13
A4 D12
A5 D11
Vin 5V
D4 D9
D5 Reset pin
Thanks for the help! After rereading and trail and error I figured it out :smiley:


Thanks for the help! I solved that error… But now I have another error. :frowning: The error is: expected ‘=’ ’ ’ ’ ’ ‘asm’ or ‘attribute’ before 'PROGMEN’
How would you solve this issue?
Here is part of my code:

  ST7781R TFT Library.

  2011 Copyright (c) Seeed Technology Inc.


#ifdef __AVR__
#include <avr/pgmspace.h>
/* this block is not required anymore
 * #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
 * #define pgm_read_byte_near(addr) (*(const unsigned char *)(addr))
 * #define pgm_read_word(addr) (*(const unsigned short *)(addr))
 * #define pgm_read_word_near(addr) (*(const unsigned short *)(addr))

const unsigned char simpleFont[][8] PROGMEM=


Now I have 51 errors :stuck_out_tongue:. All of them tell me that ‘x’ was not declare in this scope. Is this because I got the code from Arduino and I need to change somethings before using Particle dev?


@Question, try adding #include "Particle.h" at the top, before theifdef AVR` to see if the errors go away. :wink:


What @peekay123 said :wink:

In the GitHub link I provided above was this

#if defined (SPARK)
  #include "application.h"  // <-- this used to be what's now better called "Particle.h"
  #if defined(ARDUINO) && ARDUINO >= 100
    #include "Arduino.h"
    #include "WProgram.h"
  // here could follow some of the includes only needed on Arduino
  // see bellow

After adding this the other error: expected '=' ' ' ' ' 'asm' or 'attribute' before 'PROGMEM' should be gone too.
Otherwise just add

#ifdef PROGMEM
#  undef PROGMEM
#define PROGMEM

after the Particle.h include.


Is the wiring for this different if you want to have your TFT touch shield have touch screen instead of just displaying. Would you have to wire the Photon to the shield differently?


Does that code work with particle dev? Because when they say pgmspace.h: No such file or directory. Your solution only works when you are using Arduino right? Because the software for Arduino already has those files preinstalled. However, in the Particle dev I don’t have the files installed and don’t know where is it.


Have you actually looked at and read the link I even quoted above?

I can repost the same thing

This solution works when it is an Arduino with __AVR__ declared by including that header and #else by exactly not including it.
You won’t need that since the non-AVR processors don’t have the distinction between accessing pgmspace or normal RAM, so no need for any special treatment.
Since you are not including pgmspace.h you definetly won’t get the no such file error for that not needed file.

Or as said in the linked GitHub page

That depends on the exact shield you’re using?
Got a link?


I’m using the TFT touch shield 2.8" version 2. Link:


That link clearly states

and on the board you see a silk note TS CS #8 - that’s the SPI chip select for the touch screen.
So you only need one extra pin to control the CS pin on the display to actually talk to the touch controler.

Here yo can find the wiring info for TFT, resistive TouchScreen & SD

Note that the first three pins are always the same (SPI CLK, MOSI, MISO), only the CS pins need to be seperate (and the TFT also wants a D/C pin).

Porting Adafruit STMPE610 resistive touch screen controller

So, there is only a pin difference between touchscreen and display on the TFT touch shield? What is a silk note? What pin do I have to connect to? I’m really sorry if I’m wasting your time. I just don’t understand much because I am new to everything


The white printing on the bottom of the PCB is called silk screen and the text informs (notes) about pin mapping and other things.

You could use any free IO pin on the Photon (connected to pin #8 on the shield) for that, you’d just inform the library that does the talking to the touch controler which pin to use.

(image source: )


What is a IO pin? So I can wire any female female jumper wire on the Photon to pin #8 on the TFT shield and there will be Touchscreen? If I inform my library?


Hmm, that’s very basic tho’
IO stands for Input/Output and in connectino with the Photon it refers to the pins marked with D0~D7, A0~A5 & DAC, WKP, RX, TX.
These are pins that can be used in code by use off commands like pinMode(), digitalRead(), digitalWrite(), analogRead(), analogWrite() and via specialized interface libraries like SPI, Serial1, Wire - just to name a few.

Generally yes, but with not any background in programming micro controllers that might be a big chunk to chew without a tutor.