PDA

View Full Version : Code issue with a flashing light(simple question)



IAmTheAnswer
- 8th May 2010, 06:42
I want a led to gradually have shorter light flashes towards the end. All in all it should take 21 minutes. Pushing the switch once should lead to pause. Pushing it again should continue.
Starting the code from the get-go without pushing any button, the led flashes once, only. Do you know why?


pos = 1
counter = 1260
while pos < counter
pos = pos + 1
LED = 1
time = ((-851 * pos)/counter)+1003
Pause time
LED = 0
Pause 1000-time
if switch = pushed then
Pause 100
WHILE switch = unpushed
WEND
Pause 100
endIF
Wend

wolwil
- 8th May 2010, 06:59
WHILE switch = unpushed
WEND


This to me sounds like it is staying inside that loop until the switch is pressed

EDIT: nevermind I missed the IF Then Statement.

IAmTheAnswer
- 8th May 2010, 11:46
Yes, you can leave that out.