![]() |
Digital Outputs on the Driver Station with C/C++
Last night we wired up a bank of LEDs so that we could do real-time debugging without relying on printfs or the debugger (both of which are slow). However, we couldn't get them to actually turn on and off.
If we plug them into the digital outputs with the positive wire to the center pin of the DS digital out and the signal wire to the signal (top) pin of the DS, they'll turn on. Likewise, if we put the signal wire to the ground pin of the DS, they'll turn on that way as well. However, we couldn't get them to turn off programmatically. Inside our operator control loop, we tried: ds->SetDigitalOut(8,false); // turn off digital output 8 (I may have got the function call wrong here, I'm going off memory) We tried that just to see if we could turn them off, and nothing happened. We plugged the light into every single digital output to see if we got the number wrong, but they were all still on. I'm guessing there is some jumper or code setting we have to flip in order for this to work. We read part 3 of the setup manual (which includes specs on the outputs) and couldn't find anything. Can anyone help us? |
Re: Digital Outputs on the Driver Station with C/C++
Quote:
I'm sure you just called them "inputs" by mistake. |
Re: Digital Outputs on the Driver Station with C/C++
Quote:
I should also note that we hooked the LEDs to the robot's digital outputs and had great success with that. But since we want some driver feedback that isn't just a laptop on the dashboard port, we want to use the digital outputs. |
Re: Digital Outputs on the Driver Station with C/C++
I believe you may have to update the dashboard to get this to take effect.
The set outputs have to be transmitted back to the DS as part of the periodic packet transmission and there might be some interdependency there. P.S. I don't know though. I haven't played with this particular path yet. I'll give it a try later if I can. |
Re: Digital Outputs on the Driver Station with C/C++
Quote:
Put the positive wire on the signal pin and the negative wire on the ground pin instead, and you should see the LED light up when you turn the output on. |
Re: Digital Outputs on the Driver Station with C/C++
You should also wire something like a 150 ohm resistor inline to limit the current going through the LED!
Steve C. |
Re: Digital Outputs on the Driver Station with C/C++
Here's how to quickly calculate what resistor you should use for your LED. You will need to know the current consumption of the LED and the forward voltage of the LED (when a diode turns on, it more or less maintains a constant voltage accross itself). The relationship between current, resistance and voltage is defined in Ohm's law, V = IR (where V is voltage, I is current and R is resistance).
Vf = forward voltage of the diode Id = diode current The voltage supplied by the digital I/O port is 5V. Since the diode and resistor are in series, they will have the same current flowing through them. This means that the voltage accross the diode added to the voltage accros the resistor must equal 5 volts. Thus, 5V = Vf + (Id * R). or R = (5V - Vf ) / Id Hope that's a help as well... |
| All times are GMT -5. The time now is 02:42. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi