![]() |
Enhanced I/O through Cypress
Our team is new to the Enhanced I/O through Cypress. I have done everything to spec in setting it up except one thing; when I tried to load the 2012.hex onto the module it said fail in the lower right hand corner (where it says connected) so I used the 2009.hex and it loaded fine. The DS reconized it and I have full suport on the DS of all the functions that are native.
When I loaded my code onto the robot I am using Cypress to get a button value. Here's where I need help: Initilized: Code:
public class RobotClass extends IterativeRobot {Code:
if (Cypress.getButton(2) ) {Code:
try {Thanks, Skyehawk |
Re: Enhanced I/O through Cypress
Most of the ways that EnhancedIOException gets thrown is because the enhanced IO module isn't plugged in to the driver station computer. You should think about what you want the code to do in that case and put that in the catch block. You probably want to turn the relay off, but you may want to do something else like send status back to the driver station.
If you're not familiar with exceptions, there is a java tutorial about them. http://docs.oracle.com/javase/tutori...al/exceptions/ |
Re: Enhanced I/O through Cypress
I read that page. Interesting stuff, though a little hard to grasp at parts. The I/O was plugged in and getting readings from the button I had wired in.
This is my new code: Code:
try { |
Re: Enhanced I/O through Cypress
"ex.printStackTrace();" Does exactly what it says: prints a stack trace to the default console (in your case, netbeans console used to deploy). It would not add anything significant to keep that inside of the catch block. (And it would end up being helpful when debugging)
As for whether what you did will work, it completely depends on what you want your code to do when that exception is thrown, so if that is setting the Feed to Relay.Value.kOff, sure. Something that bugged me a bit in your code is this: Code:
DriverStationEnhancedIO Cypress = DriverStation.getInstance().getEnhancedIO(); |
Re: Enhanced I/O through Cypress
I managed to test the program. I got this in the run box:
Code:
[cRIO] edu.wpi.first.wpilibj.DriverStationEnhancedIO$EnhancedIOException: Enhanced IO MissingCode:
try {I reimaged the cRIO (to change IP) and my relay was not responding to my command from the joystick (it worked before I reimaged it). I added it to autonomous and the relay worked. (the joystick was responding in the dionostics tab so I have no Idea what caused it to quit working, I will restore the cRIO to the IP that it had previously) Once I get the relay going again on user command I will have a definate answer on whether or not this code worked, but in the meantime feel free to critique. |
| All times are GMT -5. The time now is 09:58. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi