Id like to manage the buttonpress or release event on an object ie. an image using ST and not the visualization. I found that there is a library for this, cmp3clutter, but i couldnt find out how to use it properly and there is no example of usage anywhere.
If somebody could help me it would be much appreciated.
I was able to do it and i leave the code for someone who might need it.
//Declare global variables to associate with the actions you want the objects to do
buttonenter1 : UDINT;
buttonleave1 : UDINT;
//in the LoopCode you have to associate each variable to the event you want to register
IF pagina<>paginaanterior THEN
//In MyEvents(FUN) you can say to the program what to do each time an event is triggered.
CASE pagina OF
IF event.ID= buttonenter1 THEN
ELSIF event.ID=buttonleave1 THEN
I am unsure what you are trying to do?
Why is "Execute ST Code" not usable for you?
Is not very clear what do you want?
But a simple event press and release with debounce could be as follow:
tmDebounce : TON;
oldState : BOOL;
tmDebounce(IN := buttonState <> oldState, PT := T#50ms);
IF tmDebounce.Q THEN
oldState := buttonState;
IF buttonState THEN
Functions, or if you prefer methods or actions are called only once after debounce time on falling or rising edges.
Log in to post a comment.