Skip to content

Instantly share code, notes, and snippets.

@IanWold
Created January 18, 2014 04:07
Show Gist options
  • Save IanWold/8486055 to your computer and use it in GitHub Desktop.
Save IanWold/8486055 to your computer and use it in GitHub Desktop.
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, m1, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, m2, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_1, m3, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, m4, tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c";
task main()
{
while (true)
{
//Check Joystick 1
//To move wheels
if (joy1Btn(5) == 1)
{
motor[m1] = joystick.joy1_y1;
}
else
{
motor[m1] = 0;
}
if (joy1Btn(6) == 1)
{
motor[m2] = -(joystick.joy1_y2);
}
else
{
motor[m2] = 0;
}
//Set arm motors to joystick 2 values
motor[m3] = joystick.joy2_y1;
if (joy2_Btn(1) == 1) //If you need to use the first joystick, change it to: joy1_Btn(1)
{
if (motor[m4] == 0) //If you need to use a different motor, change every "m4" to whichever motor you need
{
motor[m4] = 100; //If you need the motor to go at a different speed, change the "100" here to the speed you need.
//This number is a percentage - 100 is 100% speed, 50 is 50% speed, etc.
}
else
{
motor[m4] = 0;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment