Example #1
0
 public MotorController(char motorId, ArduinoCommunicationHandler communicationHandler,
     List<Keys> rotateLeftKeys, List<Keys> rotateRightKeys)
 {
     this.motorId = motorId;
     this.communicationHandler = communicationHandler;
     this.rotateLeftKeys = rotateLeftKeys;
     this.rotateRightKeys = rotateRightKeys;
 }
Example #2
0
 public Boat(ArduinoCommunicationHandler arduinoCommunicationHandler)
 {
     communicationHandler = arduinoCommunicationHandler;
     motorStates = new Dictionary<char, MotorState>();
     motorStates.Add(ArduinoCommunicationHandler.HEAD_SAIL_SHEET, MotorState.Stop);
     motorStates.Add(ArduinoCommunicationHandler.JIB_HOIST_ID, MotorState.Stop);
     motorStates.Add(ArduinoCommunicationHandler.MAIN_SAIL_SHEET, MotorState.Stop);
     motorStates.Add(ArduinoCommunicationHandler.TOP_SAIL_HOIST_ID, MotorState.Stop);
     motorStates.Add(ArduinoCommunicationHandler.TOP_SAIL_SHEET, MotorState.Stop);
 }
        public MotorControllerList(ArduinoCommunicationHandler communicationHandler)
        {
            motorControllers = new List<MotorController>();

            // create the motors
            motorControllers.Add(
                new MotorController(
                    ArduinoCommunicationHandler.TOP_SAIL_HOIST_ID,
                    communicationHandler,
                    new[] { Keys.E }.ToList(),
                    new[] { Keys.D }.ToList()
                )
            );

            motorControllers.Add(
                new MotorController(
                    ArduinoCommunicationHandler.JIB_HOIST_ID,
                    communicationHandler,
                    new[] { Keys.R }.ToList(),
                    new[] { Keys.F }.ToList()
                )
            );

            motorControllers.Add(
                new MotorController(
                    ArduinoCommunicationHandler.TOP_SAIL_SHEET,
                    communicationHandler,
                    new[] { Keys.Down, Keys.W }.ToList(),
                    new[] { Keys.Up, Keys.S }.ToList()
                )
            );

            motorControllers.Add(
                new MotorController(
                    ArduinoCommunicationHandler.HEAD_SAIL_SHEET,
                    communicationHandler,
                    new[] { Keys.Up, Keys.Q }.ToList(),
                    new[] { Keys.Down, Keys.A }.ToList()
                )
            );

            motorControllers.Add(
                new MotorController(
                    ArduinoCommunicationHandler.MAIN_SAIL_SHEET,
                    communicationHandler,
                    new[] { Keys.Up }.ToList(),
                    new[] { Keys.Down }.ToList()
                )
            );
        }
Example #4
0
        public FormMain()
        {
            InitializeComponent();

            communicationHandler = new ArduinoCommunicationHandler();
            motorControllerList = new MotorControllerList(communicationHandler);
            boat = new Boat(communicationHandler);
            xboxControllerManager = new XBoxControllerManager();

            string[] portlist = communicationHandler.getCOMPorts();

            foreach (String s in portlist)
            {
                comboBoxCOMPort.Items.Add(s);
            }
        }