View Single Post
  #1   Spotlight this post!  
Unread 01-07-2015, 00:05
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
DoubleSolenoid question

Alright, so i'm working on just re-writing our 2015 robot's code so that it's a lot cleaner and whatnot, so future students can see a good example of a good project.

my question - one that i ran into during build season but never tested - is this: if i instantiate a double solenoid object, then put it in the Value.kForward position manually in teleop, then turn the bot off and re-upload the code, will the code be able to recognize that it is in the Value.kForward position during disabled?

the order of code being run:

first time:
Code:
public void RobotInit(){
    piston = new DoubleSolenoid( ... , ...);
}
// then:
public void TeleopInit(){
   piston.setValue(Value.kForward);
}
// then i power off the bot while piston is in forward position, and this happens after i turn it on again and reupload code:
public void RobotInit(){
   piston = new DoubleSolenoid( ... , ...);
}
// then in disabledPeriodic
public void DisabledPeriodic(){
    if(piston.get() == Value.kForward)
        System.out.println("it's in the forward position");
    else
        System.out.println("it isn't or we don't know");
}
what would print in the example?
__________________
2791 (2012-2017)
Reply With Quote