Hi everyone!
Our team is trying to make use of a servo, but we are failing terribly. We can't tell if it is a hardware problem or software problem, nor can we find any solutions online, leaving us awfully confused.
SetupWe have a daisy chain with the Servo Controller for TETRIX going to S1 of the NXT, and then the Motor Controller for TETRIX connected to that. We have a DC motor attached in Motor 1 ofthe motor controller, and a servo in Channel 1 of the servo controller. Finally, we have a touch sensor attached to S2 of the NXT.
Code |  |  |
 | Code: #pragma config(Hubs, S1, HTServo, HTMotor, none, none) #pragma config(Sensor, S2, touch, sensorTouch) #pragma config(Motor, mtr_S1_C2_1, motorD, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_2, motorE, tmotorNormal, openLoop) #pragma config(Servo, srvo_S1_C1_1, lol, tServoNormal) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { while(1 == 1) //Loop forever { if(SensorValue[touch] == 1) //If the touch sensor is pressed... { motor[motorD] = 25; //...spin Motor D at 25% power... servo[lol] = 255; //...and turn Servo 1 fully clockwise. } else //Else, the touch sensor isn't pressed... { motor[motorD] = 0; //...turn Motor D off... servo[lol] = 0; //...and turn Servo 1 fully counter-clockwise. } } }
|  |
 |  |  |
ProblemWhen the touch sensor is pressed, only the motor spins. The servo does absolutely nothing. In the Servo Control window in ROBOTC, the target value updates, and the "position" of the servo instantaneously jumps to the target value (this also happens when no servo is connected at all). We have tried using the standard setup, with the daisy chain beginning with the motor controller, but the results are identical. We
think the servo is fine as when we plug it in to the servo controller it gives a little jolt. And the code we are using is slightly modified from the sample code that comes with ROBOTC. All of our flowcharting skills have failed at isolating the problem, so if anyone has insight, 'twould be highly appreciated.
Thanks a bunch!