@@ -0,0 +1,2750 @@
+#!/usr/bin/env python%0A%22%22%22 ArmDroid.py - Basic Class to communicate with an ArmDroid robot.%0A    Specifically developed against an ArmDroid 1000 by D&M Computing%0A%0A    __author__      = %22Joe Romano%22%0A    __license__     = %22BSD%22%0A    __version__     = %220.1%22%0A%22%22%22%0A%22%22%22 Wiring Description%22%22%22%0A%22%22%22 Usage Description%22%22%22%0A%22%22%22 Testing: sudo python ArmDroid.py %22%22%22%0A%0A%0Aimport wiringpi%0A%0A%0Aclass ArmDroid:%0A    %22%22%22 A simple class to speak to the armdroid over the raspberry pi %22%22%22%0A%0A    def __init__(self):%0A        %22%22%22 Initialize the wiringpi interface and set the appropriate%0A            pi pins to be outputs%0A        %22%22%22%0A        # set pins 0-7 as output%0A        # NOTE: these are WiringPi pin numbers%0A        #    https://pinout.xyz/pinout/wiringpi%0A        wiringpi.wiringPiSetup()%0A        for i in range(8):%0A            wiringpi.pinMode(i, wiringpi.OUTPUT)%0A%0A        # define the phase commutation pattern%0A        self._commutate_pattern_pos = %5B0b10000000,  # A%0A                                       0b00001000,  # B%0A                                       0b01000000,  # C%0A                                       0b00000100%5D  # D%0A        # create the reversed pattern for negative commutation%0A        self._commutate_pattern_neg = list(%0A            reversed(self._commutate_pattern_pos))%0A%0A        # the enable bit flag to signal a read%0A        self._enable = 0b00000001%0A%0A        # the various joint mapping codes%0A        self._joint = %5B0b00010000,  # gripper%0A                       0b00000010,  # wrist roll%0A                       0b00010010,  # wrist pitch%0A                       0b00100000,  # upper arm%0A                       0b00110000,  # shoulder%0A                       0b00100010%5D  # base%0A%0A        self._PULSE_TRANSMIT = 1000%0A        self._DELAY_RESET = 1000%0A%0A    def drive_motor(self, motor_idx, steps, dir):%0A        if (motor_idx %3C 0 or motor_idx %3E 5):%0A            return%0A        if steps %3C= 0:%0A            return%0A        if (dir %3C 0 or dir %3E 1):%0A            return%0A%0A        motor = self._joint%5Bmotor_idx%5D%0A%0A        for i in range(steps):%0A            for j in range(len(self._commutate_pattern_pos)):%0A                wiringpi.delayMicroseconds(self._DELAY_RESET)%0A                output = motor%0A                if(dir):%0A                    output = output %7C self._commutate_pattern_pos%5Bj%5D%0A                else:%0A                    output = output %7C self._commutate_pattern_neg%5Bj%5D%0A                wiringpi.digitalWriteByte(output %7C self._enable)%0A                wiringpi.delayMicroseconds(self._PULSE_TRANSMIT)%0A                wiringpi.digitalWriteByte(output)%0A%0A%0Adef main():%0A    a = ArmDroid()%0A    steps = 100%0A    for motor_idx in range(6):%0A        a.drive_motor(motor_idx, steps, 0)%0A        a.drive_motor(motor_idx, steps, 1)%0A%0Aif __name__ == %22__main__%22:%0A    main()%0A

first commit. working python armdroid class