Exemple #1
0
        public static void Main()
        {
            //FanTacho.Intialize(Cpu.Pin.GPIO_Pin13);//not working dont use

            X = new Axis("X", Pins.GPIO_PIN_D11, Pins.GPIO_PIN_D4, Pins.GPIO_PIN_D3);
            Y = new Axis("Y", Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D8, Pins.GPIO_PIN_A1);
            Z = new Axis("Z", Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_A2);

            ExternalDevices = new Devices(Pins.GPIO_PIN_A4, Pins.GPIO_PIN_A3, Pins.GPIO_NONE);

            X.OnAxisLimitReached += OnAxisLimitReached;
            Y.OnAxisLimitReached += OnAxisLimitReached;
            Z.OnAxisLimitReached += OnAxisLimitReached;

            EStopButton.OnInterrupt += EStopButton_OnPress;

            EnableSteppers(false);              // don't drive the stepper coils while idle
            SetStepResolution("2");             // half stepping by default
            ServoZTemp.Angle = 10;              // raise the sharpie on reboot

            Controller = new MotionController(X, Y, Z, ExternalDevices);

            var socketServer = new SocketServer();
            socketServer.OnRequest += SocketServer_OnRequest;

            BlinkLED(3, false);       // Visual "Ready" Cue

            // Boot up in E-Stop mode to require an initializing communication from the controller UI
            SetEStop();

            socketServer.ListenForRequest();
        }
Exemple #2
0
        private static void SocketServer_OnRequest(object sender, SocketServer.RequestHandlerEventArgs e)
        {
            bool responseError = false;

            e.ResponseMessage = ExecuteCommand(e.RequestCommand, out responseError);
            e.ResponseError = responseError;
        }