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

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
thecheshirecat
 
Posts: 5
Joined: Fri Dec 07, 2012 8:47 am

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

Post by thecheshirecat »

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

Post by thecheshirecat »

up...

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

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

Post by pburgess »

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

uint16_t color;
color = tft.readPixel(x, y);

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

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

Post by thecheshirecat »

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 ?

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

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

Post by pburgess »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”