Exemple #1
0
    def do_steps(self, delay):
        if self.delay > delay:
            self.delay = math.exp(-self.count) + 0.0005
            self.count = self.count + 0.01

        GPIO.setmode(GPIO.BCM)
        GPIO.setup(DIR, GPIO.OUT)
        GPIO.setup(STEP, GPIO.OUT)

        GPIO.output(STEP, GPIO.HIGH)
        sleep(self.delay)
        GPIO.output(STEP, GPIO.LOW)
        sleep(self.delay)
        self.steps_taken += 1
        self.update_position()
        Observable.dispatch(self, str(self.get_x()) + ";" + str(self.get_y()))
Exemple #2
0
    def do_steps_slow(self):
        if self.delay > 0.001:
            self.delay = math.exp(-self.count) + 0.0005
            self.count = self.count + 0.0075

        GPIO.setmode(GPIO.BCM)
        GPIO.setup(DIR, GPIO.OUT)
        GPIO.setup(STEP, GPIO.OUT)

        GPIO.output(STEP, GPIO.HIGH)
        sleep(self.delay)
        GPIO.output(STEP, GPIO.LOW)
        sleep(self.delay)
        self.steps_taken += 1
        self.update_position()
        print("[ StepperH ] Steps taken: " + str(self.steps_taken))
        Observable.dispatch(self, str(self.get_x()) + ";" + str(self.get_y()))