View Single Post
  #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: 216
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