def check_message(): print("Checking for message") resp = queue.get(max=1, timeout=None) messages = resp['messages'] if (len(messages) > 0): message = messages[0] message_id = message['id'] message_body = message['body'] queue.clear() print("Rotating feeder") stepper.rotate(1024, 5, 2) time.sleep(2) stepper.rotate(1024, 5, 2)
def check_message(): print("Checking for message") resp = queue.get(max=1, timeout=None) messages = resp['messages'] if (len(messages) > 0): message = messages[0] message_id = message['id'] message_body = message['body'] queue.clear() print("Rotating feeder") stepper.rotate(1024,5,2) time.sleep(2) stepper.rotate(1024,5,2)
def wiggle(control_pins): stepper.rotate(control_pins, angle=15, direction=stepper.Direction.CounterClockWise) time.sleep(0.1) stepper.rotate(control_pins, angle=15, direction=stepper.Direction.ClockWise) time.sleep(0.1) stepper.rotate(control_pins, angle=15, direction=stepper.Direction.CounterClockWise) time.sleep(0.1) stepper.rotate(control_pins, angle=15, direction=stepper.Direction.ClockWise) time.sleep(0.1)
def turn_right(): stepper.rotate(control_pins, angle=90, direction=stepper.Direction.CounterClockWise) head_position = HeadPosition.Right
def turn_left(): stepper.rotate(control_pins, angle=90, direction=stepper.Direction.ClockWise) head_position = HeadPosition.Left
def lift_up(control_pins): stepper.rotate(control_pins, angle=90, direction=stepper.Direction.ClockWise)
def lift_down(control_pins): stepper.rotate(control_pins, angle=90, direction=stepper.Direction.CounterClockWise)