Go Down

Topic: understanding touchLib.h (Read 2 times) previous topic - next topic

KevinT

Hi,
since there is an easy-to-use library for my touch-display I looked forward to design my own menu.

nice video here, too
http://www.mafu-foto.de/elektronik/arduino/98-touch-library-fuer-arduino-und-watterott-mi0283qt-2-display

Now I tried to customize a bit further than just modifying the buttons. It seems like the touch.buttonAdd()-function has to be called from the setup. Could it be, that there is no way to call it from a function?

Could someone help me reading this short-code? It has just a lot of arrows in there...
http://www.mafu-foto.de/download/elektronik/arduino/libraries/TouchLib_v0.1.zip

Thanks,
Kevin

PaulS

Quote
It seems like the touch.buttonAdd()-function has to be called from the setup.

Why do you think this? Have you tried calling it from another function?

KevinT

yes.

this works:
Code: [Select]

void setup()
{
  touch.buttonAdd(...);
}


this wont:
Code: [Select]

void funct()
{
  touch.buttonAdd(...);
}

void setup()
{
  funct();
}

PaulS

"This doesn't work" doesn't mean anything. You need to do a better job of describing the problem. Does the code fail to compile? Does the code compile, but the function doesn't get called? Does the code compile and the function gets called, but doesn't appear to add a button to the screen? Does the button get added but not look right?

If the code compiles, and the function gets called, but the button does not appear, you need to post all of your real code.

KevinT

sorry for the bad description.

I started with the given example. It works fine and does what it should do displaying buttons which can be pressed correctly.

Then I tried to "outsource" a single buttonAdd-Line in a separate function.
Compiling gives no error, but the display keeps black. As I do not understand the touchLib.h-code it is really hard for me to do some systematic troubleshooting.

Go Up