Old Yesterday, 10:27 PM   #81
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,444
Default

Quote:
Originally Posted by fundorin View Post
Is it possible to use timers for detecting momentary and toggle presses of the single button? Couldn't find anything realted in the manual.
The "@timer" event service routine is called 100 times a second. Here you can count time.

set a counter to a timeout constant to start the timer and do

Code:
@timer
counter ? (
  counter -= 1;
  !counter ? (
    //do some action 
  );
);
I used such for detecting long vs short button pressing in JSFX. Here instead of @timer, @block is to be used.

-Michael
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old Today, 06:25 AM   #82
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 166
Default

Quote:
Originally Posted by mschnell View Post
set a counter to a timeout constant to start the timer and do
I did the same timing tricks when programming Arduino. Thought that EEL2 allowed more interesting methods.

Seems like the best way would be to adapt those Arduino tricks to EEL2 timer function for my needs. Thanks.

Another noob question: how to convert variables into strings to be able to print them to the log? In short, any type of data into one another. I found sprintf function but without small examples in the manual it's hard for me to understand how to use it.

Last edited by fundorin; Today at 06:40 AM.
fundorin is offline   Reply With Quote
Old Today, 06:52 AM   #83
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 3,444
Default

EEL only has two types of data: Floating point ans string.

to print a string variable in printf you would use %s, real variable are formatted according to the format specifier such a %i or %f.

-Michael
__________________
www.boa-sorte.de
mschnell is online now   Reply With Quote
Old Today, 06:54 AM   #84
fundorin
Human being with feelings
 
fundorin's Avatar
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 166
Default

Do we have switch/break function analog in EEL2?
No mention in the manual about it either.

P.S. I miss Lua. 😢
fundorin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.