Open therafman opened 10 years ago
Hello,
Thanks for your note, and your kind words.
The problem you are running into is caused by the limitation that background macros can’t take arguments.
The workaround is to make a “trampoline function” with no arguments to call your function with arguments, and run the trampoline:
function t13 {toggle(13)}
run t13, 200
Does that help?
-br
On May 4, 2014, at 11:33 PM, therafman notifications@github.com wrote:
Hello,
just wanted to thank you for making bitlash available, I can see it has a lot of potential. I have a question about using arguments in the called function: I am trying to create a function that passes the pin number to blink an LED. This function works on the command prompt: function toggle {x = dr(arg(1)); dw(arg(1),!x);} However I cannot run it in the background, I receive this error message:
run toggle(13),200
-------------------^ unexpected number
I tried passing two arguments including one for a delay like this: function toggle {x = dr(arg(1)); dw(arg(1),!x); snooze(arg(2));} but no change...
I tried to look up any info but came up empty. Any ideas?
— Reply to this email directly or view it on GitHub.
Thank you for the prompt reply Bill. Unfortunately it looks like it won't work, but that's OK... I was just testing it for an idea I had and I can get around it by offloading that work to the external PC.
Thank you again, ciao for now.
Hello,
just wanted to thank you for making bitlash available, I can see it has a lot of potential. I have a question about using arguments in the called function: I am trying to create a function that passes the pin number to blink an LED.
This function works on the command prompt: function toggle {x = dr(arg(1)); dw(arg(1),!x);}
However I cannot run it in the background, I receive this error message:
run toggle(13),200 -------------------^ unexpected number
I tried passing two arguments including one for a delay like this: function toggle {x = dr(arg(1)); dw(arg(1),!x); snooze(arg(2));} but no change...
I tried to look up any info but came up empty. Any ideas?