Guest User

Untitled

a guest
Mar 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #pragma config(I2C_Usage, I2C1, i2cSensors)
  2. #pragma config(Sensor, in1, leftLineFollower, sensorLineFollower)
  3. #pragma config(Sensor, in2, centerLineFollower, sensorLineFollower)
  4. #pragma config(Sensor, in3, rightLineFollower, sensorLineFollower)
  5. #pragma config(Sensor, in4, gyro, sensorGyro)
  6. #pragma config(Sensor, in6, armPot, sensorPotentiometer)
  7. #pragma config(Sensor, dgtl1, UpButton, sensorTouch)
  8. #pragma config(Sensor, dgtl2, DownButton, sensorTouch)
  9. #pragma config(Sensor, dgtl3, leftEncoder, sensorQuadEncoder)
  10. #pragma config(Sensor, dgtl6, touchSensor, sensorTouch)
  11. #pragma config(Sensor, dgtl8, sonarSensor, sensorSONAR_cm)
  12. #pragma config(Sensor, I2C_1, rightIME, sensorNone)
  13. #pragma config(Sensor, I2C_2, leftIME, sensorQuadEncoderOnI2CPort, , AutoAssign )
  14. #pragma config(Sensor, I2C_3, armIME, sensorQuadEncoderOnI2CPort, , AutoAssign )
  15. #pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop, driveLeft, encoderPort, I2C_2)
  16. #pragma config(Motor, port6, armMotor, tmotorVex393_MC29, openLoop, encoderPort, I2C_3)
  17. //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
  18.  
  19. /*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++
  20. 2 Joystick Drive
  21. - This program allows you to remotely control your robot using the USB Logitech Dual
  22. Action Joysticks.
  23. - For USB values to be transmitted to the robot, you must follow several steps:
  24. - Use the "#include "JoystickDriver.c"" line at the beginning of your program
  25. - Call the "getJoystickSettings(joystick);" in a loop to repeatedly retrieve the latest values
  26. - Open the Robot > Debugger Windows > "Joystick Control - Basic" window after downloading your
  27. program to the virtual robot
  28.  
  29. Robot Model(s): Squarebot
  30.  
  31. [I/O Port] [Name] [Type] [Description]
  32. Motor Port 2 rightMotor VEX Motor Right side motor
  33. Motor Port 3 leftMotor VEX Motor Left side motor
  34.  
  35. *To run this sample program on Swervebot, be sure to Reverse Motor Port 3 in the Motors and Sensors
  36. Setup, and to make sure that Motor Port 2 is NOT Reversed.
  37. ----------------------------------------------------------------------------------------------------*/
  38.  
  39. //#pragma debuggerWindows("joystickSimple");
  40. //#include "JoystickDriver.c"
  41.  
  42. task main()
  43. {
  44. //Loop Forever
  45. while(1 == 1)
  46. {
  47. if(Sensorvalue [UpButton] == 1)
  48. {
  49. motor[armMotor] = 40;
  50. }
  51. else if(Sensorvalue {DownButton} == 1)
  52. {
  53. motor[armMotor] = -40;
  54. }
  55. else
  56. {
  57. motor[armMotor] = 0;
  58. }
  59. }
  60. }
Add Comment
Please, Sign In to add comment