View unanswered posts | View active topics It is currently Fri Jun 22, 2018 3:12 am

Reply to topic  [ 2 posts ] 
Tetrix motors run with NXT-G but not with RobotC 
Author Message

Joined: Sat Jun 27, 2009 4:52 pm
Posts: 7
Post Tetrix motors run with NXT-G but not with RobotC
I don't have the full FTC kit yet (ordered), but I do have 2 NXT's, a Tetrix kit (blue box), the DC Motor controller, Servo controller, and one Motor encoder.

I'm running NXT-G v. 2.0 on one NXT and RobotC 1.46 on the other NXT, (not at the same time) :) .

When I run NXT-G I can get DC motors and servos to respond. When I run RobotC, I can get motors A, B, and C to respond, but not D, E, or the servos.
I have turned PID off since I only have one encoder. The encoder is on Motor 1 and plugged into Enc1. Port 1 of the NXT is connected to the Motor controller first, just like on page 18 of the Tetrix manual, plus a second motor and servo, and an NXT motor in port A.

I have switched the NXT's and re-downloaded appropriate firmware, so it's not a bad NXT or wire.

Here's one of several code attempts, copied directly from the webinar, with all the joystick stuff deleted since I don't have that yet. Motor A works, D and E do not. (Obviously no servos in this code.)

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

task main()


while(time1[T1] < 10000)
motor[motorA] = 50;
motor[motorD] = 50;
motor[motorE] = 50;


It's got to be something embarrassingly silly, but I'm just not seeing what is wrong.

Sat Jun 27, 2009 6:38 pm
User avatar

Joined: Tue Oct 14, 2008 7:16 pm
Posts: 171
Location: Investigating an unidentified ship sighted in Sector 31428
Post Re: Tetrix motors run with NXT-G but not with ROBOTC
As a rule, you shouldn't use the names "motorD", "motorE", etc., the compiler seems to get all mixed up because these names are assigned by default to the motor slots rather than using the internal names "mtr_S1_C1_1".
Just start with a fresh file and using the Motors and Sensors Setup dialog create your motor, servo, and sensor definitions using names other than "motorD", etc. I suggest using a name indicative of the function of the motor such as "leftMotor" or "armMotor", etc. This helps you keep your parts straight.

Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
using namespace System;
using namespace Genius;
using namespace Personality;
public ref class Nerd : Geek, IAnserable
    Geek::Type brainMode = Geek::Type::Programmer;

Sat Jun 27, 2009 10:37 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

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.