Go to Post ...regardless of anything that happens, there should be no booing at competitions, only cheers. True, many of us want to win, but in the end, all of us are working to expand FIRST and to promote the inspiration and recognition of science and technology through gracious professionalism. - Aignam [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi