Looking forward to see your results, it would be very useful.
Looking forward to see your results, it would be very useful.
Dave
Always wear safety glasses while programming.
Mackrackit,
I tested this idea with a red-green 10 LED bargraph and yes it works. The setup is different from what we have been discussing in this thread, but the idea of getting a new color (yellow) is the same.
First, I applied a square wave to the circuit with a period of 1.2 seconds and you can see how the color changes between red and green. Next, I applied a square wave with a period of 2 milliseconds per cycle (50% duty cycle) and all you see is a yellow color. Also, If you change the percentage of the duty cycle you get different tones of yellow. This would be very useful for a project like the sliding doors.
Robert
COOOL!!!!!
I can think of several places where that will come in handy.
Looks like it would make a good article for the wiki. Add a bit of code and schematic for basic use....
Dave
Always wear safety glasses while programming.
Tried this on my Breadboard, works a treat.
Hmmm....have to work out how to ad a JPG to this...
BRB
Ah, there it is, I hope. I know it means 2 extra LEDs, but that's gotta be cheaper than changing the PIC or messing around with the power supply.
With the pin as an input, the 5 volt rail is not enough to turn on any of the leds, but setting the pin Hi or Lo the voltage is enough to turn on 2 of them. Also no current drawn during the Input stage.
Last edited by muddy0409; - 18th July 2010 at 10:39.
Peter Moritz.
Up the bush, Western Plains,
New South Wales,
Australia.
Jumper,
What does the rest of your circuit look like?
Regards, Mike
Ok.
I attached the schematics to this post. The code is pretty simple. It uses only one pin in the PIC to create four states in the red-green LED. You can get Red, Green, Yellow, or the Off state in the LED using only one pin. Of course, for getting the last state (Off) all the credit goes to mackrackit. He figured that one out.
Code:START: HIGH PORTB.0 'Turn on red light PAUSE 2000 LOW PORTB.0 'Turn on green light PAUSE 2000 FOR I = 1 TO 2000 'Obtain a yellow light TOGGLE PORTB.0 PAUSE 1 NEXT I TRISB.0 = 1 'Turn off LED PAUSE 2000 GOTO START![]()
I vote for Muddy0409's except, I would put a resistor in series with the processor output lead to limit the output current. This is exactly what I would have proposed except I would have used a couple of zeners instead of the extra led in each leg... If you have an extra inverter available you could modulate one side of a bidirectional led (red/green) and connect the other side thru a resistor to the processor output pin and then place it either high or low and finally to an input state to shut it off.....
Dave Purola,
N8NTA
Referring to the attachment 2 posts above,
Am I just missing something? by my calcs, assuming 2V drop for the LED's the current would be 3/10000 = .3mA.
Will this be enough to light the LED? By my calcs, I would think 150-200 ohms would be more suitable. Any help to clear this up for me?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
I don't think the attachment 2 posts above will do any good with 10k resistors.
I had actually started making a flash demo for this when it first started, but with so many options it got too complicated.
I really think the correct theory is in the link from post #13 though. The link is also in the flash below ... under the title. (batsocks.co.uk/ ....)
I only made it through simulating +5V. Things are clickable in the image below ... try it.
At +5V the resistor is 100 ohms (with 2 diodes).
But if your situation is different, perhaps I can add to it. ...
<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="723" HEIGHT="800" ><PARAM NAME="MOVIE" VALUE="http://www.pbpgroup.com/files/2LED/2LEDS_1PIN.swf"><PARAM NAME="PLAY" VALUE="true"><PARAM NAME="LOOP" VALUE="truSe"><PARAM NAME="QUALITY" VALUE="high"><EMBED SRC="http://www.pbpgroup.com/files/2LED/2LEDS_1PIN.swf" WIDTH="723" HEIGHT="800" PLAY="true" LOOP="true" WMODE="opaque" QUALITY="high" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>
Oh, it says I attached the .dsn file ... I didn't, cause it wasn't done.
But if you have Proteus, I will make it work for all conditions ...
DT
Thanks Darrel. That is an awesome gadget. Is there any way to get you to replace d2 and d3 with variable resistors (or fixed if need be) and bypass the 200 ohm on the pin? This way it will be closer to the other circuit. I would love to test it (and yes, I am trying to use your sim instead of my breadboard) I think a more approiate value would be 0-1000 ohms. If not, its all good.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks