I have a circuit working that basically flashes LED's in different sequences and then turns all LED's off upon button presses. It works good but what I'd like to do is add a sequence that instead of the LED's simply turning off, they fade out so as to look sort of like a "comet tail".
I'm using a PIC 12F675 and the code is below. If I could just be pointed in the right direction to know where to start I may be able to figure it out.
Thanks for any "pointing"
Code:
ANSEL=0
CMCON=7
Input GPIO.5
Low GPIO.0
Low GPIO.1
Low GPIO.2
Low GPIO.4
loop:
IF GPIO.5 = 0 Then
Pause 500
GoSub pressI:
EndIF
GoTo loop
pressI:
High GPIO.0
Pause 50
Low GPIO.0
Pause 50
High GPIO.0
Pause 50
Low GPIO.0
Pause 50
High GPIO.1
Pause 50
Low GPIO.1
Pause 50
High GPIO.1
Pause 50
Low GPIO.1
Pause 50
High GPIO.2
Pause 50
Low GPIO.2
Pause 50
High GPIO.2
Pause 50
Low GPIO.2
Pause 50
IF GPIO.5 = 0 Then
Pause 500
GoSub pressII:
EndIF
GoTo pressI
pressII:
High GPIO.0
Pause 75
Low GPIO.0
Pause 75
High GPIO.1
Pause 75
Low GPIO.1
Pause 75
High GPIO.2
Pause 75
Low GPIO.2
Pause 95
High GPIO.2
Pause 75
Low GPIO.2
Pause 75
High GPIO.1
Pause 75
Low GPIO.1
Pause 75
High GPIO.0
Pause 75
Low GPIO.0
Pause 95
IF GPIO.5 = 0 Then
Pause 500
GoSub pressIII:
EndIF
GoTo pressII
pressIII:
High GPIO.2
Pause 75
Low GPIO.2
Pause 75
High GPIO.1
Pause 75
Low GPIO.1
Pause 75
High GPIO.0
Pause 75
Low GPIO.0
Pause 95
IF GPIO.5 = 0 Then
Pause 500
GoSub pressIIII:
EndIF
GoTo pressIII
pressIIII:
High GPIO.4
Pause 5
Low GPIO.4
Pause 5
IF GPIO.5 = 0 Then
Pause 500
GoSub strobe:
EndIF
GoTo pressIIII
strobe:
High GPIO.4
Pause 25
Low GPIO.4
Pause 25
High GPIO.4
Pause 25
Low GPIO.4
Pause 25
High GPIO.4
Pause 25
Low GPIO.4
Pause 25
High GPIO.4
Pause 25
Low GPIO.4
Pause 1000
IF GPIO.5 = 0 Then
Pause 500
GoSub loop:
EndIF
GoTo strobe
Bookmarks