Beispiel #1
0
shoulder_4 = RightShoulder(right_pwm, 0)
elbow_4 = RightElbow(right_pwm, 1)
wrist_4 = RightWrist(right_pwm, 2)
arm_4 = Arm(shoulder_4, elbow_4, wrist_4)

shoulder_5 = RightShoulder(right_pwm, 4)
elbow_5 = RightElbow(right_pwm, 5)
wrist_5 = RightWrist(right_pwm, 6)
arm_5 = Arm(shoulder_5, elbow_5, wrist_5)

shoulder_6 = RightShoulder(right_pwm, 8)
elbow_6 = RightElbow(right_pwm, 9)
wrist_6 = RightWrist(right_pwm, 10)
arm_6 = Arm(shoulder_6, elbow_6, wrist_6)

hexapod = Hexapod(arm_1, arm_2, arm_3, arm_4, arm_5, arm_6)

def left_shoulder_min():
    shoulder_1.move_min()
    shoulder_2.move_min()
    shoulder_3.move_min()
    
def left_shoulder_max():
    shoulder_1.move_max()
    shoulder_2.move_max()
    shoulder_3.move_max()

def left_elbow_min():
    elbow_1.move_min()
    elbow_2.move_min()
    elbow_3.move_min()
Beispiel #2
0
import time

from Adafruit_PWM_Servo_Driver import PWM

from robot import Shoulder, Elbow, Wrist, Arm, Hexapod

sleep_time = 5

left_pwm = PWM(0x40, debug=True)
left_pwm.setPWMFreq(60)

shoulder_1 = Shoulder(left_pwm, 0)
elbow_1 = Elbow(left_pwm, 1)
wrist_1 = Wrist(left_pwm, 2)
arm_1 = Arm(shoulder_1, elbow_1, wrist_1)

hexapod = Hexapod(arm_1, None, None, None, None, None)

while True:
    hexapod.forward()
    time.sleep(sleep_time)