Professional Documents
Culture Documents
Moving motors
Servos
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