|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
not able to get any programs to work
Hi all,
I have absolutely no idea what is causing this problem, so I just decided to post in this section of the forum. Before the season started, I started doing simple things like getting led's to blink (this is our first year using java). I used image 28 and whatever netbeans plugin version at that time. I got plenty of things working (putting it all in the robotinit() section in the iterative template). Anyway, I have been trying to get some relays and solenoids to work, but nothing worked, so I threw away all of those programs. Just now it occurred to me that nothing has been working since I updated the cRio and Netbeans plugins. The programs still get uploaded. Netbeans says so. But nothing works. Some other things I have noticed: All Digital outputs are at 5v (even though they were not referenced in the code). Also, they solenoids go 1v-0v-1v-0v at 1 second intervals. Don't worry, I understand the new way of referencing slots, and have updated my code accordingly. Here is an example: package edu.wpi.first.wpilibj.templates; import edu.wpi.first.wpilibj.*; public class RobotTemplate extends IterativeRobot { Relay twoWay = new Relay(1,1) public void robotInit() { twoWay.set(Relay.Value.kForward); }} with the digital module in slot 2. Also, when I reimaged the cRio, I had to format it with labview and the new image, and then go back and change it to java. any Ideas? |
|
#2
|
|||
|
|||
|
Re: not able to get any programs to work
Try these
Before class: Code:
import edu.wpi.first.wpilibj.Relay; import edu.wpi.first.wpilibj.Solenoid; Use this: In main class: Code:
Relay r1; Solenoid s1; Code:
r1 = new Relay(#); // What ever port its in replace # s1 = new solenoid(#); // What ever port its in replace # Code:
r1.set(Relay.Value.kOn); // kOff for off s1.set(true); //false for off Last edited by ProgrammerMatt : 13-01-2012 at 17:40. |
|
#3
|
|||
|
|||
|
Re: not able to get any programs to work
Putting "everything" in robotInit is a bit strange and probably not what you want to do. The robot outputs (PWM and relays) will not be enabled unless the robot is enabled. Which means that your code to set those outputs should probably be in one of the teleop or autonomous methods.
|
|
#4
|
|||
|
|||
|
Re: not able to get any programs to work
interesting...I'll try it.
|
|
#5
|
|||
|
|||
|
Re: not able to get any programs to work
Quote:
|
|
#6
|
|||
|
|||
|
Re: not able to get any programs to work
The robot is enabled using the Driver's Station software either running on the same computer as you are using to code, or a separate computer.
|
|
#7
|
|||
|
|||
|
Re: not able to get any programs to work
Just realized something that might be relevant. The last lines I have in the output section in netbeans are:
[cRIO] Default IterativeRobot.disabledInit() method... Overload me! [cRIO] Default IterativeRobot.disabledContinuous() method... Overload me! If i'm not mistaken these are the methods that are currently running, and if (yet again) i'm not mistaken one of those used to be IterativeRobot.robotInit(). When I get back to the lab I'll upload the same code but in the disabledInit() instead of robotInit(). |
|
#8
|
|||
|
|||
|
Re: not able to get any programs to work
Quote:
You need to enable your robot using the Driver's Station software. |
|
#9
|
||||
|
||||
|
Re: not able to get any programs to work
1. if it plugged into the digital sidecar, check the ribbon cable is made properly. (if this was the problem with our sidecar (we havn't retested it yet) then if the solenoid is supposed to be in PWM slot 1, put it in slot 3 and try, at the least this was a problem we seemed to have....
PDF on fixing the DB37 cable: http://www.usfirst.org/sites/default...structions.pdf |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|