Graphic Posted March 1, 2006 Share Posted March 1, 2006 i'm trying to use the switch to light an LED but the switch has to give pulse to the led and it then should stay on for 15 sec and shutoff by it self. so i was thinking timer. but i read that the only way to make a timer, is to use to seperate variables?? i tried it but it didn't seem to work does anybody know a fast way on how to create one Thnx Link to comment Share on other sites More sharing options...
AzeoTech Posted March 1, 2006 Share Posted March 1, 2006 I'm a little confused want you want, but I believe you want to monitor a digital input and if it goes high (i.e. switch closed) you want to light an LED for 15 seconds by setting a digout high and then low again after 15 seconds. To do this, you'll of course need a digital input and digital output channel. Lets say they are called DigIn and DigOut. 1) In the event for DigIn (click on the "DigIn" in the workspace under CHANNELS: then select the Event tab), put: if ((DigIn[0] == 1) && (DigIn[1] == 0)) beginseq(PulseLED) endif This looks for when the digital signal goes high after being low. 2) Next create a sequence called PulseLED and put: DigOut = 1 // turn on LED delay(15) // wait 15 seconds DigOut = 0 // turn off LED The event will cause this to run when the switch is pressed. If the switch is pressed while the LED is already on nothing additional will happen. Link to comment Share on other sites More sharing options...
Graphic Posted March 1, 2006 Author Share Posted March 1, 2006 yes that was exactly what i wanted. it worked. thnx for the big help an fast reply Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.