View Single Post
  #9   Spotlight this post!  
Unread Today, 01:10
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 410
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Pneumatics code problems.

Quote:
Originally Posted by charlier999 View Post
all tho i did the exact same thing except change the name of the wasAPressed to shifter_varable. It still does the exact same thing as before, going hyper-speed switching back and forth.
Ok let me make it a bit more clear:

Code:
// File: Robot.cpp

class Robot: public IterativeRobot {
public:
    bool wasAPressed = false; // MEMBER VARIABLE. not local variable
    
    // robotInit, teleopInit, autonomousInit, autonomousPeriodic, etc

    void teleopPeriodic() {
        if (driver->GetRawButton(2)) {
            if (!wasAPressed) {
                wasAPressed = true;
                shifter->Set(shifter->Get() == DoubleSolenoid::Value::kReverse ? DoubleSolenoid::Value::kForward : DoubleSolenoid::Value::kReverse);
            }
        } else {
            wasAPressed = false;
        }
    }
}
Please read: http://www.cplusplus.com/doc/tutorial/classes/
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote