Guest User

Untitled

a guest
Oct 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #pragma config(Sensor, dgtl10, TouchUp, sensorTouch)
  2. #pragma config(Sensor, dgtl11, TouchDown, sensorTouch)
  3.  
  4. /*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++
  5. 2 Joystick Drive
  6. - This program allows you to remotely control your robot using the USB Logitech Dual
  7. Action Joysticks.
  8. - For USB values to be transmitted to the robot, you must follow several steps:
  9. - Use the "#include "JoystickDriver.c"" line at the beginning of your program
  10. - Call the "getJoystickSettings(joystick);" in a loop to repeatedly retrieve the latest values
  11. - Open the Robot > Debugger Windows > "Joystick Control - Basic" window after downloading your
  12. program to the virtual robot
  13.  
  14. Robot Model(s): GridBot
  15.  
  16. [I/O Port] [Name] [Type] [Description]
  17. Motor Port 2 rightMotor VEX Motor Right side motor
  18. Motor Port 3 leftMotor VEX Motor Left side motor
  19.  
  20. *To run this sample program on Swervebot, be sure to Reverse Motor Port 3 in the Motors and Sensors
  21. Setup, and to make sure that Motor Port 2 is NOT Reversed.
  22. ----------------------------------------------------------------------------------------------------*/
  23.  
  24. task main()
  25. {
  26. //Loop Forever
  27. while(1 == 1)
  28. {
  29.  
  30. if(SensorValue(TouchUp)==1)
  31. {
  32. motor[armMotor] = 40;
  33. }
  34. else if(SensorValue(TouchDown)==1)
  35. {
  36. motor[armMotor] = -40;
  37. }
  38. else
  39. {
  40. motor[armMotor] = 0;
  41. }
  42. }
  43. }
Add Comment
Please, Sign In to add comment