Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A pic18f1220 and a clear tube led fader

Status
Not open for further replies.

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
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
have fun
:D
**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]
 
Which Basic compiler did you use?

Pretty cool, the 3D cube fellow could start here.

Maybe a couple lens in the tube to send the light all the way around?

I have a couple sticks (4) that go under a car that came with no controller. I friend picked them up at a yard sale. This might inspire me to dig them out. Was going to put them under my sons golf cart and light them up red for night use.
 
It will glow all the way but for some reason it doesn't show up well when you video it. And it can make any color you want. I posted it with just the red and smaller tube that i had heat shrink tubing that hid the leds and the whole tube glowed in that video. I was going to do the same with this tube when I get some bigger shrink tubing. I use swordfish basic. you can see it with the red only
ledlite-jpg.27904
 
Last edited:
Maybe a camera thing, I thought it was because it was the tube in a circle shape rather than straight.

Still pretty slick. I figure swordfish since it was a 18f project :) But figured
new people would want to know and build one.
 
I put the shrink tubing on it I didn't have any 3/4 when I made it. It lites as good as the one I tryed with the red leds but if you keep the tube strait it way brighter. it puts out
15000 mcd. That's the average light output. I think this tube is just a little too clear.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top