Ejemplo n.º 1
0
def main():
    logging_config.debug_disable()
    try:
        if len(sys.argv) > 1:
            # Read file with gcode
            with open(sys.argv[1], 'r') as f:
                for line in f:
                    line = line.strip()
                    print('> ' + line)
                    if not do_line(line):
                        break
        else:
            # Main loop for interactive shell
            # Use stdin/stdout, additional interfaces like
            # UART, Socket or any other can be added.
            print("*************** Welcome to PyCNC! ***************")
            while True:
                line = raw_input('> ')
                if line == 'quit' or line == 'exit':
                    break
                do_line(line)
    except KeyboardInterrupt:
        pass
    print("\r\nExiting...")
    machine.release()
Ejemplo n.º 2
0
def setup():
    webiopi.debug("Basic script - Setup")
    # Setup GPIOs
    GPIO.setFunction(LED_GREEN, GPIO.OUT)
    GPIO.digitalWrite(LED_GREEN, GPIO.LOW)

    webiopi.debug("Set Green LED as ON OFF")

    # # # X Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_X, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_X, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_X, GPIO.IN)
    # #
    # # # Y Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_Y, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_Y, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_Y, GPIO.IN)
    # #
    # # # Z Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_Z, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_Z, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_Z, GPIO.IN)

    logging_config.debug_disable()

    do_line("x5.0 y5.0 z5.0")
    do_line("x0.0 y0.0 z0.0")
    print("Tested XYZ Motion +5mm and Back")
Ejemplo n.º 3
0
def main():
    logging_config.debug_disable()
    try:
        PORT = 10913
        server = HTTPServer(('localhost', PORT), GetHandler)
        print(f'Starting server at http://localhost:{PORT}')
        server.serve_forever()
    except KeyboardInterrupt:
        pass
    print("\r\nExiting...")
    machine.release()
Ejemplo n.º 4
0
def setup():
    webiopi.debug("Basic script - Setup")
    # Setup GPIOs
    GPIO.setFunction(LED_GREEN, GPIO.OUT)
    GPIO.digitalWrite(LED_GREEN, GPIO.LOW)

    webiopi.debug("Set Green LED as ON OFF")

    # # X Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_X, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_X, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_X, GPIO.IN)
    #
    # # Y Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_Y, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_Y, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_Y, GPIO.IN)
    #
    # # Z Axis
    # GPIO.setFunction(STEPPER_STEP_PIN_Z, GPIO.OUT)
    # GPIO.setFunction(STEPPER_DIR_PIN_Z, GPIO.OUT)
    # GPIO.setFunction(ENDSTOP_PIN_Z, GPIO.IN)

    logging_config.debug_disable()