View unanswered posts | View active topics It is currently Tue Nov 12, 2019 7:00 pm






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

Joined: Wed Nov 05, 2014 4:36 pm
Posts: 1
Post RobotC FTC Joystick not working
Hey everyone,
I have been trying to set up a basic FTC Joystick test with the Logitech Dual Action controller. I have had no luck with pressing a button and having the motors move, and everything is set up properly. I know this because when I remove the Joystick control statements it works completely fine. My motors are set up properly, with a DC Motor Controller daisy-chained to another Motor Controller. The joystick works, we can see the movements of the joystick registering on the diagnostic window.
Anyways, here is the code:
Code:
#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     frontleft,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     frontright,    tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     backleft,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     backright,     tmotorTetrix, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
#include "JoystickDriver.c";

void movefwd(){
   motor[frontleft] = 90;
   motor[backleft] = 90;
   motor[frontright] = - 90;
   motor[backright] = - 90;
}
void moveleft(){
   motor[frontleft] = 90;
   motor[backleft] = 90;
   motor[frontright] = -90;
   motor[backright] = -90;
}
void moveright(){
   motor[frontleft] = - 90;
   motor[backleft] = -90;
   motor[frontright] =  90;
   motor[backright] = 90;
}
void moveback(){
   motor[frontleft] = - 90;
   motor[backleft] = - 90;
   motor[frontright] = 90;
   motor[backright] = 90;
}
void moveturnleft(){
   motor[frontleft] = 90;
   motor[backleft] = 90;
   motor[frontright] = 90;
   motor[backright] = 90;
}
void moveturnright(){
   motor[frontleft] = -90;
   motor[backleft] = -90;
   motor[frontright] = -90;
   motor[backright] = -90;
}
task main(){
   while (true){
      getJoystickSettings(joystick);
      if(joy1Btn(1) == 1){
         motor[frontleft] = 90;
         motor[backleft] = 90;
         motor[frontright] = - 90;
         motor[backright] = - 90;
      }

   }
}


If you have any ideas as to why it isn't working, I'm all ears. Thanks!
NOTE: Ignore the voids for moving forward, back, etc., they are there to use once this works.


Fri Nov 07, 2014 4:38 pm
Profile
Professor
User avatar

Joined: Sat Aug 31, 2013 9:15 am
Posts: 256
Post Re: RobotC FTC Joystick not working
Are you using ROBOTC 4.26? If so, there is a known issue where joysticks don't work properly if you have Natural Language enabled. You can disable it under the Robot->Platform Type menu. Alternatively, you could upgrade to version 4.27, which is supposed to have that issue fixed.

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


Fri Nov 07, 2014 11:56 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.