I have an odd thing happening?
I am using a ST7735 display, it has 1.8 128x160 rgb tft along one edge.
The only way I can get it to work is to connect the nano
pin D8 to rst
pin D9 to DC
pin 10 to DS
pin 11 to SDA
and
pin 13 to SCL
(I have a feeling I have may have burned out part of the display and it needs all these wires to work?)
If I put Pin 12 to SCL instead of Pin 13 it doesn't display anything.
It is fine using the example sketch TFTDisplaytext from the tft library but I would like to use pin 12 instead of 13.
Does the info to use pin 13 come from tft.h because I can't find the tft.h file on my computer?
I know the scl and sda pins on the Arduino are A5 and A4 but it works wired like this?
Removing pin 11 (sda) stops the display working as well.
I even thought pin 13 might just be working because it is connected to a led and gnd but I put the SCL to gnd via a 470 ohm resistor but still nothing.
Can someone understand what is happening?
Please, upload your sketch, a datasheet for your TFT display and a wiring diagram..
Most probably your display works via SPI. In that case SDA and SCL is misspelled names of MOSI and SCK, which are on pins 11 and 13 on Arduino Nano.
Hi Matelot,
Presumably you are using the Adafruit_ST7735.h and Adafruit_GFX.h libraries (publish your sketch!!!!!) The Adafruit_T7735 library needs declarations for CS, DC and RST and assumes default pins for SCK and MOSI. This is SPI communication. The 128*160 TFT is an old hand yet still pretty good in performance. Works nice with ESP32 microcontrollers.
Cheers, Photoncatcher
see my post: Arduino and 160×128 TFT display with a ST7735S controller – thesolaruniverse
I have just added the sketch, it is the TFTDisplaytext from the TFT examples with the wiring to the display added at the top.
/*
Arduino TFT text example
This example demonstrates how to draw text on the
TFT with an Arduino. The Arduino reads the value
of an analog sensor attached to pin A0, and writes
the value to the LCD screen, updating every
quarter second.
This example code is in the public domain
Created 15 April 2013 by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/TFTDisplayText
*/
#include <TFT.h> // Arduino LCD library
#include <SPI.h>
// pin definition for the Uno
#define cs 10
#define dc 9
#define rst 8
BLK - n/c
CS - D10
DC - D9
RST - D8
SDA - D11
SCL - D13
VCC - 5v
GND - GND
// pin definition for the Leonardo
// #define cs 7
// #define dc 0
// #define rst 1
// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);
// char array to print to the screen
char sensorPrintout[4];
void setup() {
// Put this line at the beginning of every sketch that uses the GLCD:
TFTscreen.begin();
// clear the screen with a black background
TFTscreen.background(0, 0, 0);
// write the static text to the screen
// set the font color to white
TFTscreen.stroke(255, 255, 255);
// set the font size
TFTscreen.setTextSize(2);
// write the text to the top left corner of the screen
TFTscreen.text("Sensor Value :\n ", 0, 0);
// ste the font size very large for the loop
TFTscreen.setTextSize(5);
}
void loop() {
// Read the value of the sensor on A0
String sensorVal = String(analogRead(A0));
// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);
// set the font color
TFTscreen.stroke(255, 255, 255);
// print the sensor value
TFTscreen.text(sensorPrintout, 0, 20);
// wait for a moment
delay(250);
// erase the text you just wrote
TFTscreen.stroke(0, 0, 0);
TFTscreen.text(sensorPrintout, 0, 20);
}
can this be replaced with pins 11 and 12?
photoncatcher, I am just replying to this thread for now I will read the link you gave me when I can thanks for that.
How does this compile?
AH! all I did was paste my copy of the sketch and then add these lines in the forum page for clarity. This how my setup is wired.
You can change pins 8 , 9 and 10 but 11 and 13 cannot be changed because they are SPI bus pins
Thank you MaximoEsfuerzo that is all I asked.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.