'Set motor direction (reprap.MOTOR_BACKWARD or reprap.MOTOR_FORWARD) and speed (0-255)'

def setMotor(self, direction, speed):

    if ((int(direction) > 0) and (int(direction) < 3) and (int(speed) >= 0) and int((speed <= 255))):
        p = snap.Packet(self.address, snap.localAddress, 0, 1, [int(direction), int(speed)])
        p.send()
    else:
        raise _RepRapError('Invalid    direction    or    speed    value')
