Go Down

### Topic: utouch ssd1963 5 inch problem (Read 21630 times)previous topic - next topic

#### nonamejohn

#15
##### May 10, 2013, 10:36 pm
I Hope You Can Help i know alot have The same problem

#### guix

#16
##### May 10, 2013, 10:56 pm
Maybe orientation problem, try change
Code: [Select]
`#define TOUCH_ORIENTATION  PORTRAIT`
to
Code: [Select]
`#define TOUCH_ORIENTATION  LANDSCAPE`

#### nonamejohn

#17
##### May 10, 2013, 11:04 pm
Its not The orientation the touch library is only scaled for 320x240

#### nonamejohn

#18
##### May 10, 2013, 11:49 pm
What does x,0,0,0,0 mean here wich cordinates so i set where?

Code: [Select]
`  tx = map( X, 0, 3550, 0, 239); // the screen data for X  ty = map( Y, 0, 4860, 0, 319); // the screen data for Y`

#### HazardsMind

#19
##### May 11, 2013, 12:12 am

What does x,0,0,0,0 mean here wich cordinates so i set where?

Code: [Select]
`  tx = map( X, 0, 3550, 0, 239); // the screen data for X  ty = map( Y, 0, 4860, 0, 319); // the screen data for Y`

that is the map function, it works like this.
mapped output = map( your inputted data, lowest value of the data, highest value of data, lowest value you need, highest value you need)
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#20
##### May 11, 2013, 02:02 am
I just updated my sketch in reply #11, try it
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### nonamejohn

#21
##### May 11, 2013, 08:29 am
i got it working but when i move on the screen the number goes from 100 til 990 and then starts from 100 and goes up til 500 on the x axis shouldi take this numer as 1500??

#### HazardsMind

#22
##### May 11, 2013, 04:35 pm
Are you looking at the raw data or mapped data? The thing about maps is, they do not stay in range. meaning if your Highest value is say 500, and the map goes over that, it will give you unwanted results.
they way to fix this is by using a constrain.

constrain(tx, lowest mapped value, highest mapped value);
constrain(ty, lowest mapped value, highest mapped value);
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### nonamejohn

#23
##### May 11, 2013, 10:06 pm
so finaly go it calibratet i think yousing the serial.print funktion but a new problem the x and y axis is invertet:/

#### HazardsMind

#24
##### May 12, 2013, 01:58 amLast Edit: May 12, 2013, 08:21 am by HazardsMind Reason: 1
Post your full code and I'll take a look at it.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### nonamejohn

#25
##### May 12, 2013, 08:42 am
its always been a broblem that the x and y axis whas ivertet no mater what eksamlpe i use from utouch

// UTouch_QuickDraw (C)2010-2012 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a quick demo of how to use the library.
//
// This program requires the UTFT library.
//
// It is assumed that the display module is connected to an
// appropriate shield or that you know how to change the pin
// numbers in the setup.
//

#include <UTFT.h>
#include <UTouch.h>
#define TOUCH_ORIENTATION  LANDSCAPE

// Uncomment the next two lines for the Arduino 2009/UNO
//UTFT        myGLCD(ITDB24D,19,18,17,16);   // Remember to change the model parameter to suit your display module!
//UTouch      myTouch(15,10,14,9,8);

// Uncomment the next two lines for the Arduino Mega
UTFT        myGLCD(SSD1963_800, 38,39,40,41);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch(6,5,4,3,2);
int val;
int tx;
int ty;
void setup()
{
Serial.begin(9600);
myGLCD.InitLCD();
myGLCD.clrScr();

myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
}

void loop()
{
long x, y;
val = (myTouch.dataAvailable() == true);            // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 479, 0, 799);
while (myTouch.dataAvailable() == true)
{
x = myTouch.getX();
y = myTouch.getY();

tx = map( x, 0, 291, 0, 491); // the screen data for X
ty = map( y, 0, 145, 0, 261); // the screen data for Y

{
myGLCD.drawPixel(tx, ty);
}
}
}

#### AWOL

#26
##### May 12, 2013, 08:46 am
Code: [Select]
`val = (myTouch.dataAvailable() == true);    `
That's going to return a very limited range of values, isn't it?
Why bother mapping?

After nearly 40 posts now, do you think you could start using code tags?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### HazardsMind

#27
##### May 12, 2013, 09:38 am
This is not doing anything.
Quote
val = (myTouch.dataAvailable() == true);            // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 479, 0, 799);

Your map looks like you guessed on the numbers, but I'm not surprised because your not printing the data to the LCD like I showed you how to do.

Go back and re-upload the code I gave you, I added more to it from the first time I posted it, and I wrote after that post, that I made changes to it.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### nonamejohn

#28
##### May 12, 2013, 08:28 pmLast Edit: May 12, 2013, 08:39 pm by nonamejohn Reason: 1
how should i take the readings and put them is it like pressing left top orner and putting it in
when i touch top left corner it says

y: 0x000000E6UL
x: 0x000000ABUL

where and how

i dont now how to put in the data

#### JHawk88

#29
##### Jul 24, 2013, 08:49 pm
I hate to bring this back up again.  But I am dealing with the same problem.  I am using those same libraries.  The display only reads an X_touch and Y_touch of 320x240.  So clearly the screen is not mapped properly.  I attempted to use the sketch in reply 11 as suggested seeing as how it was noted that changes have been made to it multiple times.  Nothing appears on my screen.  This, however, is after I declared: long tx and long ty.  The compiler says these were not declared.  Regardless, nothing is happening.  What should I be expecting to see?  How can I fix the mapping?
-------------------ARDUINO-------------------
A Radical Developing Unit In Northern Oklahoma

Go Up