private void ChangeMotors(object sender, MotorEventArgs e)
        {
            arduino.write("m" +
                          ((int)(e.left * 255)).ToString() + "," +
                          ((int)(e.right * 255)).ToString() + ";");
            System.Diagnostics.Debug.WriteLine("m" +
                                               ((int)(e.left * 255)).ToString() + "," +
                                               ((int)(e.right * 255)).ToString() + ";");
            //System.Diagnostics.Debug.WriteLine(Math.Round(192 - (64 * e.left)) + "," + Math.Round(64 - (63 * e.right)));

            /*
             * char c = (char)((byte)(e.left < 0 ? 0x1 : 0x0) | (byte)(e.right < 0 ? 0x2 : 0x0));
             * char left = (char)((byte)(e.left * 255));
             * char right = (char)((byte)(e.right * 255));
             * string s = c.ToString() + left.ToString() + right.ToString();
             * arduino.write(s);
             */
        }
Exemple #2
0
 private void ChangeMotors(object sender, MotorEventArgs e)
 {
     html.call(@"ml/" + e.left + @"/mr/" + e.right);
 }