![]() |
PSoc Java code.
Hello all,
Working on getting the PSoC IO to work with our switches. After flashing and wiring it, it shows up in the Driver station fine. But what do you use to make it work in code (JAVA)? Just some short sample code will be greatly appreciated. Thanks you. |
Re: PSoc Java code.
A simple snippet to read a digital input:
Code:
DriverStationEnhancedIO m_io = DriverStation.getInstance().getEnhancedIO();Hope it helps :) If you need help with anything else PSoC related, ask away. We've worked with all features of it in some form or another. |
Re: PSoc Java code.
Hey thanks for the reply. I think we got it. :D
Also on a side note what happens when you feed a victor .set method with a value greater then 1? Does it just auto round down to 1? |
Re: PSoc Java code.
Quote:
Code:
/**Code:
/**-Jeremy |
Re: PSoc Java code.
Cool Thank you.
Can't wait to test this out. :) |
Re: PSoc Java code.
Update: After running the code netbeans gives this error.
Quote:
|
Re: PSoc Java code.
That usually means it is not plugged in.
Does the driverstation program show a green light indicator on the "IO" tab? Go into diagnostics and look at a similar indicator next to IO. Another possible cause is that you have flashed the PSoC with incorrect firmware. Make sure you flashed it with the most up to date FRC firmware, not the stock firmware. |
Re: PSoc Java code.
Yeah the PSoC is plugged in with a switch, and it shows up and works fine in the driver station I/O Tab.
|
Re: PSoc Java code.
Strange....
Can you post screenshots of the driverstation(in the diagnostics and IO tabs) and your code? A full log(from cRio boot to where the exception is thrown) would be helpful to see. |
Re: PSoc Java code.
Quote:
Also do you know how to kill the robot program within code? |
Re: PSoc Java code.
I don't see anything out of the ordinary in this log. (Except for the exception.)
I can only tell you it is most likely a hardware issue. Try playing around with different cables, ports and hubs for the PSoC board. Again, verify that it is the most up to date firmware. There is no way to put the robot into the disabled mode from the code. you could however, stop running normal teleop/autonomous code using a simple boolean input. You could put logic like this into your loops: Code:
if(!disabled) { |
Re: PSoc Java code.
What is the most up to date firmware on the PSoC?
I think I am running v20. I was thinking using the disable mode to kill the robot when it crosses over the line (with line sensors) as a safety feature. The PSoC shows up in the Driverstation I/O fine but still gives me the expectation in console. |
Re: PSoc Java code.
Nvm. I just got it to work.
Lol, Under config enchanted has to be checked. x] Thanks for the help. :) |
Re: PSoc Java code.
Enhanced, not enchanted. ;)
Also, for anyone who's interested, here's a link to my team's PSoC code for this year: https://github.com/prog694/frc/blob/...Interface.java |
| All times are GMT -5. The time now is 10:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi