I don't think you understand variable scope, if you're trying to achieve what I think you are (in the future, please describe the intended behavior when you ask for help with code).
Here, I moved the variable declarations out of the functions, so that they will persist between function calls. Both of the functions will now clear the interval and set it to a new value.
var inter1=0;
var l=0;
var l1=0;
var led2=0;
function parpadeo(time)
{
if (inter1) {clearInterval(inter1);}
l = false;
inter1 = setInterval(function() {
l = !l;
C1.write(l);
}, time);
}
parpadeo(200);
function led1(time1)
{
if (led2) {clearInterval(led2);}
l1 = false;
led2 = setInterval(function() {
l1 = !l1;
A1.write(l1);
}, time1);
}
led1(300);
(code not tested, might have typos. But it should work)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I don't think you understand variable scope, if you're trying to achieve what I think you are (in the future, please describe the intended behavior when you ask for help with code).
Here, I moved the variable declarations out of the functions, so that they will persist between function calls. Both of the functions will now clear the interval and set it to a new value.
(code not tested, might have typos. But it should work)