Use of readPixel from MCU_Friend

I'm trying to use readPixel, from the MCU_Friend library, on an OpenSmart Uno/ST7793 TFT.
After reading through all the associated library files, my understanding is that I can read the value associated with the colour of a particular pixel at location x, y.

I have two circles shown onscreen, one green, one red. When the screen is touched inside these circles, I can return the x and y co-ordinates, and then I want to read the colour of the pixel at those co-ordinates. However, the same value is always returned, no matter where I touch the screen. The value is (decimal) 49664 while the touchscreen is pressed, and 49154 when not pressed. The x,y co-ordinates are correct when I print them on the serial monitor.
I guess the returned are values from a memory location representing the co-ordinate, but they are always the same. suggesting that I am either reading the wrong co-ordinates, or have misunderstood the readPixel routine.
Can anyone point me in the right direction please?

Usually it is the other way round. You would show your code, and someone tells you what is wrong with it.

Did you think of looking for an example, and study and use it?
https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/readpixel_kbv/readpixel_kbv.ino

I've spent a long time searching for examples. with no luck. I've seen the example you quote, it is no help. Thanks for the help.

Maybe they're RGB565 values.
Who knows?

(The pixel value will be the value you last wrote there, usually)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.