View Single Post
  #1   Spotlight this post!  
Unread 10-04-2010, 21:59
MattSr's Avatar
MattSr MattSr is offline
Mentor/Programmer/Animator
AKA: Matt Cyril Senior
FRC #0488 (Team Xbot)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Seattle, Washington
Posts: 21
MattSr is an unknown quantity at this point
Send a message via AIM to MattSr Send a message via MSN to MattSr Send a message via Yahoo to MattSr
Angry [FTC]: RobotC Issue

So i learned RobotC pretty much in about 2 hours, at first everything was going decently but after a while, this message started popping up on my NXT followed by two beeps as well as not letting my code run:

Code:
PgmCnt: 000129
Type: 2
Here is my code

Code:
//Motor and Servo Hubs
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, none)
#pragma config(Hubs, S2, HTServo, none, none, none)
//Tetrix Motors
#pragma config(Motor, mtr_S1_C1_1, rightdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, leftdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_1, shooter1, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_2, helix, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C3_1, shooter2, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_2, roller, tmotorNormal, openLoop)
//Servos
#pragma config(Servo, srvo_S2_C1_1, blocker, tServoNormal)
#pragma config(Servo, srvo_S2_C1_2, ramp, tServoNormal)
#pragma config(Servo, srvo_S2_C1_3, leftarm, tServoNormal)
#pragma config(Servo, srvo_S2_C1_4, rightarm, tServoNormal)
//Lego Motors
#pragma config(Motor, motorA, , tmotorNormal, PIDControl)
#pragma config(Motor, motorB, , tmotorNormal, PIDControl)
#pragma config(Motor, motorC, , tmotorNormal, PIDControl)

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

void initializeRobot() //Initialize Servo Positions
{
  servo[blocker]=120;
  servo[ramp]=0;
  servo[leftarm]=255;
  servo[rightarm]=255;
  return;
}

task main()
{
  initializeRobot();

  waitForStart(); //Wait for start of tele-op phase
  //Set Global Variables
  int shooterpower=0;
  int rhlpower=0;
  bool ldzero=false;
  bool rdzero=false;
  bool rhlzero=false;
  while (true)
  {
    getJoystickSettings(joystick); //Update variables with current joystick values

    //Controller 1
    //Leftjoy = left motors
    //Rightjoy = right motors
    //Btn 8 = Roller 100, Helix 100, Lego 100

    //Controller 2
    //Btn2 = Shooter 80
    //Btn3 = Shooter 90
    //Btn4 = Shooter 100
    //Btn5 = Servo left arm to 0 (left arm starts at 255)
    //Btn6 = Servo right arm to 0 (right arm starts at 255)
    //Btn7 = Servo Ramp to 180 (Ramp starts at 0)
    //Btn8 = Servo Blocker to 160 (Blocker starts at 120)
    
    if((joystick.joy1_y1)>5) //Left Drive
    {
      motor[leftdrive]=joystick.joy1_y1;
      ldzero=false;
    }
    else if((joystick.joy1_y1<=5&&ldzero==false))
    {
      motor[leftdrive]=0;
      ldzero=true;
    }
    
    if ((joystick.joy1_y2)>5) //Right Drive
    {
      motor[rightdrive]=joystick.joy1_y2;
      rdzero=false;
    }
    else if((joystick.joy1_y2<=5&&rdzero==false))
    {
      motor[leftdrive]=0;
      rdzero=true;
    }

    if(joy1Btn(8)) //Roller, Helix, and Lego
    {
      rhlpower=100;
      motor[roller]=rhlpower;
      motor[helix]=rhlpower;
      motor[motorA]=rhlpower;
      motor[motorB]=rhlpower;
      motor[motorC]=rhlpower;
      rhlzero=false;
    }
    else if((joy1Btn(8))==false&&rhlzero==false)
    {
      rhlpower=0;
      motor[roller]=rhlpower;
      motor[helix]=rhlpower;
      motor[motorA]=rhlpower;
      motor[motorB]=rhlpower;
      motor[motorC]=rhlpower;
      rhlzero=true;
    }

    if(joy1Btn(4)) //Shooter
    {
      shooterpower=100;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }
    else if(joy2Btn(3))
    {
      shooterpower=90;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }
    else if(joy2Btn(2))
    {
      shooterpower=80;
      motor[shooter1]=shooterpower;
      motor[shooter2]=shooterpower;
    }

    if(joy2Btn(5)) //LeftArm
    {
      servo[leftarm]=0;
    }
    else
    {
      servo[leftarm]=255;
    }

    if(joy2Btn(6)) //RightArm
    {
      servo[rightarm]=0;
    }
    else
    {
      servo[rightarm]=255;
    }

    if(joy2Btn(7)) //Ramp
    {
      servo[ramp]=180;
    }
    else
    {
      servo[ramp]=0;
    }

    if(joy2Btn(8)) //Blocker
    {
      servo[blocker]=180;
    }
    else
    {
      servo[blocker]=120;
    }
  }
}
I have been working on this one issue for about 3 hours now so here's thanks in advance to anyone willing to help

Update: April 10, 2010, 11:30pm GMT-7

The line
Code:
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
doesn't make any difference in the error

i have updated my code and from changing the servo config lines as suggested, i got a new message which i have updated above also.
__________________


Much love to my favorite FRC teams:
1983 Skunkworks - 360 The Revolution - 2898 Flying Hegehogs - 2557 Sota Bots - 2942 Tech Robotics

Last edited by MattSr : 11-04-2010 at 15:33. Reason: Small edits to code
Reply With Quote