Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

what is the alternative of delay(1500); in mongoose os and how can i use timer.set in mongoose os

kleverthingskleverthings india
edited July 2017 in Mongoose OS

this is how i did it in arduino

analogWrite(pin1,1023);
digitalWrite(pin2,HIGH);

delay(1500);

analogWrite(pin1,0);
digitalWrite(pin2,LOW);

how do i write the same code in js for mongoose os ?

i want pin1 which is digital output to be low for 1000 ms and then high till the state.on changes

i tried using timer.set in mongoose os
pin2 is analog

function valveOC(){

if (state.on === false){

Timer.set(1000, false, function () {

GPIO.write(pin1, 0);

PWM.set(pin2, 50, 100);

print(value ? 'Tick' : 'Tock');
},null);

}

if (state.on === false){
Timer.set(1000, false, function() {

GPIO.write(pin1, 1);
PWM.set(pin2, 50, 100);

}, null);

}
}
/

Comments

Sign In or Register to comment.