~ Here is the thing:
I will be very happily receiving an Adafruit 1.8" TFT LCD display.
Although I have a Mega (2560?), I'd like to use it with my Uno.
Once my project is done, I'd like to switch to a micro or a mini to install my project permanently.
And for my project, I need as many PWM pins free as possible.
~ Here is the problem:
Looking at wiring and test section of this LCD on Adafruit (Breakout Wiring & Test | 1.8" TFT Display Breakout and Shield | Adafruit Learning System), I see that this LCD is using at least 3 PWM pins on an Uno.
~ Here is the question:
- Is it possible to wire this component differently?
- If it is possible, how can do it?
I'd like to have all 6 real PWM pins free (or at least 5 since I think 1 PWM is a must for LCD brightness).
I am not a complete beginner but I don't really know the gist of Arduino's workings at this stage and I couldn't find an answer to this problem.
Thanks in advance everyone for your help.
The very first line from the Adafruit link you posted (red highlight added my me)...
There are two ways to wire up these displays - one is a more flexible method (you can use any pins on the Arduino) and the other is much faster (4-8x faster, but you are required to use the hardware SPI pins) We will begin by showing how to use the faster method, you can always change the pins later for flexible 'software SPI'
The hardware SPI is fixed to using pins 10-13. You might be able to re-purpose pin 10 as long as it remains an output but the other pins 11-13 are what they are. I would assume pin 9 can be changed without much problem.
Thank you for your help.
I read the Adafruit link start to finish.
It just shows how to change pins 13 and 11.
It mentions later changing other ones as well but I am not seeing where or how.
So that's the reason why I ask my question: How? here
I also assumed that the rest can be changed given Adafruit mentioning it.
Can I please get some help with that?
The very first line from the Adafruit link you posted (red highlight added my me)...The hardware SPI is fixed to using pins 10-13. You might be able to re-purpose pin 10 as long as it remains an output but the other pins 11-13 are what they are. I would assume pin 9 can be changed without much problem.
You can either run the display using the hardware SPI pins, or you can use software SPI (slower, but lets you define the pins).
For hardware SPI, this is an excerpt from my code;
// Config for HW SPI
#define cs 10
#define dc 9
#define rst 8 // you can also connect this to the Arduino reset and set this to 0
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
You'll notice that mosi & clock arent defined, since they are on pre-defined pins.
When you invoke the display using software SPI, you define the pins and tell the library which pins to use with the following line:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST)
where TFT_CS, TFT_MOSI... etc etc are all created using define statements eg;
#define TFT_MOSI 11
I warn you now, software SPI is significantly slower.....(which doesnt seem like a problem initially, until you realise that writing SPI data is an activity which blocks your code)
hope that helps