![]() |
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!!! :] |
Re: Digital Inputs + Auton?
It might be a physical connection issue. How exactly is your switch wired?
|
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!) |
Re: Digital Inputs + Auton?
Quote:
|
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.
|
Re: Digital Inputs + Auton?
1 Attachment(s)
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) :] |
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 |
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 |
Re: Digital Inputs + Auton?
Quote:
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. |
Re: Digital Inputs + Auton?
Quote:
|
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!!!!!!! :] |
Re: Digital Inputs + Auton?
Quote:
We were getting bad data at times. |
Re: Digital Inputs + Auton?
Quote:
|
Re: Digital Inputs + Auton?
Quote:
|
| All times are GMT -5. The time now is 02:27. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi