![]() |
Relay/Spike Problems?
I have some code to turn on a spike that is connected to a compressor, and I can turn it on but not off, so I made a second button running a command to turn it off. Problem is, when I added the second command, nothing happens. If I comment it out, It works fine.
Code:
public class OI {Code:
public class OI {Any Ideas? |
Re: Relay/Spike Problems?
Please post your SpikeOn and SpikeOff commands.
|
Re: Relay/Spike Problems?
Quote:
What happens if you swap the SpikeOn() and SpikeOff() lines? |
Re: Relay/Spike Problems?
SpikeOn:
Code:
/*Code:
/*Code:
/* |
Re: Relay/Spike Problems?
Ether, When I press both buttons nothing happens, but I can't test swapping the code right now...
|
Re: Relay/Spike Problems?
You're creating your Spike Subsystem in both of your commands. This is creating a relay object twice, both referencing the same hardware relay port. The second instance is throwing an exception. I suspect if you scroll up in the output window you will see a stack trace.
You should create a static instance of your subsystem in commandbase, and then reference the subsystem in your commands (without creating new objects). |
Re: Relay/Spike Problems?
Thanks!
|
Re: Relay/Spike Problems?
Using Robot Builder makes it easier to avoid these types of errors, because it will will create all the objects for you in the correct places.
http://wpilib.screenstepslive.com/s/3120/m/7882 |
| All times are GMT -5. The time now is 07:43 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi