Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(I2C_Usage, I2C1, i2cSensors)
- #pragma config(Sensor, in1, leftLineFollower, sensorLineFollower)
- #pragma config(Sensor, in2, centerLineFollower, sensorLineFollower)
- #pragma config(Sensor, in3, rightLineFollower, sensorLineFollower)
- #pragma config(Sensor, in4, gyro, sensorGyro)
- #pragma config(Sensor, in6, armPot, sensorPotentiometer)
- #pragma config(Sensor, dgtl1, rightEncoder, sensorQuadEncoder)
- #pragma config(Sensor, dgtl3, leftEncoder, sensorQuadEncoder)
- #pragma config(Sensor, dgtl6, touchSensor, sensorTouch)
- #pragma config(Sensor, dgtl8, sonarSensor, sensorSONAR_cm)
- #pragma config(Sensor, I2C_1, rightIME, sensorQuadEncoderOnI2CPort, , AutoAssign )
- #pragma config(Sensor, I2C_2, leftIME, sensorQuadEncoderOnI2CPort, , AutoAssign )
- #pragma config(Sensor, I2C_3, armIME, sensorQuadEncoderOnI2CPort, , AutoAssign )
- #pragma config(Motor, port2, rightMotor, tmotorVex393_MC29, openLoop, reversed, driveRight, encoderPort, I2C_1)
- #pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop, driveLeft, encoderPort, I2C_2)
- #pragma config(Motor, port6, armMotor, tmotorVex393_MC29, openLoop, reversed, encoderPort, I2C_3)
- //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
- /*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++
- 2 Joystick Drive
- - This program allows you to remotely control your robot using the USB Logitech Dual
- Action Joysticks.
- - For USB values to be transmitted to the robot, you must follow several steps:
- - Use the "#include "JoystickDriver.c"" line at the beginning of your program
- - Call the "getJoystickSettings(joystick);" in a loop to repeatedly retrieve the latest values
- - Open the Robot > Debugger Windows > "Joystick Control - Basic" window after downloading your
- program to the virtual robot
- Robot Model(s): Squarebot
- [I/O Port] [Name] [Type] [Description]
- Motor Port 2 rightMotor VEX Motor Right side motor
- Motor Port 3 leftMotor VEX Motor Left side motor
- *To run this sample program on Swervebot, be sure to Reverse Motor Port 3 in the Motors and Sensors
- Setup, and to make sure that Motor Port 2 is NOT Reversed.
- ----------------------------------------------------------------------------------------------------*/
- #pragma debuggerWindows("joystickSimple");
- #include "JoystickDriver.c"
- task main()
- {
- //Loop Forever
- while(1 == 1)
- {
- //Get the Latest joystick values
- getJoystickSettings(joystick);
- //Set the driving motors equal to the Y-axis values of the joysticks
- motor[leftMotor] = joystick.joy1_y1;
- motor[rightMotor] = joystick.joy1_y2;
- if(joy1Btn(6))
- {motor[armMotor]=40;}
- else if(joy1Btn(8))
- {motor[armMotor]=-40;}
- else
- {motor[armMotor]=0;}
- }
- }
Add Comment
Please, Sign In to add comment