View unanswered posts | View active topics It is currently Sun May 28, 2017 12:38 pm

Reply to topic  [ 3 posts ] 
Servo name not defined 
Author Message

Joined: Sun Jan 05, 2014 2:42 pm
Posts: 2
Post Servo name not defined
The name of a servo I have declared is not compiling when used in my program.
Here is the config code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Hubs,  S4, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  motorA,          lamp,          tmotorNXT, openLoop)
#pragma config(Motor,  motorB,          heartbeat,     tmotorNXT, openLoop)
#pragma config(Motor,  mtr_S1_C1_1,     HL,            tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     arm,           tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C2_1,     D,             tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C2_2,     E,             tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S4_C1_1,     HR,            tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_2,     G,             tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S4_C2_1,     F,             tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S4_C2_2,     flag,          tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    upper,                tServoStandard)
#pragma config(Servo,  srvo_S1_C3_2,    lower,                tServoStandard)
#pragma config(Servo,  srvo_S1_C3_3,    sbleft,               tServoStandard)
#pragma config(Servo,  srvo_S1_C3_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
#pragma config(Servo,  srvo_S4_C3_1,    servo7,               tServoNone)
#pragma config(Servo,  srvo_S4_C3_2,    servo8,               tServoNone)
#pragma config(Servo,  srvo_S4_C3_3,    servo9,               tServoNone)
#pragma config(Servo,  srvo_S4_C3_4,    servo10,              tServoNone)
#pragma config(Servo,  srvo_S4_C3_5,    pawl,                 tServoStandard)
#pragma config(Servo,  srvo_S4_C3_6,    brake,                tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

When I try to use the servos named "pawl" or "brake", it claims that they are undefined when compiling:
task main() {
   servo[pawl] = 127;

This code gives an error, saying "**Error**:Undefined variable 'pawl'. 'short' assumed."

task main() {
   servo[srvo_S4_C3_5] = 127;

This code works fine.

I am unsure why this is happening, but I would love an explanation.

Sun Jan 05, 2014 2:51 pm
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: Servo name not defined
I think that's a known bug. In the mean time, you can just do a define like this:
define pawl   srvo_S4_C3_5

Sun Jan 05, 2014 10:48 pm

Joined: Sun Jan 05, 2014 2:42 pm
Posts: 2
Post Re: Servo name not defined
Okay, thanks for your help. I'm now using:
TServoIndex pawl = srvo_S4_C3_5;

It works, but I was just wondering if I was doing something wrong.

Tue Jan 07, 2014 8:53 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.