[TFT 2.8" shield] get a pixel's color

by thecheshirecat on Fri Feb 22, 2013 4:45 pm

Hi everybody,
I managed to use the TFT 2.8" shield for arduino, and I'd like to know how to get a Pixel's color. Is there a solution to do that ?
Thanks in advance,

TheCheshireCat
thecheshirecat
 
Posts: 5
Joined: Fri Dec 07, 2012 7:47 am

Re: [TFT 2.8" shield] get a pixel's color

by thecheshirecat on Sun Feb 24, 2013 8:07 am

up...
thecheshirecat
 
Posts: 5
Joined: Fri Dec 07, 2012 7:47 am

Re: [TFT 2.8" shield] get a pixel's color

by pburgess on Sun Feb 24, 2013 9:43 pm

There's a pixel read function in the library, but I can't say for certain at the moment whether it actually works...might have possibly been a placeholder. Give it a shot and see if it meets your needs:
Code: Select all | TOGGLE FULL SIZE
uint16_t color;
color = tft.readPixel(x, y);
User avatar
pburgess
 
Posts: 2515
Joined: Sun Oct 26, 2008 1:29 am

Re: [TFT 2.8" shield] get a pixel's color

by thecheshirecat on Wed Feb 27, 2013 1:25 pm

Thank you very much for your answer, it looks exactly how i need !
Just another little question : Is the TFT shield's library working with an Arduino Mega ? Can I use the exact same code with a Mega and an Uno ?
thecheshirecat
 
Posts: 5
Joined: Fri Dec 07, 2012 7:47 am

Re: [TFT 2.8" shield] get a pixel's color

by pburgess on Wed Feb 27, 2013 8:55 pm

Sure does, but it runs a little faster on the Uno than the Mega. Also, if you're using the BMP examples you'll need to configure the SD library to use "soft" SPI.
User avatar
pburgess
 
Posts: 2515
Joined: Sun Oct 26, 2008 1:29 am