コード例 #1
0
        private static void RegisterStopSwitches()
        {
            var switch1 = new Positioning.StopSwitch();

            switch1.Pin = ConnectorPin.P1Pin08;
            switch1.Initialize();
            motorControl.RegisterSwitch(switch1);

            var switch2 = new Positioning.StopSwitch();

            switch2.Pin = ConnectorPin.P1Pin10;
            switch2.Initialize();
            motorControl.RegisterSwitch(switch2);

            var switch3 = new Positioning.StopSwitch();

            switch3.Pin = ConnectorPin.P1Pin12;
            switch3.Initialize();
            motorControl.RegisterSwitch(switch3);

            var switch4 = new Positioning.StopSwitch();

            switch4.Pin = ConnectorPin.P1Pin16;
            switch4.Initialize();
            motorControl.RegisterSwitch(switch4);

            var switch5 = new Positioning.StopSwitch();

            switch5.Pin = ConnectorPin.P1Pin18;
            switch5.Initialize();
            motorControl.RegisterSwitch(switch5);
        }
コード例 #2
0
        private void InitSwitches()
        {
            _switches = new List <IStopSwitch>();

            var switch1 = _kernel.Get <IStopSwitch>();

            switch1.Pin    = ConnectorPin.P1Pin08;
            switch1.Number = 1;
            switch1.Initialize();
            //_switches.Add(switch1);
            _motorControl.RegisterSwitch(switch1);

            var switch2 = _kernel.Get <IStopSwitch>();

            switch2.Pin    = ConnectorPin.P1Pin18;
            switch2.Number = 2;
            switch2.Initialize();
            //_switches.Add(switch2);
            _motorControl.RegisterSwitch(switch2);
        }