Go to Post "If you abuse the easy button, you become it." / "What does that mean?" / "We hit you and you say 'That was easy'" - ScoutingNerd175 [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #2   Spotlight this post!  
Unread 07-02-2009, 12:01
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
Re: button Switch

This is actually a really simple issue for programming. The exact implementation depends on your programming environment. Here is how you would do it in C/C++:

Code:
bool motorIsRunning = false
...
if (theButton == PRESSED)
{
    motorIsRunning = !motorIsRunning;
}

...

if (motorIsRunning)
{
    motorValue = FULL_FWD;
}
else
{
    motorValue = STOP;
}
The one thing that this code will do that is different than what you are looking for (perhaps) is that if you hold down the button, it will continue to flip the motor flag. Of course, this is easy to fix, if you think about it.

Good luck,
Paul
 


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
using a switch/button to turn on a motor smcmahon NI LabVIEW 3 26-01-2009 18:42
Push Button and Switch Suppliers for OI controls Goldberg204 Control System 8 11-01-2007 15:27
push-button switch on robot Conan Electrical 4 10-02-2006 22:03
Need Help Wiring Micro Switch/Limiting Switch Windward Electrical 2 07-02-2006 18:26
Button making Alex Burman Team Organization 7 10-10-2005 21:45


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

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