Example #1
0
        /*
         *  Tripod control command
         */

        /// <summary>
        /// Default constructor
        /// </summary>
        public APod()
        {
            // set up 
            Port = new Connector("COM6", 115100);
            Port.Open();

            // head
            head = new Head(new Servo(14, 1500), new Servo(13, 1500), new Servo(29, 1500),
                            new Servo(12, 1500), new Servo(28, 1500));

            // legs
            LeftFront = new Leg(new Servo(16, 1500), new Servo(17, 1500),
                                new Servo(18, 1500), Leg.LEFT);
            LeftCenter = new Leg(new Servo(20, 1500), new Servo(21, 1500),
                                new Servo(22, 1500), Leg.LEFT);
            LeftRear = new Leg(new Servo(24, 1500), new Servo(25, 1500),
                                new Servo(26, 1500), Leg.LEFT);

            RightFront = new Leg(new Servo(0, 1500), new Servo(1, 1500),
                                new Servo(2, 1500), Leg.RIGHT);
            RightCenter = new Leg(new Servo(4, 1500), new Servo(5, 1500),
                                new Servo(6, 1500), Leg.RIGHT);
            RightRear = new Leg(new Servo(8, 1500), new Servo(9, 1500),
                                new Servo(10, 1500), Leg.RIGHT);
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            System.IO.Ports.SerialPort sport = new System.IO.Ports.SerialPort(textBox1.Text,
                                                                              115200,
                                                                              System.IO.Ports.Parity.None,
                                                                              8,
                                                                              System.IO.Ports.StopBits.One);

            try
            {
                sport.Open();
                //string cmd = one.Point(Decimal.ToDouble(numericUpDown1.Value), Decimal.ToDouble(numericUpDown2.Value), 1500);
                string cmd = Leg.Cmd(one.ch1, 1500, Program.TIME) + Leg.Cmd(one.ch2, 1500, Program.TIME) + Leg.Cmd(one.ch3, 1500, Program.TIME);
                toolStripStatusLabel1.Text = cmd;
                sport.Write(cmd + "\r");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            sport.Close();
        }