Adafruit TFT touchscreen and motor shield rev 3 using same pins, need help

Hello, I am a beginner with Arduino and I am working on a project that requires I use both the Adafruit TFT touchscreen, and the motor shield rev 3 with an Arduino Uno.

The problem is that both require I use digital pin 12. (for MISO connection on the touchscreen and Direction for channel A on the motor shield). It seems as if both require this pin, however, I could be wrong.

How would I go about using both of these things at the same time? Is there a way to connect them both to the same pin? or possibly use a different pin? Or if not is there some external connector that I can use? Thank you.

Can you provide links to the exact TFT and motor driver? I will not waste time guessing at what you have.

groundFungus:
Can you provide links to the exact TFT and motor driver? I will not waste time guessing at what you have.

Hello yes, here are the links:
Touchscreen: 3.5 TFT 320x480 + Touchscreen Breakout Board w/MicroSD Socket [HXD8357D] : ID 2050 : $39.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Motor Driver: Arduino Motor Shield Rev3 | Arduino Official Store

The motor shield uses the SPI pins for The motor controls so you cannot use them for the display. Those pins are not used for SPI functions.

Perhaps your TFT display library allows you to use software SPI so that you can name the pins used for the TFT? See the motor shield schematic to see which pins are free. If you need them, the analog inputs can be used for digital pins.

groundFungus:
The motor shield uses the SPI pins for The motor controls so you cannot use them for the display. Those pins are not used for SPI functions.

Perhaps your TFT display library allows you to use software SPI so that you can name the pins used for the TFT? See the motor shield schematic to see which pins are free. If you need them, the analog inputs can be used for digital pins.

Alright, sorry I'm quite new to arduino, so how exactly would I go about this?

Follow his link (the TFT link in reply #2). There you will see " SPI users, we have a library as well". Click on that. It will take you to the GIT page of the library.

Install that library. How to install a library. Install the library using the library manager if possible.

Click on Examples. Then in the examples open the graphicstest.ino example.

Determine which pins are not used by the motor shield that can be used for the TFT.

You will see in the top of the file:

// These are 'flexible' lines that can be changed
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

To those defines add defines for MOSI, SCK, MISO and set the pins that you want to use for the SPI pins.
Change the TFT_ CS, TFT_DC, TFT_RST pins if necesary.

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

// SoftSPI - note that on some processors this might be *faster* than hardware SPI!
//Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, MOSI, SCK, TFT_RST, MISO);

Comment the hardware SPI line and uncomment the soft SPI line:

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

// SoftSPI - note that on some processors this might be *faster* than hardware SPI!
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, MOSI, SCK, TFT_RST, MISO);

Load and run the example. Did it work?

That is how to set up for soft SPI. Use those defines and constructor in your code.

Hello, thank you for all the help. I believe I altered the example code as you instructed and assigned each to a new pin. When I run the code the screen does turn on, however, it displays a white screen and nothing else. I'm not sure why this could be, do I perhaps have to specific pins? Here is the code that I changed:

// These are 'flexible' lines that can be changed
#define TFT_CS 10
#define TFT_DC 7
#define TFT_RST 6 // RST can be set to -1 if you tie it to Arduino's reset
#define MOSI 5
#define SCK 4
#define MISO 2

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
// Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

// SoftSPI - note that on some processors this might be *faster* than hardware SPI!
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, MOSI, SCK, TFT_RST, MISO);

The pins that you use seem to be not used by the motor shield. Double check that the TFT is wired to the pins that you have chosen.
mtr shield pins.jpg

Do you have the backlight connected and is it working?

I do not have a display to test with so can't be of much more help.

mtr shield pins.jpg

I have double-checked and all the pins are wired correctly. The backlight seems to be working as it displays a white screen when on. The response from the code when the test is run is:

83HX8357D Test!
Display Power Mode: 0xFF
MADCTL Mode: 0xFF
Pixel Format: 0xFF
Image Format: 0xFF
Self Diagnostic: 0xFF
Benchmark Time (microseconds)
Text 8344012
Lines 27586636
Rectangles (outline) 2554164
Circles (outline) 11963572

Did you mention that I could use the analog pins for the SPI pins? I could maybe try this if so.