HTML icon

blink_motor_button.c

HTML | PRO | 11/02/17 12:00:53 PM UTC | 0 ⭐ | 398 👁️ | Never ⏰ | []
C |

700 B

|

None

|

0 👍

/

0 👎

#pragma config(Sensor, dgtl1,  red,            sensorLEDtoVCC)
#pragma config(Sensor, dgtl2,  yellow,         sensorLEDtoVCC)
#pragma config(Sensor, dgtl3,  green,          sensorLEDtoVCC)
#pragma config(Sensor, dgtl4,  button,         sensorTouch)
#pragma config(Motor,  port1,           motor,         tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
 
task main()
{
    while(1 == 1)
    {
        if(SensorValue(button) == 1)
        {
            turnLEDOff(red);
            turnLEDOff(yellow);
            turnLEDOn(green);
            startMotor(port1, 100);
        }
        else
        {
            turnLEDOn(red);
            turnLEDOff(yellow);
            turnLEDOff(green);
            stopMotor(port1);
        }
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎