im trying to make 4 LEDs turn on with my TFT touchscreen shield…

i have an arduino MEGA 2560 R3, and the touchscreen shield i have is from Seeedstudio: TFT 2.8" touchscreen sheild V1 (RED).

so far this is all i have, i just need to write the code to turn on the LEDs when i press each square, and this is where i need help.

i dont know how to do that, any of you guys can just help me making one square to work. after that ill just take a look at it and then i can make the other 3 to work.

this is the code i have:

libraries.rar (385 KB)
photo (1).JPG
4 LEDs_Code.rar (633 Bytes)

ok this is what i have so far, but im getting an error.


Whether you refer to our ArduinoPhnoe’s code? But you know, this is a large work.

And,We are a company who provide tools for engineers, makers and hobbyist. Most of our products have documents on how-to use. You are free to choose appropriate modules and assemble them yourselves.So we just do some applications when we are free.

I already figure it out.

I fixed the code. It works perfect

I found that the code segment : if (p.z > ts.pressureThreshhold) can be removed as it does absolutely nothing.

In the Touchscreen.cpp file, the threshold is written thusly: pressureThreshhold = 10; yet in the touchscreen demo program, pressure values in the hundreds are returned. One might think the pressure threshold value would be larger to preclude inadvertent triggering. On the other hand, there may be more to it than I casually observed (I’m not a programmer).

:wink: Could you touch it and then turn color?

Wow~~could you post your code

Yes, each color corresponds to each led.

And also I made some changes.

I put another square ( the black one) to turn off all LEDs

Sounds good, could you share it with us.