|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Digital Inputs + Auton?
Hey,
I was trying to get different autons based on switches, and the code is as follows (example): Quote:
Quote:
THANK YOU!!! ![]() |
|
#2
|
|||||
|
|||||
|
Re: Digital Inputs + Auton?
It might be a physical connection issue. How exactly is your switch wired?
|
|
#3
|
||||
|
||||
|
Re: Digital Inputs + Auton?
Switch 1 is getting plugged in to positive-negative end signal; the other six are only getting signal because all switches are grounded together. However, the only switch used in the code is switch1
(Thank you by the way!) Last edited by Straberrie : 10-02-2009 at 15:40. |
|
#4
|
|||||
|
|||||
|
Re: Digital Inputs + Auton?
I don't understand that description. Can you give specific details about where each of the Digital Input's pins is connected, and what kind of switch you are using?
|
|
#5
|
||||
|
||||
|
Re: Digital Inputs + Auton?
To Alan Anderson: I attached pictures of the switches. (Thanks)
To BoyDean: I am not aware of that (sorry), but I will try it with prints. (Thanks) ![]() |
|
#6
|
||||
|
||||
|
Re: Digital Inputs + Auton?
looks like you wired it sideways on the DSC
you have it like this ******** ******** *****000 when it should be like this *****0 *****0 *****0 |
|
#7
|
||||
|
||||
|
Re: Digital Inputs + Auton?
Rebecca,
For the most part, your switches look good. I assume (the connection is slightly off picture) that the commons on the switches are tied to ground (to the black wire on the PWM cable in the SW1 position). Byteit101's comment is not appropriate and your wiring should work. The resistors referenced by Brandon are 10K pull-ups and are internal to the sidecar (schematic). You do not need to add more. Other than something very weird such as a bad DS or the DS not getting power, I would concentrate on software. Unfortunately, my team is using Labview and I have not played with this year's C++ at all... Good Luck, Mike Last edited by Mike Betts : 10-02-2009 at 22:23. |
|
#8
|
||||
|
||||
|
Re: Digital Inputs + Auton?
Quote:
We were getting bad data at times. |
|
#9
|
|||||
|
|||||
|
Re: Digital Inputs + Auton?
No. The Driver Station digital inputs are floating, and any required pullup (or pulldown) must be supplied externally.
|
|
#10
|
||||
|
||||
|
Re: Digital Inputs + Auton?
I assume we would use 10k resistors.
|
|
#11
|
|||||
|
|||||
|
Re: Digital Inputs + Auton?
Nope. It's hard to decode, but it looks as though those horizontal cables are all signal wires. There's one cable that connects to the ground and 5v like we are used to seeing, and then the rest of the cables are the signal wires for the rest of the switches. There is a unified ground; this is a conservative design.
Assuming everything is wired properly, when the switch is CLOSED, you will get a ZERO from the digital input, and when it is OPEN, you will get a ONE. I emphasize because it is backwards from common sense. Now, you did mention that the else is never executed, regardless of the state of the switch.
If all else fails, post back here and somebody will help. Jacob edit: AND SEE ALAN'S POST. I neglected to realize this situation; as he says, if you aren't wiring the common wire to ground, you will always see a 1 coming in that input. Thanks, Alan. Last edited by JBotAlan : 11-02-2009 at 01:26. |
|
#12
|
|||||
|
|||||
|
Re: Digital Inputs + Auton?
Heh. The one wire that I really want to know about isn't visible, being just off the right side of the picture of the back of the switches. It should be connected to the ground (black) wire of DIO 1. If you have it going instead to +5 (red), you'll never see any change on the signal input.
|
|
#13
|
||||
|
||||
|
Re: Digital Inputs + Auton?
Thank you everyone!!!!!
One of our mentors found the problem! Apparently it was a loose wire! Which is y switch 1 always had a value of 1! and again, Thank u all very much!!!!!!! ![]() |
|
#14
|
||||
|
||||
|
Re: Digital Inputs + Auton?
Are you using the KoP switch? Print the status of the digital input to see what is coming from the switch. We had some problems with the KoP switch going between on and off really fast when it was off. To fix the problem we connected a resistor to pull the signal down to zero.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital Inputs? | Straberrie | Programming | 4 | 15-02-2009 01:47 |
| Using Interrupts on Digital Inputs | Analog | C/C++ | 6 | 03-02-2009 23:05 |
| Digital Inputs | KRibordy | C/C++ | 5 | 25-01-2009 00:35 |
| Auton digital input | ten3brousone | Programming | 7 | 20-03-2005 22:23 |
| Analog vs Digital inputs? | f22flyboy | Programming | 8 | 08-11-2002 22:18 |