mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Version 4 Image
Updated the HAL library to work with the new version 3 headers from NI. There were multiple changes in this verison: more PWM generators were added, so the functions for setting PWM signals have been updated. UserWatchdog has been removed, and Watchdog has been removed from WPILib to accomodate for this. Digital selection has been consolidated to one function in the NI headers, so this has been updated in the HAL. New SPI and I2C libraries have been added, but need to be implemented in the HAL before they will work.
This commit is contained in:
committed by
Brad Miller
parent
b1ef116104
commit
4546abc8c5
@@ -1,11 +1,3 @@
|
||||
//============================================================================
|
||||
// Name : Robot.cpp
|
||||
// Author :
|
||||
// Version :
|
||||
// Copyright :
|
||||
// Description : Hello World in C++, Ansi-style
|
||||
//============================================================================
|
||||
|
||||
#include "WPILib.h"
|
||||
|
||||
/**
|
||||
@@ -13,16 +5,16 @@
|
||||
* The SimpleRobot class is the base of a robot application that will automatically call your
|
||||
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
|
||||
* the driver station or the field controls.
|
||||
*/
|
||||
class Robot : public SimpleRobot
|
||||
*/
|
||||
class Robot: public SimpleRobot
|
||||
{
|
||||
RobotDrive myRobot; // robot drive system
|
||||
Joystick stick; // only joystick
|
||||
|
||||
public:
|
||||
Robot(void):
|
||||
myRobot(1, 2), // these must be initialized in the same order
|
||||
stick(1) // as they are declared above.
|
||||
Robot() :
|
||||
myRobot(1, 2), // these must be initialized in the same order
|
||||
stick(1) // as they are declared above.
|
||||
{
|
||||
myRobot.SetExpiration(0.1);
|
||||
}
|
||||
@@ -30,7 +22,7 @@ public:
|
||||
/**
|
||||
* Drive left & right motors for 2 seconds then stop
|
||||
*/
|
||||
void Autonomous(void)
|
||||
void Autonomous()
|
||||
{
|
||||
myRobot.SetSafetyEnabled(false);
|
||||
myRobot.Drive(-0.5, 0.0); // drive forwards half speed
|
||||
@@ -41,7 +33,7 @@ public:
|
||||
/**
|
||||
* Runs the motors with arcade steering.
|
||||
*/
|
||||
void OperatorControl(void)
|
||||
void OperatorControl()
|
||||
{
|
||||
myRobot.SetSafetyEnabled(true);
|
||||
while (IsOperatorControl())
|
||||
@@ -50,11 +42,12 @@ public:
|
||||
Wait(0.005); // wait for a motor update time
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs during test mode
|
||||
*/
|
||||
void Test() {
|
||||
void Test()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user