Skip to content

ethanelliott/2056-ways-to-inspire-programming

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

title

Coding for Success

Presentation

Download Here

Sample code

Below are some examples of various code elements discussed during the presentation.

Naming Conventions

    int intakeState;                  //Variable
    const int INTAKE_OFF = 0;         //Constant
    float kP = 0.01;                  //Member constants
    void setIntakeSpeed(float speed); //Member functions
    intakeRoller = new VictorSP(INTAKE_ROLLER);  //Objects

Wrapper functions

void setIntakeSpeed(float speed) {
        intakeRoller->Set(LimitOutput(speed, 1.0));
    }

State Machine

void intakeStateMachine() {
        switch (intakeState) {
        case INTAKE_OFF:
            SmartDashboard::PutString("Intake", "OFF");
            setIntakeSpeed(0.0);
            break;
        case INTAKE_IN:
            SmartDashboard::PutString("Intake", "IN");
            setIntakeSpeed(0.75);
            break;
        case INTAKE_OUT:
            SmartDashboard::PutString("Intake", "OUT");
            setIntakeSpeed(-1);
            break;
        }
        if (driveGamePad->GetNumberedButton(1)) {
            intakeState = INTAKE_IN;
        } else if (driveGamePad->GetNumberedButton(2)) {
            intakeState = INTAKE_OFF;
        } else if (driveGamePad->GetNumberedButton(3)) {
            intakeState = INTAKE_OFF;
        } else if (driveGamePad->GetNumberedButton(4)) {
            intakeState = INTAKE_OFF;
        } else if (driveGamePad->GetNumberedButton(8)) {
            intakeState = INTAKE_OUT;
        } else {
            intakeState = INTAKE_OFF;
        }
    }
`

References and Other Links

Reference Link
2056 Website http://2056.ca
Team Manual http://2056.ca/team-manual/
WPILib https://wpilib.screenstepslive.com/s/4485
Team 1114 Code Release https://www.chiefdelphi.com/media/papers/3180
Team 254 Code Release https://github.com/Team254/FRC-2017-Public

About

Information and links from the conference

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published