Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

[TFT 2.8" shield] get a pixel's color
Moderators: adafruit_support_bill, adafruit

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

by thecheshirecat on Fri Feb 22, 2013 5: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 8:47 am

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

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

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

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

by pburgess on Sun Feb 24, 2013 10: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);

pburgess
 
Posts: 2999
Joined: Sun Oct 26, 2008 2:29 am

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

by thecheshirecat on Wed Feb 27, 2013 2: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 8:47 am

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

by pburgess on Wed Feb 27, 2013 9: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.

pburgess
 
Posts: 2999
Joined: Sun Oct 26, 2008 2:29 am



cron