|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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? Last edited by Bongle : 23-01-2009 at 08:46. |
|
#2
|
|||||
|
|||||
|
Re: Digital Outputs on the Driver Station with C/C++
Plug them into the Digital OUTPUTS
![]() I'm sure you just called them "inputs" by mistake. Last edited by Mark McLeod : 23-01-2009 at 08:47. |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 23-01-2009 at 10:47. |
|
#5
|
|||||
|
|||||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
||||
|
||||
|
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... |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using driver station digital inputs | Japper | FRC Control System | 6 | 19-01-2009 20:01 |
| Flashing Driver Station Digital Input | MacGyver1718 | FRC Control System | 3 | 15-01-2009 19:22 |
| Timing with the Driver Station | Zorkinian | Programming | 6 | 10-01-2009 09:42 |
| Help with updating firmware on Driver Station | urg8rb8 | FRC Control System | 3 | 28-12-2008 02:53 |
| Interrupt on driver station digital input | Nameless | Programming | 9 | 04-12-2008 16:55 |