Code issue with a flashing light(simple question)


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    26

    Default Code issue with a flashing light(simple question)

    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?
    Code:
    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
    Last edited by IAmTheAnswer; - 8th May 2010 at 07:08.

  2. #2
    Join Date
    Mar 2010
    Location
    Minnesota, USA
    Posts
    41


    Did you find this post helpful? Yes | No

    Default

    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.

  3. #3
    Join Date
    May 2010
    Posts
    26


    Did you find this post helpful? Yes | No

    Default

    Yes, you can leave that out.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts