2.8" TFT + reset pin

by ZTiK.nl on Fri Feb 22, 2013 9:46 am

Hi again,

I am still happily using my 2.8" TFT touchscreen (breakout, not the shield), but I have been trying to figure something out I thought was pretty straightforward...
The code examples all contain the following lines:
Code: Select all
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
/* a bit further */
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); // setup TFT library


If I want to connect the reset pin on the TFT to the reset pin on my Teensy (or an Arduino), how would I define this in the settings?
Simply removing the ', LCD_RESET' will result in compile errors due to missing values.

Also, if I check the library, all I can see is that the reset pin is using digital pin functions, why is it connected to an analog pin instead?

I'm probably overlooking something simple though... :x

edit: added link to code example
ZTiK.nl
 
Posts: 21
Joined: Thu Jan 17, 2013 2:43 pm

Re: 2.8" TFT + reset pin

by adafruit_support_rick on Fri Feb 22, 2013 12:13 pm

Change the definition of LCD_RESET to 0, and then connect the reset jumper to the arduino's reset pin.
Code: Select all
#define LCD_RESET 0


The analog pins on an arduino are also digital pins. They're labeled 'analog' because they support analog input in addition to digital I/O.
User avatar
adafruit_support_rick
 
Posts: 8435
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: 2.8" TFT + reset pin

by ZTiK.nl on Fri Feb 22, 2013 8:04 pm

Thank you for that reply, I set LCD_RESET to 0, and it works perfectly!

About the Analog/Digital pin, I understand that these pins have dual functionality, but what I don't understand is that the reset button (according to the library code) does nothing except
Code: Select all
    digitalWrite(reset, HIGH);
    pinMode(reset, OUTPUT);

And a bit further in the code:
Code: Select all
    digitalWrite(_reset, LOW);
    delay(2);
    digitalWrite(_reset, HIGH);


So I don't see why the examples and the tutorial prefer to use an Analog+Digital combo pin instead of a normal Digital pin.
ZTiK.nl
 
Posts: 21
Joined: Thu Jan 17, 2013 2:43 pm

Re: 2.8" TFT + reset pin

by adafruit_support_rick on Fri Feb 22, 2013 9:27 pm

No idea. It's up to whoever writes the code. Maybe they didn't want people to get it mixed up with the data lines? Maybe they adapted it from some other code where the analog pins were all that were left?
User avatar
adafruit_support_rick
 
Posts: 8435
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY