PDA

View Full Version : LED PWN dimming help:..



KapteinFredrik (norway)
03-13-2010, 08:04 AM
Hi. Last night i made a LED light box something........It has 9 small "rooms" with LEds in. Therefore I need a way to program it..... Now i use pin 8-15 with binary codes. How do i dim/fade(PWN?) the leds in and out to make different pattern?

Sorry for my english..

Kaptein Fredrik

$WMc%
03-13-2010, 12:47 PM
KapteinFredrik

What stamp are you using?

This isn't hard to do.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___$WMc%___······················ ······ BoogerWoods, FL. USA

KapteinFredrik (norway)
03-13-2010, 04:13 PM
I use a bs2.

NWCCTV
03-25-2010, 12:59 PM
Did you ever get this figured out? If so, what did you do, as I have a similar issue. Thanks

KapteinFredrik (norway)
03-26-2010, 01:29 AM
How does i PWN my basic stamp2 with a led? Is PWN some sort of dimming?

KapteinFredrik

Post Edited (KapteinFredrik (norway)) : 3/25/2010 5:36:22 PM GMT

Spiral_72
03-26-2010, 01:55 AM
PWM = Pulse Width Modulation

You'll have to get Wikipedia to explain it, but by varying the amount of time you turn ON the LED, you can dim the light.

Look at your Basic manual v2.2, page 347 gives the description of PULSOUT:

PULSOUT Pin, Duration
Function
Generate a pulse on Pin with a width of Duration.
• Pin is a variable/constant/expression (0 – 15) that specifies the I/O
pin to use. This pin will be set to output mode.
• Duration is a variable/constant/expression (0 – 65535) that specifies
the duration of the pulse. The unit of time for Duration is described
in Table 5.84.

There's a table in there as well.


So you'd:

main:
PULSEOUT pin, and some duration
PAUSE 16
GOTO main


pin = whatever output your LED is on
duration = length of time the output is HIGH
PAUSE 16 = do nothing for 16ms.... This command sets your frequency or how many times a second we do the PULSOUT


You'll need to play with the values of PAUSE and duration, but that's about it!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"puff"...... crap, there went another one.

KapteinFredrik (norway)
03-26-2010, 03:06 AM
And if I have two buttons and one LED. One button dim the led down slowly, then the other dim it up slowely. How do i write a code to make it do that?

PJ Allen
03-26-2010, 03:11 AM
What have you tried so far?

Time for spoon-feeding?· OK, open wide -- http://forums.parallax.com/showthread.php?p=850777

Spiral_72
03-26-2010, 03:21 AM
PJ Allen said...
What have you tried so far?

Time for spoon-feeding? OK, open wide -- http://forums.parallax.com/showthread.php?p=850777



OOOOOOoooooo. lovely! VERY NICE!

I'll stag your code. Ya' never know when it might be useful in..... I dunno, writing an article for Nuts & Volts :)

Just kidding.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"puff"...... crap, there went another one.

KapteinFredrik (norway)
03-26-2010, 03:25 AM
I have tried some led's with HIGH/LOW code

How do i program it with some LED's to make a "dragontail"

And how do i program it to do www.youtube.com/watch?v=OUpNYQgWRtM&NR=1 (http://www.youtube.com/watch?v=OUpNYQgWRtM&NR=1)

How do i program it with some LEDs to make a Dragontail www.youtube.com/watch?v=uGqwblE0MGY&feature=related (http://www.youtube.com/watch?v=uGqwblE0MGY&feature=related)

PJ Allen
03-26-2010, 06:48 AM
Open your eyes, it's all there in the links; I'm not making any kits.


Post Edit:

In case you missed the hotlink/s -- http://forums.parallax.com/showthread.php?p=778772

Humanoido
03-26-2010, 11:44 PM
Look up the Penguin red led. It can blink and fade. Program provided.
Modify to set any LED brightness. Uses PWM Pulse Width Modulation.
No dropping resistor used.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
humanoido
*Stamp SEED Supercomputer (http://forums.parallax.com/showthread.php?p=817126)*Basic Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=765140)*TriCore Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=822511)
*Minuscule Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=821451) *Tiny Stamp Supercomputer *Penguin with 12 Brains (http://forums.parallax.com/showthread.php?p=765509)
*BASIC Stamp Supercomputing Book (http://forums.parallax.com/showthread.php?p=841541)*Three Dimensional Computer (http://forums.parallax.com/showthread.php?p=799604) *StampOne News! (http://forums.parallax.com/showthread.php?p=798852)
*Penguin Tech (http://forums.parallax.com/showthread.php?p=770232) *Penguin Robot Society (http://www.p-robot.com/) *Toddler Humanoid Robot Project
*Ultimate List Prop Languages (http://forums.parallax.com/showthread.php?p=809630) *Prop-a-Lot (http://forums.parallax.com/showthread.php?p=886000) *Propalot Stuff (http://forums.parallax.com/showthread.php?p=890215) *Prop SC Computer
*Prop IB Hypercomputer - under development *Hobby Space Program

kf4ixm
03-27-2010, 12:55 AM
Also, you can only fade an led one at a time on the basic stamp using the pwm command, i found this out the hard way trying to randomize pwm commands to an rgb led to produce smooth varying random colors. needless to say i did not accoplish what i'd hoped for.

KapteinFredrik (norway)
03-27-2010, 05:57 AM
What is Penguin red led?

Humanoido
03-28-2010, 05:56 PM
Read the issue of Penguin Tech.
The article about a red LED on a penguin robot has code and circuit to do what you want.

humanoido

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
humanoido
*Stamp SEED Supercomputer (http://forums.parallax.com/showthread.php?p=817126)*Basic Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=765140)*TriCore Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=822511)
*Minuscule Stamp Supercomputer (http://forums.parallax.com/showthread.php?p=821451) *Tiny Stamp Supercomputer *Penguin with 12 Brains (http://forums.parallax.com/showthread.php?p=765509)
*BASIC Stamp Supercomputing Book (http://forums.parallax.com/showthread.php?p=841541)*Three Dimensional Computer (http://forums.parallax.com/showthread.php?p=799604) *StampOne News! (http://forums.parallax.com/showthread.php?p=798852)
*Penguin Tech (http://forums.parallax.com/showthread.php?p=770232) *Penguin Robot Society (http://www.p-robot.com/) *Toddler Humanoid Robot Project
*Ultimate List Prop Languages (http://forums.parallax.com/showthread.php?p=809630) *Prop-a-Lot (http://forums.parallax.com/showthread.php?p=886000) *Propalot Stuff (http://forums.parallax.com/showthread.php?p=890215) *Prop SC Computer
*Prop IB Hypercomputer - under development *Hobby Space Program