be80be
Well-Known Member
I wanted to share how to make a lite show with a clear tube and pic18f1220
maybe some one will want to play with it
have fun

**broken link removed**
The pictures show the tube and leds
**broken link removed**
And a video to see it working
[embed]http://www.youtube.com/v/BT6DrGk3RcM&hl=en&fs=1[/embed]
maybe some one will want to play with it
Code:
Device = 18F1220
Clock = 8
Config OSC = INTIO2
Include "INTOSC8.bas"
Dim ledB As PORTB.7
Dim ledR As PORTB.6
Dim ledG As PORTB.5
Dim Duty As Word
// import PWM module...
Include "PW.bas"
Include "Utils.bas"
Output (ledB)
Output (ledR)
Output (ledG)
High (ledB)
High (ledR)
High (ledG)
// main program...
While true
If PWM.SetFreq(5000) Then
Low (ledB)
Duty = 0
Repeat
PWM.SetDutyPercent(Duty)
Inc(Duty)
DelayMS(10)
Until Duty > 100
Repeat
PWM.SetDutyPercent(Duty)
Dec(Duty)
DelayMS(10)
Until Duty = 0
High (ledB)
EndIf
If PWM.SetFreq(5000) Then
Low (ledR)
Duty = 0
Repeat
PWM.SetDutyPercent(Duty)
Inc(Duty)
DelayMS(10)
Until Duty > 100
Repeat
PWM.SetDutyPercent(Duty)
Dec(Duty)
DelayMS(10)
Until Duty = 0
High (ledR)
EndIf
If PWM.SetFreq(5000) Then
Low (ledG)
Duty = 0
Repeat
PWM.SetDutyPercent(Duty)
Inc(Duty)
DelayMS(10)
Until Duty > 100
Repeat
PWM.SetDutyPercent(Duty)
Dec(Duty)
DelayMS(10)
Until Duty = 0
High (ledG)
EndIf
Wend
**broken link removed**
The pictures show the tube and leds
**broken link removed**
And a video to see it working
[embed]http://www.youtube.com/v/BT6DrGk3RcM&hl=en&fs=1[/embed]