Go to Post It's never been about the robots. But the robots make an interesting misdirection that we all use. So its ALL about the robots. :rolleyes: - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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
  #3   Spotlight this post!  
Unread 23-01-2009, 20:30
LinuxMercedes LinuxMercedes is offline
Real men use Macs
FRC #1444 (Lightning Lancers)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: St. Louis, MO
Posts: 22
LinuxMercedes is an unknown quantity at this point
Re: Programming Joystick Buttons to toggle a motor on and off

One bug in your code, byteit101

Quote:
Originally Posted by byteit101 View Post
Joystick stick3(3);//obviously
Jaguar jag1(3);//PWM port 3
bool btn3state=false;


if (stick3.GetRawButton(3))
{
if (!btn3state) //if the button has not been depressed
{
jag3.Set(0.5);
btn3state=true; //the button has been depressed
}
else
{
jag3.Set(0.0);
btn3state=false; //the button was clicked again
}
}
Otherwise, you'd click the button first to set the jag to 0, then the second click would set it to 0.5. Unless I missed something.
__________________
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
joystick and extra buttons TEAM1949 Programming 3 18-02-2008 13:22
Toggle Motor On & Off Help..... programmr Programming 1 16-02-2008 11:15
Programming Extra Joystick Buttons Inverted Programming 2 08-02-2007 11:45
Programming motors with joystick buttons TMHStitans Programming 5 21-03-2005 21:07
joystick buttons and a quick question h0x4r Programming 2 17-02-2005 00:18


All times are GMT -5. The time now is 12:10.

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