Skip to content

Instantly share code, notes, and snippets.

@ajnadel
Created October 29, 2016 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajnadel/e712cd25ea9d30e85a49ab3434f87e6a to your computer and use it in GitHub Desktop.
Save ajnadel/e712cd25ea9d30e85a49ab3434f87e6a to your computer and use it in GitHub Desktop.
Basic Robot Control & Movement — Offseason Chassis (Pinkie)
// Manipulating motors
CANTalon leftWheel1 = new CANTalon(1);
CANTalon leftWheel2 = new CANTalon(2);
CANTalon rightWheel1 = new CANTalon(3);
CANTalon rightWheel2 = new CANTalon(4);
// ALWAYS SET WHEELS ON THE SAME SIDE TO THE SAME SPEED
rightWheel1.set(-1); // full backwards
rightWheel1.set(0); // stopped/not moving
rightWheel1.set(1); // full forwards
// Reading from a joystick
Joystick joystick = new Joystick(0); // OPTIONAL
double leftRightTilt = joystick.getX(); // between -1 and 1
double forwardBackwardTile = joystick.getY(); // between -1 and 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment