Example #1
0
class MC(Controller):
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log("opened some USBIO okay")
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis("X", self, 0, 1, invert_dir=True, log=log),
            MCAxis("Y", self, 2, 3, invert_dir=False, log=log),
            MCAxis("Z", self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        # self.inches()
        self.um()
        # enforce some initial state?
        # self.off()
        self.log("Controller ready")

    def __del__(self):
        """
        When the pins go to high impedance things seem to go crazy
        Maybe all I need are some pullups / pulldowns
        """
        self.off()

    def off(self):
        self.usbio.set_relay(2, False)
        self.is_on = False

    def on(self):
        """
        After USBIO was plugged in but before it was initialized steppers were freaking out
        I'm not sure the exact cause but I solved it by routing the buffer power
        (USBIO is 3.3V and steppers require 3.5V min 5V safe)
        through relay 2
        """
        self.usbio.set_relay(2, True)
        self.is_on = True
Example #2
0
class MC(Controller):
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log('opened some USBIO okay')
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis('X', self, 0, 1, invert_dir=True, log=log),
            MCAxis('Y', self, 2, 3, invert_dir=False, log=log),
            MCAxis('Z', self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        #self.inches()
        self.um()
        # enforce some initial state?
        #self.off()
        self.log('Controller ready')

    def __del__(self):
        '''
        When the pins go to high impedance things seem to go crazy
        Maybe all I need are some pullups / pulldowns
        '''
        self.off()

    def off(self):
        self.usbio.set_relay(2, False)
        self.is_on = False

    def on(self):
        '''
        After USBIO was plugged in but before it was initialized steppers were freaking out
        I'm not sure the exact cause but I solved it by routing the buffer power
        (USBIO is 3.3V and steppers require 3.5V min 5V safe)
        through relay 2
        '''
        self.usbio.set_relay(2, True)
        self.is_on = True
Example #3
0
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log('opened some USBIO okay')
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis('X', self, 0, 1, invert_dir=True, log=log),
            MCAxis('Y', self, 2, 3, invert_dir=False, log=log),
            MCAxis('Z', self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        #self.inches()
        self.um()
        # enforce some initial state?
        #self.off()
        self.log('Controller ready')
Example #4
0
    def __init__(self, debug=False, log=None):
        Controller.__init__(self, debug=False, log=log)

        self.usbio = USBIO(debug=debug)
        self.log("opened some USBIO okay")
        if self.usbio.serial is None:
            raise Exception("USBIO missing serial")

        self.axes = [
            MCAxis("X", self, 0, 1, invert_dir=True, log=log),
            MCAxis("Y", self, 2, 3, invert_dir=False, log=log),
            MCAxis("Z", self, 4, 5, invert_dir=False, log=log),
        ]

        for axis in self.axes:
            axis.forward(True)
        # self.inches()
        self.um()
        # enforce some initial state?
        # self.off()
        self.log("Controller ready")
Example #5
0
from uvscada.usbio import USBIO
import time

print 'Creating device'
u = USBIO('/dev/ttyACM0', debug=True)

for i in xrange(16):
    print 'Version: %s' % (u.version(),)

print
print 'Done'

Example #6
0
from uvscada.usbio import USBIO
import time

print 'Creating device'
u = USBIO('/dev/ttyACM0', debug=True)

for i in xrange(16):
    print 'Version: %s' % (u.version(), )

print
print 'Done'