Go to Post Little kids playing soccer....or a typical Lunacy match. Ah, memories. :cool: - Travis Hoffman [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 06-02-2013, 21:17
wickzam wickzam is offline
Registered User
FRC #4591
 
Join Date: Feb 2013
Location: Canada
Posts: 2
wickzam is an unknown quantity at this point
Help programming joystick buttons

Hello we are team number 4591 we are a rookie team. Our programming team consists of 2 people and we have just started programming a few months ago.

We have sucessfully made our robot move forward and backwards using two joysticks.

We need to move two motors at the same time while holding one button to go clockwise and holding another button to go counter clockwise.

We have tried everything we know, but nothing seemed to work. It would be very helpful if someone could give us an example of a code we can use to run the motors.





Here's what we have so far:
Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.buttons.Button;


public class RobotTemplate extends SimpleRobot{

      RobotDrive chassis= new RobotDrive(1, 2);
      Joystick leftStick= new Joystick(1);
      Joystick rightStick= new Joystick(2);
      
public void autonomus() {
      chassis.setSafetyEnabled(false);
      chassis.drive(-0.05, 0.0);
      Timer.delay(30.0);
      chassis.drive(0.0, 0.0);
}

      public void operatorControl() {
      chassis.setSafetyEnabled(true);  {
            chassis.tankDrive(leftStick, rightStick);
            Timer.delay(0.01);

     }
     }
     }
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi