View unanswered posts | View active topics It is currently Thu Jul 31, 2014 3:39 pm






Reply to topic  [ 2 posts ] 
RobotC 3.5, my program will not work with my robot! 
Author Message
Rookie

Joined: Tue Sep 25, 2012 2:18 pm
Posts: 2
Post RobotC 3.5, my program will not work with my robot!
I am having a problem with my program. I am making this so we can run a basic robot with two rear wheels. But, when I try and rum the program, it will not work. It compiled and downloaded just fine, and when I run the program with the robot, the display will read "Running [Insert program name]". Yet, when I press a button on the controller that is supposed to move the wheel, nothing happens. Is there something I have to change so it will run right? If so, can you explain so I can better understand the program and my error.

It is Lego Mindstorms with Tetrix Motors and a Tetrix Motor Controller. Logitec Game Controller.

Here is my program below(which is based off of our program from last year, with a small change so it will make it past debug and compile and download). Thank you for the assistance.
----------------------------------------------------------------------------
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorA, tmotorTetrix, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_2, motorB, tmotorTetrix, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"

task main()
{while(true)

getJoystickSettings(joystick);

motor[motorA] = joystick.joy1_y1;
motor[motorB] = -joystick.joy1_y2;

if (joy1Btn(8))
{
motor[motorA] = 65;
}
else if (joy1Btn(6))
{
motor[motorA] = -65;
}

else
{
motor[motorA] = 0;
}
if (joy1Btn(7))
{
motor[motorB] = 65;
}
else if (joy1Btn(5))
{
motor[motorB] = -65;
}

else
{
motor[motorB] = 0;
}}


Tue Sep 25, 2012 2:29 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: RobotC 3.5, my program will not work with my robot!
Try this.
Code:
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, mtr_S1_C1_1, motorA, tmotorTetrix, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_2, motorB, tmotorTetrix, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#include "JoystickDriver.c"

task main()
{
  while(true)
  {

    getJoystickSettings(joystick);

    motor[motorA] = joystick.joy1_y1;
    motor[motorB] = -joystick.joy1_y2;

    if (joy1Btn(8))
    {
      motor[motorA] = 65;
    }
    else if (joy1Btn(6))
    {
      motor[motorA] = -65;
    }

    else
    {
      motor[motorA] = 0;
    }
    if (joy1Btn(7))
    {
      motor[motorB] = 65;
    }
    else if (joy1Btn(5))
    {
      motor[motorB] = -65;
    }

    else
    {
      motor[motorB] = 0;
    }
  }
}

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Tue Sep 25, 2012 3:43 pm
Profile WWW
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.