View unanswered posts | View active topics It is currently Thu Dec 18, 2014 9:34 pm






Reply to topic  [ 2 posts ] 
Joystick not working... 
Author Message
Rookie

Joined: Sun Oct 12, 2014 3:29 pm
Posts: 4
Location: Western Center Academy
Post Joystick not working...
Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     rightmotor,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     empty1,        tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     leftmotor,     tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C2_2,     empty2,        tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    servo1,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_2,    servo2,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_3,    servo3,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_4,    servo4,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_5,    servo5,               tServoNone)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.

void initializeRobot()
{
  return;
}
task main()
{
  initializeRobot();

  waitForStart();   // wait for start of tele-op phase

  while (true)
  {
     int threshold = 10;


   {


      //Driving Control
      if(abs(joystick.joy1_y2) > threshold)     // If the right analog stick's Y-axis readings are either above or below the threshold...
      {
         motor[rightmotor] = joystick.joy1_y2;            // ...move the right side of the robot.
      }
      else                                      // Else the readings are within the threshold, so...
      {
         motor[rightmotor] = 0;                                 // ...stop the right side of the robot.
      }
      if(abs(joystick.joy1_y1) > threshold)     // If the left analog stick's Y-axis readings are either above or below the threshold...
      {
         motor[leftmotor] = joystick.joy1_y1;            // ...move the left side of the robot.
      }
      else                                      // Else the readings are within the threshold, so...
      {
         motor[leftmotor] = 0;                                 // ...stop the left side of the robot.
      }

  }
}
}

Autonomous works, but teleop doesn't.
Please help!

_________________
We are the NANOSLUGS! FTC Team number 5755!


Last edited by nanoslugs on Sat Dec 06, 2014 2:29 pm, edited 1 time in total.



Sat Dec 06, 2014 2:26 pm
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 213
Post Re: Joystick not working...
Okay, so just a couple of pieces of information that will make debugging this easier.
First, what version of ROBOTC are you using? Second, do you have the Joystick Control - Competition/FTC/Advanced (it might be any one of those names) open?

_________________
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/.


Sat Dec 06, 2014 9:27 pm
Profile
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.