In the previous version of RobotC i was able to use the name MotorD and MotorE for the DC motors. but with this new version of RobotC i get an error "**Error**:Undefined variable 'motorD'. 'short' assumed." i was using a previous program that worked fine untill i downloaded a the newer version. anything would help

Tue Oct 11, 2011 5:21 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: DC motor name on RobotC

You can go into the Motors and Sensors menu under Robot, and name different motors.

_________________sudo rm -rf /

Tue Oct 11, 2011 6:23 pm

mrshagler

Rookie

Joined: Tue Oct 11, 2011 5:12 pmPosts: 5

Re: DC motor name on RobotC

i have allready gone and tried that but i can only rename motors A,B, and C and those three only control the nxt motors. what i cant figure out is how to get the tetrix DC motors to move. i have tried motor[motorD] motor[rightmotor] and the #pragma config line will accept any of two names but when i type it into my joystick line i come with the error **Error**:Undefined variable 'rightmotor'. 'short' assumed. i dont think that i have done anything wrong in the programing but you never know this is what i have so far

#include "JoystickDriver.c" // This file does all of the processing of the BT Packettask main(){while (true){getJoystickSettings(joystick);//Check for new BT Packet and update the variables for the joystick positions

I am assuming your motor D and E are your left and right motors. If so, the name you defined are motorleft and motorright, not rightmotor. So motor[motorright] should work for you.

Thu Oct 13, 2011 7:05 pm

mrshagler

Rookie

Joined: Tue Oct 11, 2011 5:12 pmPosts: 5

Re: DC motor name on RobotC

i changed the motor name from motorright to rightmotor but i still get the error message **Error**:Undefined variable 'rightmotor'. 'short' assumed.**Error**:Undefined variable 'leftmotor'. 'short' assumed.

i also changed the name in the #pragma config line and it accepts that but in the line that tells the motor to move it rejects it

Tue Oct 25, 2011 5:20 pm

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1512

Re: DC motor name on RobotC

Would you post your code? It's hard to figure out what's wrong without seeing it.

Tue Oct 25, 2011 6:15 pm

l0jec

Expert

Joined: Mon Oct 27, 2008 9:59 pmPosts: 139

Re: DC motor name on RobotC

I would double check that your platform is still set to LEGO NXT + TETRIX. A simple copy/paste of your code works fine for me until I reset the platform type to plain old LEGO NXT and then I get the same error you describe.

Tue Oct 25, 2011 10:02 pm

mrshagler

Rookie

Joined: Tue Oct 11, 2011 5:12 pmPosts: 5

Re: DC motor name on RobotC

l0jec helped fix part of our problem but now when we try to compile and download our program we get the popup widow that says

#include "JoystickDriver.c" // This file does all of the processing of the BT Packettask main(){while (true){getJoystickSettings(joystick);//Check for new BT Packet and update the variables for the joystick positions

One unrelated obvservation. It wouldn't fix your problem though.joystick has a range of -128 to +127 but motor is in the range of -100 to 100. So you need to scale the joystick range to the motor range. I use these macros:

/** * These macros ignore input value (n) that is within the DEADBAND_THRESHOLD. * This is necessary because analog joysticks do not always centered at zero. * So if the joystick is at the rest position, we will consider it zero even * though the value is non-zero but within DEADBAND_THRESHOLD. */#define DEADBAND(n,t) ((abs(n) > (t))? (n): 0)#define DEADBAND_INPUT(n) DEADBAND(n, DEADBAND_INPUT_THRESHOLD)

Who is online

Users browsing this forum: No registered users and 2 guests

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