View unanswered posts | View active topics It is currently Sat Dec 20, 2014 10:00 pm






Reply to topic  [ 4 posts ] 
joystick program issue 
Author Message
Rookie

Joined: Thu Feb 21, 2013 4:57 pm
Posts: 2
Post joystick program issue
:-( had this program worked before, but right now it cannot work any more. On the NXT brick we get wait for start error.
This is my robotc program:
Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Hubs,  S2, HTMotor,  HTServo,  none,     none)
#pragma config(Motor,  mtr_S1_C1_1,     drivemotor1,   tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C1_2,     drivemotor2,   tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_1,     motorF,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S2_C1_2,     motorG,        tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C2_1,    servo1,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_2,    servo2,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_3,    servo3,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_4,    servo4,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_5,    servo5,               tServoStandard)
#pragma config(Servo,  srvo_S1_C2_6,    servo6,               tServoStandard)
#pragma config(Servo,  srvo_S2_C2_1,    servo7,               tServoStandard)
#pragma config(Servo,  srvo_S2_C2_2,    servo8,               tServoStandard)
#pragma config(Servo,  srvo_S2_C2_3,    servo9,               tServoStandard)
#pragma config(Servo,  srvo_S2_C2_4,    servo10,              tServoStandard)
#pragma config(Servo,  srvo_S2_C2_5,    servo11,              tServoStandard)
#pragma config(Servo,  srvo_S2_C2_6,    servo12,              tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c" //Joystick is included in this program

task main()
{
  int threshold = 15; //to avoid unnecessary movement

  servo[servo1]=50;
  wait1Msec(1000);

  while(true) //infinite loop
  {
    getJoystickSettings(joystick); //retrieves data from the joystick

    if(abs(joystick.joy1_y1) > threshold)
    {
      motor[drivemotor1] = joystick.joy1_y1; //y1 controller moves drive motor
    }
    else
    {
      motor[drivemotor1] = 0;
    }


    if(abs(joystick.joy1_y2) > threshold)
    {
      motor[drivemotor2] = joystick.joy1_y2; //y2 controller moves motorE
    }
    else
    {
      motor[drivemotor2] = 0;
    }
    if(joystick.joy1_Buttons == 128)
    {
      servo[servo1] = ServoValue[servo1]+3;
    }
    if(joystick.joy1_Buttons == 32)
    {
      servo[servo1] = ServoValue[servo1]-3;
    }
    if(joystick.joy1_Buttons == 2)
    {
    servo[servo2] = ServoValue[servo2]-5;
    }
    if(joystick.joy1_Buttons == 4)
    {
      servo[servo2] = ServoValue[servo2]+5;
    }
   }
}

We are a new team in Massachusetts, any help will be appreciate.


Wed Jan 22, 2014 3:06 pm
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 214
Post Re: joystick program issue
I don't see waitForStart() in your program, so I'm not quite sure why that is happening. But, I can hopefully tell you how to fix it. Try using the "Joystick - Competition" debug window. This window contains radio buttons for teleop ready and teleop running. Click teleop ready, then teleop running, and hopefully it will work.

P.S. Make sure you have waitForStart() in your code before you go to competition!

_________________
FTC Team 6100 Chariots of Fire - Programmer (2012-2013)
FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014)
FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015)
Check out our team website at http://bluechariotsoffire.com/.


Wed Jan 22, 2014 4:08 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: joystick program issue
if waitForStart() is not part of this program, then it's conclusively in one of the #include files.
As there is just 1 #include file, it's supposed to be a good hint to look there.

Or maybe you wish to look for other posts concerning this issue - I'm not sure why this issue hadn't been finally changed and fixed by the RobotC developers since a long, long time ago...

http://www.robotc.net/forums/search.php?keywords=waitForStart&terms=all&author=&sc=1&sf=all&sk=t&sd=d&sr=posts&st=0&ch=300&t=0&submit=Search
8)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Wed Jan 22, 2014 4:53 pm
Profile
Rookie

Joined: Tue Feb 04, 2014 1:07 pm
Posts: 4
Post Re: joystick program issue
Actually, If you guys are an FTC team, remember that the FTC user controlled and autonomous templates are required and should help your case. To find these, instead of opening a new file, select the option "user controlled template".


Tue Feb 04, 2014 4:20 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.