Calculate following the information screen (size) the position and size of the button according to the desired number.
My methodology:
Try '(based on known information (width and screen height, Marge and many key) to create an array int [xligne] [xColonne] not used later to build and display the key and set the value of selection area of the touch function.
My current problem:
My array int [] [] is endless and the data is inconsistent.
(Attached is the personal function file)
Below the main code.
// Liaison à la biblioteque UTFT et les fonctions personnelles #include <UTFT.h> #include <UTouch.h>
// Liaison aux fonctions personnelles #include "Fonctions.C"
What int array? The code uses a char array to hold coordinate values, which is stupid. A char is a signed variable type, with a range of -128 to 127. Your screen is bigger than 127 x 127.
my PrintTableau () function rotates from endless 15min while my for loops
for (row = 0; line <12; ++ online)
for (column = 0; column <4; line ++)
are 12 rows and 4 column !!!
More in the calculations of the function
CalcTouch void (int touch)
the values of the second pass key already in negative !!
The calculations on paper It Works.
On the Arduino Uno (and other ATMega based boards) an int stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
Well thank you all,
I must be tired?
My mistake was on copy paste.
Sorry,
Error 1 :
// Declare variable we will be using int Kb12T[12][4];
int NumMenu;
And error 2
void PrintTableau()
{
int ligne;
int colonne;
int val;
int x=10; //max 310
int y=10; //max 205
for (ligne=0; ligne < 12; ligne++)
{
for (colonne=0; colonne < 4; colonne++)
{
my result and always is not infinite
thank you again for everything.
I still have much to do
my original code is :
void PrintTableau()
{
int ligne;
int colonne;
int val;
int x=10; //max 310
int y=10; //max 205
for (ligne=0; ligne < 12; ligne++)
{ for (colonne=0; colonne < 4; ligne++)
{
if (x>=280) // Button: 8
{
x = 10;
y = y + 10;
}
else if (y>=185) // Button: 8
{
y = 10;
}
else
{
val = Kb12T[ligne][colonne];
myGLCD.print(String(" "), x, y);
myGLCD.printNumI(val, x, y);
x = x + 80;
}
}
}
}
And the correct code is : for (colonne=0; colonne < 4; colonne ++)
the incrementation is colonne no ligne for this loop