mega 2560 et ili9486 tactile décalé de 90°

J’utilise la mega2560 rev3 avec un écran tft lcd tactile ili9486 3.5 et tout fonctionne très bien avec les bibliothèques suivantes:
<Adafruit_GFX.h> <Arduino.h> <Adafruit_TFTLCD.h <TouchScreen.h> <MCUFRIEND_kbv.h>
La configuration normale des pins est la suivante: YP A2 XM A3 YM 8 XP 9
Mais voila j’ai acheté plusieurs autres méga 2560, l’écran fonctionne très bien mais le tactile pas du tout, j’ai testé plusieurs mégas et plusieurs écrans avec touchscreendemo. En changeant la configuration des pins (YP A1 XM A2 YM 7 XP 6 ) j’arrive à faire fonctionner le touch mais en mode paysage (+90°) alors que mon application est en mode portrait (J’ai fait un test avec “touchscreendemo”)
En inversant les pins X et Y, le touch est en miroir horizontal donc pas bon non plus.
y a t-il une option d’orientation pour le tactile ?
Quelqu’un peut m’aider s’il vous plait

Please write in English.

Google Translate says:

I am using mega2560 rev3 with ili9486 3.5 touch lcd tft screen and everything works fine with the following libraries:
<Adafruit_GFX.h> <Arduino.h> <Adafruit_TFTLCD.h <TouchScreen.h> <MCUFRIEND_kbv.h>
The normal configuration of the pins is as follows: YP A2 XM A3 YM 8 XP 9
But here I bought several other mega 2560, the screen works very well but the touch screen not at all, I tested several mega and several screens with touchscreendemo. By changing the configuration of the pins (YP A1 XM A2 YM 7 XP 6) I manage to make the touch work but in landscape mode (+ 90 °) while my application is in portrait mode (I did a test with " touchscreendemo ")
By reversing the X and Y pins, the touch is mirrored horizontally so not good either.
Is there an orientation option for touch?
Can someone help me please

Install Adafruit_GFX.h, TouchScreen.h, MCUFRIEND_kbv.h via the IDE Library Manager.

You do not need Adafruit_TFTLCD.h or Arduino.h

Run the TouchScreen_Calibr_native.ino example
Copy the Calibration lines to Touch_shield_new.ino example
Change the orientation in Touch_shield_new to show that it works in all directions.

Study the code in Touch_shield_new.ino
Especially how the pixel coordinates change for different tft.getRotation()

I don’t know how well this answer will translate to French.
Ask (in English) if you do not understand something.


[color=#202124]Thank you for your quick response, I try everything and I will get back to you
[color=#202124][pre]Thanks, everything works, I studied the system and modify the map.
native touchscreen helped me understand but also gave wrong information about up, down ...
Thank you 1000 times for your help.


[color=#202124]For people who are interested here are all the modifications I made
change xm A3 to A1, ym 8 to ym6, xp 9 to 7
yp stay same.
map become

p.x = map(p.x, TS_MINX, TS_MAXX,tft.width(),0);
    p.y = tft.height() - (map(p.y, TS_MINY, TS_MAXY,0,tft.height()));

Study the Touch examples in MCUFRIEND_kbv

It is more intuitive to map TS_LEFT TS_RT to the appropriate pixel coordinates 0, tft.width()
and TS_TOP, TS_BOT to pixel coordinates 0, tft.height()

Yes, your expressions "work". But they make my head hurt.
A Gallic brain might be more robust.


If it gives you a headache, imagine for us poor Belgian..francophone.

[pre]I forgot to put in solution the new parameters which give the headache, here they are


#define TS_MINX 907
#define TS_MAXX 136
#define TS_MINY 942
#define TS_MAXY 139

I had 4 or 5 red 9486 screens whose touch didn't work before and now they also work ... miracle: D

Google Translate says:

I had 4 or 5 red 9486 screens whose touch didn't work before and now they also work ... miracle: D

If you ran the Calibration sketch you would see that some Panels have X, Y pins that are different. Have different directions, ...

I still feel that TS_LEFT and TS_RT are easier to understand than TS_MINX, TS_MAXX
You might prefer TS_GAUCHE and TS_DROIT


[color=#202124]but what does "TS" mean? I understand their uses but not the abbreviation[/color]

I just assume that TS_ means TouchScreen and you typically call the object ts e.g. ts.getPoint()
and TP_ means TouchPoint and you call the object tp e.g. TSPoint tp = ts.getPoint();

It is TS_LEFT and TS_RIGHT that seem sensible names.


[color=#202124]Yes indeed it is clearer, sometimes the programmers like to complicate the "simple" things. :) [/color]

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