Exemple #1
0
    /// <summary>
    /// Sends the specified motor speed values as Chirp audio
    /// </summary>
    public void SendMotorSpeed(sbyte speedLeft, sbyte speedRight)
    {
        // If power is zero, send motor stop instead
        if (speedLeft == 0 && speedRight == 0)
        {
            SendMotorStop();
            return;
        }

        Debug.Log($"Sending MotorSpeed({ speedLeft }, { speedRight })");
        ChirpManager.SendData(new byte[] { (byte)CommandID.MotorSpeed, (byte)speedLeft, (byte)speedRight }); // Make a byte array with type and the motor speeds, then send it as Chirp audio
    }
Exemple #2
0
 /// <summary>
 /// Sends motor stop as Chirp audio
 /// </summary>
 public void SendMotorStop()
 {
     Debug.Log("Sending MotorStop");
     m_SpeedRightText.text = m_SpeedLeftText.text = "0";              // Set UI texts to display '0'
     ChirpManager.SendData(new byte[] { (byte)CommandID.MotorStop }); // Make a byte array with motor stop type, then send it as Chirp audio
 }