|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
||||
|
||||
|
Re: chaging values on an axis/toogle switch
Quote:
In this case you'll need to set a flag up. This will be in psuedocode but it will be something like: You need to set a flag when the button is pressed, the problem is that the button is in an endless loop so you'll have to make sure you only poll the Buttonflag once each time the button is held down, so you'll need another flag for that. Define a ButtonFirstflag Define a Button2flag Initialize the variables at the beginning: Button2flag=false; ButtonHeldflag = true; if (Button2) { if (ButtonFirstflag) { if (!Button2flag) { Button2flag = true; } else { Button2flag = false; } ButtonHeldflag = false; } ButtonHeldflag = true; If (Button2flag) { Motor = forward } else { Motor = stop } There maybe an easier means to do what you are asking, but this is what I use when I want to do what you are talking about. I hope I've helped. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Joystick values (?) | beefy1 | Programming | 1 | 12-23-2008 11:26 AM |
| Joystick axis values in new controller | koreabell | Programming | 7 | 12-17-2008 11:39 AM |
| penalties values??? | colin340 | Rules/Strategy | 4 | 03-08-2008 09:37 PM |
| Need Help Wiring Micro Switch/Limiting Switch | Windward | Electrical | 2 | 02-07-2006 06:26 PM |
| Servo Values | DanDon | Motors | 8 | 02-14-2005 03:49 PM |