Hey guys, I'm back again needing more help. For those that don't know me, I am primarily a modeler. I got into hobby electronics because I wanted to add some lighting effects to some of my models. I am currently building this huge 1/350 scale model of the starship enterprise. It is the "refit" enterprise from the first star trek movie released in 1979. This thing is 34" long when fully assembled. It is actually designed for lighting. I have a program that Hippy helped me with about 12 years ago. I'm wanting to add another little feature to it, but I can't figure out how to go about it. Here is the part of the original code that's relevant without the feature added. The rest of the code is not at all related to my problem. This code (under Deflector) controls a bluee/yellow bicolored LED. At the first push of the button the LED ramps up in Yellow. The second button push ramps up the Blue, then fades out the yellow, giving it the appearance that its morphing from yellow to blue. The third press of the button fades off the Blue LED, then it's resets the variable and loops.
Here is the modified code I attempted to make, I have 6 outputs going high at 1 second intervals, then the bi-colored LED ramps up in yellow. I'm wanting to sort of recreate a scene in the movie when the ship first powers up getting ready to leave the space dock. I even have a sound module that plays the music from that scene while it's powering up.
What I'm really wanting to achieve, is, at the first button press, is to have all the spot lights (the 6 outputs) come on in 1 second intervals, then the yellow side of the LED ramps up (the deflector dish), then with every subsequent button press the LED alternates between blue and yellow, the blue /yellow bi-colored LED and the spotlights stay on for as long as the circuit is powered up. I know how to design the circuit board using a program called KiCad, then upload the design to a company online that will make the boards for me. All I need is the proper code to achieve what I'm wanting. Any help someone can give me with this would be greatly appreciated. Thank you very much in advance.
Code:
#Picaxe 14M2 USS Enterprise NCC-1701 Lighting FX
Symbol switchA = pinC.4
Symbol switchB = pinC.3
Symbol buttonA = b0
Symbol ButtonB = b1
Symbol pwmA = w1
Symbol pwmB = w2
; ====== Button Handler ===================
Start0:
Do
If switchA = 1 Then : Resume 1 : End If
If switchB = 1 Then : Resume 2 : End If
Pause 50
Loop
; ====== Deflector ========================
Start1:
Do
Suspend 1
buttonA = buttonA + 1
Select Case buttonA
Case 1
PwmOut PWMDIV4, C.0, 99, 0
For pwmA = 0 To 400
PwmDuty C.0, pwmA
Pause 2
Next
Case 2
PwmOut PWMDIV4, C.2, 99, 0
For pwmA = 0 To 400
PwmDuty C.2, pwmA
Pause 2
Next
For pwmA = 400 To 0 Step -1
PwmDuty C.0, pwmA
Pause 2
Next
PwmDuty C.0, 0
Case 3
For pwmA = 400 To 0 Step -1
PwmDuty C.2, pwmA
Pause 2
Next
PwmDuty C.2, 0
buttonA = 0
End Select
Loop
Here is the modified code I attempted to make, I have 6 outputs going high at 1 second intervals, then the bi-colored LED ramps up in yellow. I'm wanting to sort of recreate a scene in the movie when the ship first powers up getting ready to leave the space dock. I even have a sound module that plays the music from that scene while it's powering up.
Code:
#Picaxe 20M2 08M2 Enterprise Refit Lighting FX
Symbol switchA = pinC.7
Symbol switchB = pinC.6
Symbol buttonA = b0
Symbol ButtonB = b1
Symbol pwmA = w1
Symbol pwmB = w2
; ====== Button Handler ===================
Start0:
Do
If switchA = 1 Then : Resume 1 : End If
If switchB = 1 Then : Resume 2 : End If
Pause 50
Loop
; ====== POWER-UP ========================
Start1:
Do
Suspend 1
buttonA = buttonA + 1
Select Case buttonA
Case 1
High C.0
Pause 1000
High C.1
Pause 1000
High C.4
Pause 1000
High B.5
Pause 1000
High B.6
Pause 1000
High B.7
Pause 1000
PwmOut PWMDIV4, C.2, 99, 0
For pwmA = 0 To 400
PwmDuty C.2, pwmA
Pause 2
Next
Case 2
PwmOut PWMDIV4, C.3, 99, 0
For pwmA = 0 To 400
PwmDuty C.3, pwmA
Pause 2
Next
For pwmA = 400 To 0 Step -1
PwmDuty C.2, pwmA
Pause 2
Next
PwmDuty C.2, 0
Case 3
For pwmA = 0 To 400
PwmDuty C.2, pwmA
Pause 2
Next
For pwmA = 400 To 0 Step -1
PwmDuty C.3, pwmA
Pause 2
Next
PwmDuty C.3, 0
buttonA = 0
End Select
loop
What I'm really wanting to achieve, is, at the first button press, is to have all the spot lights (the 6 outputs) come on in 1 second intervals, then the yellow side of the LED ramps up (the deflector dish), then with every subsequent button press the LED alternates between blue and yellow, the blue /yellow bi-colored LED and the spotlights stay on for as long as the circuit is powered up. I know how to design the circuit board using a program called KiCad, then upload the design to a company online that will make the boards for me. All I need is the proper code to achieve what I'm wanting. Any help someone can give me with this would be greatly appreciated. Thank you very much in advance.