Go to Post A true team can only be formed by people who care about each other and that have a common goal... - keehun [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
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 24-01-2016, 12:43
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 217
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Running different functions at the same time?

Hi,

So we are planning on making a shooter to throw the boulders into the high goal. I need to be able to spin the shooter motor while the pneumatics are being retracted.

My thought would be to have another thread using Python's threading module and just starting a new thread for the motor but I don't know if that is the recommended way of accomplishing it. Here is an example of what I have. I need that for loop to be going while the pneumatics are being set to false.
Code:
        if self.arm1.get()==True:

            for i in range(100): #I need this to be on while the solenoids retract
                self.shooter.set(1)

            self.arm1.set(False)
            self.arm2.set(False)
        else:
            self.arm1.set(True)
            self.arm2.set(True)

            for i in range(100): #I need this to be on while the solenoids retract
                self.shooter.set(1)

            self.arm1.set(False)
            self.arm2.set(False)

Thanks!

Last edited by team-4480 : 24-01-2016 at 13:20.
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 06:25.

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