You are on page 1of 2

4537 - DRSS Enterprise

RobotC Basics Reference Sheet


Dayton Regional STEM School FTC Team 4537 - DRSS Enterprise Function Code Structure: motor[motorName] = powerLevel; Example: motor[motorLeft] = 100; This statement can be used to set any DC motor previously configured in #pragma to a percentage of power, 100 being full power forward and -100 being full power backward. Structure: wait1Msec(durationInMilliseconds); wait10Msec(durationInHundrethsOfSeconds); Timing Example: wait1Msec(1000); This statement is used for timing, just remember that there are options for waiting in intervals of 1/1000 seconds or 1/100 seconds. Structures: servo[servoName] = newPosition; ServoValue[servoName] Example: servo[servoArm] = ServoValue[servoArm] + 5; The servo[] method is used to tell the servo what position to move to, from 0 to 255. You can read the servos current position the using ServoValue[] method. The example given reads the servos position, and tells it to go 5 units further than where it is.

Moving motors

Servos

2013 2014 FTC

4537 - DRSS Enterprise Function Code Structure: SensorValue[sensorName] Example: while(SensorValue[lightSensor] > 30) This method directly returns the value of the sensor, in the form of an integer. Structure: getJoystickSettings(joystick); joystick.joy1_y1; Example: while(true){ getJoystickhSettings(joystick); motor[mL] = joystick.joy1_y1; motor[mR] = joystick.joy1_y2; } To force the joysticks to update, use getJoystickSettings(joystick); inside of your repeating loop. To use the readings of the joystick, use expressions like these: joystick.joy1_y1; //Joystick 1, Stick 1, Vertical Measurement joystick.joy1_x1; //Joystick 1, Stick 1, Horizontal Measurement joystick.joy2_y2; //Joystick 2, Stick 2, Vertical Measurement Dont forget: Capitalization matters Always end lines involving statements with a semi-colon. Brackets vs. Parenthesis. o Brackets are used for differentiation between motors, servos, and sensors declared in pragma configuration, for example motor[motorLeft]; o Parenthesis are used to indicate conditions for a function, such as wait1Msec(3000); 2013 2014 FTC

Sensors

Joystick Control

You might also like