Exemple #1
0
 def prox_sensor(self):
     cyprus.initialize()
     if (cyprus.read_gpio() & 0b0010):
         cyprus.set_pwm_values(2, period_value=100000, compare_value=100000, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     else:
         cyprus.set_pwm_values(2, period_value=100000, compare_value=0, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     cyprus.close()
 def quit(self):
     print("Exit")
     arm.free_all()
     GPIO.cleanup()
     GPIO.cleanup()
     cyprus.close()
     MyApp().stop()
 def start_talon(self):
     cyprus.initialize()
     cyprus.set_servo_position(1, 1)
     sleep(5)
     cyprus.set_servo_position(1, 0)
     sleep(5)
     cyprus.set_servo_position(1, 0.5)
     cyprus.close()
Exemple #4
0
 def ramp_up(self):
     cyprus.initialize()
     cyprus.setup_servo(1)
     for i in range(2, 4, 6, 8, 10):
         cyprus.set_servo_speed(1, i/10.0)
         sleep(4)
     cyprus.set_servo_position(1, 0.5)
     cyprus.close()
 def talon_spup(self):
     cyprus.initialize()
     cyprus.set_servo_position(1, 0.5)
     for i in range(6, 11, 1):
         print(i)
         cyprus.set_servo_position(1, i / 10.0)
         sleep(4)
     cyprus.set_servo_position(1, 0.5)
     cyprus.close()
Exemple #6
0
 def cytron_dc(self):
     cyprus.initialize()
     cyprus.set_pwm_values(2, period_value=100000, compare_value=100000, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     sleep(.5)
     cyprus.set_pwm_values(2, period_value=100000, compare_value=0, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     sleep(5)
     cyprus.set_pwm_values(2, period_value=100000, compare_value=-100000, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     sleep(.5)
     cyprus.set_pwm_values(2, period_value=100000, compare_value=0, compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     cyprus.close()
 def exit_program():
     """
     Quit the program. This should free all steppers and do any cleanup necessary
     :return: None
     """
     cyprus.set_servo_position(1, .5)
     cyprus.close()
     spi.close()
     GPIO.cleanup()
     quit()
Exemple #8
0
 def talon_dc(self):
     cyprus.initialize()
     cyprus.setup_servo(1)
     cyprus.set_servo_speed(1, 1)
     sleep(1)
     cyprus.set_servo_speed(1, 0)
     sleep(5)
     cyprus.set_servo_speed(1, -1)
     sleep(1)
     cyprus.set_servo_speed(1, 0)
     cyprus.close()
 def servo_binary(self):
     global bcount
     cyprus.initialize()
     if bcount % 2 == 0:
         self.servooo.text = "0 Deg"
         cyprus.set_servo_position(1, 0)
         sleep(0.1)
     else:
         self.servooo.text = "180 Deg"
         cyprus.set_servo_position(1, 1)
         sleep(0.1)
     bcount += 1
     cyprus.close()
Exemple #10
0
 def switch_button(self):
     global switch_boolean
     cyprus.initialize()
     while switch_boolean:
         if cyprus.read_gpio() & 0b0001:
             sleep(0.1)
             if (cyprus.read_gpio() & 0b0001) == 1:
                 cyprus.set_pwm_values(
                     2,
                     period_value=100000,
                     compare_value=100000,
                     compare_mode=cyprus.LESS_THAN_OR_EQUAL)
         else:
             sleep(0.1)
             if (cyprus.read_gpio() & 0b0001) == 0:
                 cyprus.set_pwm_values(
                     2,
                     period_value=100000,
                     compare_value=0,
                     compare_mode=cyprus.LESS_THAN_OR_EQUAL)
     cyprus.close()
Exemple #11
0
 def free_mtrs(self):
     s1.free()
     cyprus.initialize()
     cyprus.set_servo_position(1, 0.5)
     cyprus.close()
Exemple #12
0
 def quit():
     print("Exit")
     ramp.free()
     cyprus.close()
     MyApp().stop()
 def cleanup(self):
     cyprus.set_servo_position(1, .5)
     cyprus.close()
     spi.close()
     GPIO.cleanup()
     quit()
Exemple #14
0
 def exit_program():
     s0.free_all()
     spi.close()
     GPIO.cleanup()
     cyprus.close()
     quit()
#

# To get a RC servo motor signal out of P4 of the RPiMIB do the following:
cyprus.initialize()  # initialize the RPiMIB and establish communication
cyprus.setup_servo(1)  # sets up P4 on the RPiMIB as a RC servo style output
cyprus.set_servo_position(
    1, 0
)  # 1 specifies port P4, 0 is a float from 0-1 that specifies servo position ~(0-180deg)
sleep(
    1
)  # wait one second for the servo to get there... minimum here should be about sleep(0.05)
cyprus.set_servo_position(
    1, .5
)  # 1 specifies port P4, 0.5 specifies servo position ~(0-180deg) range of (0-1)
# when done disconnect the RPiMIB communication
cyprus.close()

# To get a RC servo motor CONTROLLER signal out of P5 of the RPiMIB do the following:
cyprus.initialize()  # initialize the RPiMIB and establish communication
cyprus.setup_servo(
    2)  # sets up P5 on the RPiMIB as a RC servo motor controller style output
# for loop will set speed all the way from 0-full reverse to 0.5-halt to 1-full forward then halt with half second delays
for i in range(5, 10, 1):
    cyprus.set_servo_position(
        2, i / 10.0)  # 2 specifies port P5, i is a float that specifies speed
    sleep(0.5)
cyprus.set_servo_position(1, 0.5)  # halt the motor
cyprus.close()  # when done disconnect the RPiMIB communication

# To get a Industrial PWM output on P5 to control something like a Cytron Motor Controller do the following:
cyprus.initialize()  # initialize the RPiMIB and establish communication
Exemple #16
0
 def transition_back():
     SCREEN_MANAGER.current = MAIN_SCREEN
     cyprus.close()
Exemple #17
0
             hold_current=20,
             run_current=20,
             accel_current=20,
             deaccel_current=20,
             steps_per_unit=200,
             speed=8)
dire = 0
mcount = 1
dcount = 0
bcount = 1
switch_boolean = False

cyprus.initialize()
cyprus.setup_servo(1)
cyprus.set_servo_position(1, 0.5)
cyprus.close()


class ProjectNameGUI(App):
    """
    Class to handle running the GUI Application
    """
    def build(self):
        """
        Build the application
        :return: Kivy Screen Manager instance
        """
        return SCREEN_MANAGER


Window.clearcolor = (1, 1, 1, 1)  # White