Power Leds?

How can i power leds from the vex micro controller?

I have a simple led and resistor but i have not found a way to power it via programming.

I want these leds to indicate when you have to push the button and release the button for my on board programming unit.

Configure a digital IO port as an output.

Wire the LED such that the positive lead is attached through the resistor to the red wire, and the negative lead to the white port wire. The black wire is not needed.

Writing a 0 to the port will turn the LED on, and writing a 1 will turn it off.


  • Dean

Sweet, i am trying that right now.

You should see what i found out, i have had an hd camera for a while and 10 minutes ago i found out it can function as a high speed camera!

Its sweet, its just like the mythbusters in full hd! Its not going to see a bullet fly but i tossed a cup in the air and it was nice and slow, i also flushed a toilet and poured some water out of a cup and it recorded every drop of water in super slow mo!

Outstanding! What kind of camera is it? I’m considering getting an HD camcorder, but I didn’t know any did high-speed!


  • Dean

Its a sony HDR-SR5 camcorder that we got from dell for $950 plus shipping, it retails $1200 so i would say we got a good deal. Its got a 2 hour battery and a 40gb hard drive for video recording. Its really tiny and i like it but the zoom is bad, and it does not do well in low light. All HD camcorders have less zoom when compared to a standard camcorder and most have fuzzy video in low light.

If you watch my autonomous robot v1.0 on youtube wait until you get to the obstacle course. What you don’t realize in the video is that i had large portable work lights all around the room making the colors very vibrant for the best video quality. It looked fantastic when played on the pc in hd but i had to re-encode it which lost a lot of quality and then youtube re-encoded it into flash so it lost the colors and some more quality. The end result was a video with dull colors that looked alright but if it was in full hd it would have looked a lot better.

But yes the slow motion/high speed feature is cool but it is a lot for the camera to handle. It records so many frames that it has to buffer and it only takes 4 seconds to fill the buffer. This means that you can record 4 seconds of video but its recording at like 60 to 100fps so it would be like 20 -30 seconds long. Its nice if you want to record a specific event on your robot such as an impact with a wall or something like that.

Well i can’t wait to make a youtube video of some of the slow mo video.

That led thing didn’t work but it was probably the led so i will keep trying, plus my micro controller is acting really weird.

Thanks for the details on the camera - I’ll look into it. Makes sense that you’d need a hard drive in it, since MiniDV tape is never gonna keep up with high speed.

You can test the LED by switching the white & black wires. If your controller is on and your resistor is the right value then the LED should light. (Doesn’t need any software to drive it.)

So, to test the LED:
*]White -> No Connection
*]Red -> Resistor -> LED(+)
*]Black -> LED(-)

And to control it via digital out:
*]White -> LED(-)
*]Red -> Resistor -> LED(+)
*]Black -> No Connection

Oh, your resister should be in the neighborhood of 300 ohms, give-or-take depending on the details of your LED.


  • Dean

Yea, i am not sure about the internal wiring but i am using a fully enclosed led module.

Its basically an led thats like a screw and you can mount it in project enclosure which looks really good.

But the resistor and the wiring inside is impossible to see, its really tiny and the casing is dark.

So the resistor could be on either wire i don’t know and the resistor may be much more or less than 300 ohms.

I just found something really cool on the internet, i have the sony SR5 well you should see the new SR12 holy crap. I wish that was out when i bought my camera.

It records up to 240fps lol!

The Digital Outputs of the Vex Controller have a resistor already…

Download the Vex Sensor Test file and look at the enclosed PDF. The LED’s can be directly inserted into the Vex Controller, or you can use the 6" PWM cable to have it more remote.

Sweet built in resistors makes life 1 resistor easier lol!

Thats cool, i never new they were built in so i will have to try this.

So they do… I remembered doing this last year, but now that you jogged my memory, I was just running the LED directly from the power (it was a camera light) and not controlling it via the digital out. Sorry about the bum advice.

The specs for the controller show a 1K series resistor on the I/O pin, which means you are not going to get enough current to drive most LEDs very well, and certainly not any with built-in resistors.

The LEDs at the link MarkO provided are low-current LEDs (7.5ma) which is about the only kind that you will get enough light from to see.

I just ran some experiments, and I could barely get a normal 20ma LED to light on a digital port. I was able to drive it from a motor port reconfigured for digital I/O. It wasn’t blinding, but it was visible in a well-lit room. That only worked with no resistor at all, so I don’t think robofreak is going to be able to directly drive his encased LED unless he adds a transistor to the mix…

  • Dean

Oh, the upcoming Vex PWM->DC convertor might do nicely to drive an LED.

Depending on exactly how it works, you could hook up an LED through a suitable resistor. Or, you could wire up a small incandescent bulb (or relay) with a diode in series.

To program it, you’d just set the pwm value such that 0 is off, and 255 is on. Intermediate values could provide different brightness levels.

Can’t wait to get my hands on one and try all this out!

  • Dean

you bet it will. but one mor thing whare did you buy your led’s?:cool:

Here is what the wires are:

Red (Live) (+5V)
White (signal) (0-5V)- Carries signals: analog and digital voltages and PWM
Black (ground) (0V)

Here is straight from the Vex Sensor Test Procedure pdf:

“LEDs on DIGITAL 13, 14, 15 and 16. Connect
anode on inner contact (signal pin which
is nearest the numbers). Connect Cathode on
outside contact (ground).”

The Anode being the Longer lead on the LED, the Cathode being the Shorter lead on the LED.

If you get Bi-Color (e.g. Red/Green) then they work either way, just a different color…

See LED’s.