Esempio n. 1
0
        private void buttonDebugGetState_Click(object sender, EventArgs e)
        {
            byte[] getoutputstate = { 0x00, 0x06, 0x00 }; // 0, cmd, outputPort
            byte[] response       = bt.SendCommand(getoutputstate);

            SetOutputState s = new SetOutputState();

            s.FromCommand(response);

            textBoxLog.Text += s.ToString();
            textBoxLog.Select(textBoxLog.Text.Length, 0);
            textBoxLog.ScrollToCaret();
        }
Esempio n. 2
0
        public Car(Bluetooth bt, Motor driveMotor, Motor steerMotor,
                   bool drive_reverse = false, bool steer_reverse = false)
        {
            BT         = bt;
            DriveMotor = driveMotor;
            SteerMotor = steerMotor;

            DriveOutput = new SetOutputState(DriveMotor.GetHashCode(), 0,
                                             SetOutputState.ModeType.MotorOn, SetOutputState.RegulationType.MotorSpeed, 0,
                                             SetOutputState.RunStateType.Running, 0, drive_reverse);

            SteerOutput = new SetOutputState(SteerMotor.GetHashCode(), 0,
                                             SetOutputState.ModeType.MotorOn, SetOutputState.RegulationType.MotorSpeed, 0,
                                             SetOutputState.RunStateType.Running, 0, steer_reverse);
        }
Esempio n. 3
0
        private void buttonDebugParse_Click(object sender, EventArgs e)
        {
            string[]    vals    = textBoxDebugResponse.Text.Split(' ');
            List <byte> MsgList = new List <byte>();

            foreach (string v in vals)
            {
                int val = Convert.ToInt32(v, 16);
                MsgList.Add((byte)val);
            }
            byte[] command = MsgList.ToArray();

            SetOutputState s = new SetOutputState();

            s.FromCommand(command);

            textBoxLog.Text += s.ToString();
            textBoxLog.Select(textBoxLog.Text.Length, 0);
            textBoxLog.ScrollToCaret();
        }