Go to Post you must do whats best for the company...not yourself. - Greg Perkins [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 07-11-2012, 11:11
calzim calzim is offline
Registered User
FRC #2429
 
Join Date: Nov 2011
Location: los angeles
Posts: 8
calzim is an unknown quantity at this point
[FTC]: code error

we are a new team trying to code a servo button on the joystick. we got the servo to work without a joystick but now we get an error and we don't know what it means. any help? thanks

error says "servo out of range (34)"



code:

#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop)
#pragma config(Servo, srvo_S2_C1_1, ramp, tServoStandard)
#pragma config(Servo, srvo_S2_C1_2, servo2, tServoNone)
#pragma config(Servo, srvo_S2_C1_3, servo3, tServoNone)
#pragma config(Servo, srvo_S2_C1_4, servo4, tServoNone)
#pragma config(Servo, srvo_S2_C1_5, servo5, tServoNone)
#pragma config(Servo, srvo_S2_C1_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"

const int RAMP_DOWN=255;
const int RAMP_UP = 128;
//TJoystick joystick;

task main()
{
//int i;
//servo(ramp)=160;
while (true)
{
getJoystickSettings(joystick);
motor[motorD] = -joystick.joy1_y2;
motor[motorE] = -joystick.joy1_y1;

if(joy1Btn(4))
{
servoTarget(ramp)=RAMP_DOWN;
}
else if(joy1Btn(2))
{
servoTarget(ramp)= RAMP_UP;
}
/*for (i = 0; i <= 256; i += 16)
{
servo[ramp] = i;
wait1Msec(50);
}
*/
}
}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi