Go to Post Our coolant system consists of a freshman with a squirt bottle. - Holtzman [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2012, 01:58
Luiz12 Luiz12 is offline
Registered User
FRC #4210
 
Join Date: Jan 2012
Location: South Gate
Posts: 45
Luiz12 is an unknown quantity at this point
Running loop with button..

Basically I want to press a button, let go, and I want the motors to run continuously until the limit switch is pressed and then roll back for 3.9 sec then stop. I gotten to that point as shown in the code below, but I haven't gotten to the point on the code below. I can run everything while holding the button but I just want to press and let go. This goes in my teleop.vi


When the center Case structure is true, its just a simple set output motor vi with a value of 1.
  #2   Spotlight this post!  
Unread 16-02-2012, 11:49
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Running loop with button..

Don't put that in Teleop. The 3900 millisecond delay in there will bring everything else in the code to a halt, including the communication with the Driver Station, and the system watchdog will shut down the robot's outputs.

Do you know how to use the Flat Sequence structure? One of those in a neverending While loop placed in the Periodic Tasks vi is probably the right way to implement what you want. The first frame of the sequence will stop the motor and have a loop waiting for the button to be pressed. The second frame will run the motor and have a loop waiting for the limit switch. The third frame will reverse the motor and delay 3.9 seconds. If that's not enough of a hint, let me know.
  #3   Spotlight this post!  
Unread 16-02-2012, 22:48
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Running loop with button..

Here's what I was trying to describe.
Attached Thumbnails
Click image for larger version

Name:	button loop.png
Views:	41
Size:	48.0 KB
ID:	11935  
  #4   Spotlight this post!  
Unread 17-02-2012, 01:49
Luiz12 Luiz12 is offline
Registered User
FRC #4210
 
Join Date: Jan 2012
Location: South Gate
Posts: 45
Luiz12 is an unknown quantity at this point
Re: Running loop with button..

So I just delete every thing that was in the teleop.vi and post it in the example in the periodic tasks.vi
Closed Thread


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 00:44.

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