well guys what im trying to get is a continiuous loop to make my led's flash,thats easy but i dont know how to make that loop last a set time e.g 3 seconds.I can get the desired effect by repeating a simple code but there must be a better way.The code follows.
The answer is in my post. You need a loop, I used a FOR... NEXT loop. You don't really need to use PULSOUT. You can, but I used TOGGLE. This is a little simpler and more clear. Try it.
Number_of_Loops VAR BYTE
'30 loops x 100 millisecs = 3 secs (well, there's some code overhead, but it's close)
FOR Number_of_Loops = 1 to 30 'number of times to loop
TOGGLE 1 'pin 1 high one time, low the next time
PAUSE 100 'delay in millisecs before next time through the loop (flash rate of LED)
NEXT
Comments
FOR SomeNumber = 1 To 60
HIGH 1
PAUSE 500
LOW 1
PAUSE 500
NEXT[/HTML]
Blinks an LED on Pin 1 once a second for 60 secs (approximately).
Is that what you meant by "a set period of time"?
PULSOUT 1, 40000
PULSOUT 10, 40000
PAUSE 200
PULSOUT 1, 40000
PULSOUT 10, 40000
PAUSE 200
PULSOUT 1, 40000
PULSOUT 10, 40000
PAUSE 200
PULSOUT 1, 40000
PULSOUT 10, 40000