NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages

This is an example of how to use the NXTServoPosition, NXTServoSpeed, NXTServoBatteryVoltage, SetNXTServoSpeed, SetNXTServoQuickPosition, SetNXTServoPosition, NXTServoReset, NXTServoHaltMacro, NXTServoResumeMacro, NXTServoPauseMacro, NXTServoInit, NXTServoGotoMacroAddress, NXTServoEditMacro, NXTServoQuitEdit, SetSensorLowspeed, NumOut, and Wait functions.

task main()
SetSensorLowspeed(S1); // NXTServo is an i2c device
// edit a macro
char result;
// TODO: write bytes of macro data to the device
result = NXTServoQuitEdit(S1);
// run a macro at address 0x30
// pause the macro
// resume the macro
// halt the macro
// set a non-default speed value for a servo (0 = full speed)
// set a non-default quick position value for a servo
// Wait a bit for the servo to reach its new position
// set a non-default position value for a servo
// store these non-default values as the initial position for this servo
// output the battery voltage
// output the current position
// output the current speed
// reset the device back to default speed/position (0/1500) settings for all servos