ROBOTC.net forums
http://robotc.net/forums/

Servo doesnt move
http://robotc.net/forums/viewtopic.php?f=52&t=1057
Page 1 of 1

Author:  mijial13 [ Tue Dec 23, 2008 2:55 pm ]
Post subject:  Servo doesnt move

When i download the duel joysticks with servo and i use the debugger the nxt gives an error code
PgmCnt 000063
Type 34
this is my program


#pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C3_1, servoA, tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c" //Include file to "handle" the BT messages.

task main()
{
while (true) //Loop forever
{
getJoystickSettings(joystick); //Update variables with current joystick values
motor[motorE] = joystick.joy1_y2; //Assign motorE (Motor 2) to the Right Y-Axis

servoTarget[servo1] = joystick.joy2_x1 + 127;
//We're setting the servo's position here to the joystick's Left X-axis
//But since Servos range from 0-255 and Joysticks range from -127 to 127
//We'll add the lower limit of the joystick (127) to make the ranges match.

if(joy1Btn(1)) //If Joystick Button #1 is pressed
{
motor[motorA] = 100; //Turn NXT MotorA on at 50% power
}
else //If Joystick Button #1 is not pressed
{
motor[motorA] = 0; //Turn NXT MotorA on at 0% power (off)
}
}
}


Thanks

Author:  10nisman94 [ Wed Dec 24, 2008 9:00 am ]
Post subject:  Re: Servo doesnt move

Try redownloading your firmware, we had a similar problem

Author:  arkarind [ Sat Dec 27, 2008 4:29 pm ]
Post subject:  Re: Servo doesnt move

I think I know the problem.. i dunno if this is right.. but.. I saw in your configuration you named the servo as ServoA, but when you are using the servo in your program, you reffered to the servo as servo1. try changing this to servoA

like below:
#pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S1_C3_1, servoA, tServoNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c" //Include file to "handle" the BT messages.

task main()
{
while (true) //Loop forever
{
getJoystickSettings(joystick); //Update variables with current joystick values
motor[motorE] = joystick.joy1_y2; //Assign motorE (Motor 2) to the Right Y-Axis

servoTarget[servoA] = joystick.joy2_x1 + 127;
//We're setting the servo's position here to the joystick's Left X-axis
//But since Servos range from 0-255 and Joysticks range from -127 to 127
//We'll add the lower limit of the joystick (127) to make the ranges match.

if(joy1Btn(1)) //If Joystick Button #1 is pressed
{
motor[motorA] = 100; //Turn NXT MotorA on at 50% power
}
else //If Joystick Button #1 is not pressed
{
motor[motorA] = 0; //Turn NXT MotorA on at 0% power (off)
}
}
}

i dunno thats just a guess of mine.. but try it and let us know if that works or not

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/