Add cpp examples (#659)

* Added C++ robot project examples and set up sub .clang-format for them

* Ran formatter
This commit is contained in:
Tyler Veness
2017-10-17 21:37:58 -07:00
committed by Peter Johnson
parent 66002d6cac
commit 0291a95f68
110 changed files with 4943 additions and 70 deletions

View File

@@ -0,0 +1,51 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
#include <Commands/Subsystem.h>
#include <DigitalInput.h>
#include <Victor.h>
/**
* The claw subsystem is a simple system with a motor for opening and closing.
* If using stronger motors, you should probably use a sensor so that the
* motors don't stall.
*/
class Claw : public frc::Subsystem {
public:
Claw();
void InitDefaultCommand() override;
/**
* Set the claw motor to move in the open direction.
*/
void Open();
/**
* Set the claw motor to move in the close direction.
*/
void Close();
/**
* Stops the claw motor from moving.
*/
void Stop();
/**
* Return true when the robot is grabbing an object hard enough
* to trigger the limit switch.
*/
bool IsGripping();
void Log();
private:
frc::Victor motor{7};
frc::DigitalInput contact{5};
};