View Single Post
  #6   Spotlight this post!  
Unread 09-08-2012, 00:06
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Pneumatics Code Help?? - Errors??

The error that you're getting has to do with your code. You are initializing the object on that port more than once. Try and find where you initialize the object for the solenoid and find out why that code is being run more than once. (If you're not familiar with instances in java, I'd suggest you look into it - quick summary - 'objectName = new Object()' is the initialization of the object)

Once you find it, I'd suggest using singleton instances of all physical components of your robot. Works much better and prevents errors like this.

Example of singleton instance :
Code:
RobotDrive driveInstance
public static RobotDrive getRobotDrive() {
    if(drive == null) {
        drive = new RobotDrive(1,2,3,4);
    }
    return drive;
}
__________________
All opinions are my own.
Reply With Quote