HTML

blink_motor_button.c

Nov 2nd, 2017
303
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. #pragma config(Sensor, dgtl1,  red,            sensorLEDtoVCC)
  2. #pragma config(Sensor, dgtl2,  yellow,         sensorLEDtoVCC)
  3. #pragma config(Sensor, dgtl3,  green,          sensorLEDtoVCC)
  4. #pragma config(Sensor, dgtl4,  button,         sensorTouch)
  5. #pragma config(Motor,  port1,           motor,         tmotorVex393_HBridge, openLoop)
  6. //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  7.  
  8. task main()
  9. {
  10.     while(1 == 1)
  11.     {
  12.         if(SensorValue(button) == 1)
  13.         {
  14.             turnLEDOff(red);
  15.             turnLEDOff(yellow);
  16.             turnLEDOn(green);
  17.             startMotor(port1, 100);
  18.         }
  19.         else
  20.         {
  21.             turnLEDOn(red);
  22.             turnLEDOff(yellow);
  23.             turnLEDOff(green);
  24.             stopMotor(port1);
  25.         }
  26.     }
  27. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment