public static Vector4 RecordSensorError(int number)
    {
        Debug.Log("RecordSensorError is done");
        return(Wii.GetBalanceBoard(number));

        // TobeFinished
    }
    // Update is called once per frame
    void Update()
    {
        List <string> stringList = new List <string>();

        stringList.Add("remoteCount:" + Wii.GetRemoteCount());
        for (int i = 0; i < Wii.GetRemoteCount(); ++i)
        {
            if (Wii.IsActive(i) && Wii.GetExpType(i) == 3)
            {
                Vector4 theBalanceBoard = Wii.GetBalanceBoard(i);
                Vector2 theCenter       = Wii.GetCenterOfBalance(i);
                float   topWeight       = theBalanceBoard.x + theBalanceBoard.y;
                float   bottomWeight    = theBalanceBoard.z + theBalanceBoard.w;
                float   topBottomDiff   = topWeight - bottomWeight;
                stringList.Add("totalWeight:  " + Wii.GetTotalWeight(i) + " kg");
                stringList.Add("centerX:      " + theCenter.x);
                stringList.Add("centerY:      " + theCenter.y);
                stringList.Add("topRight:     " + theBalanceBoard.x + " kg");
                stringList.Add("topLeft:      " + theBalanceBoard.y + " kg");
                stringList.Add("bottomRight:  " + theBalanceBoard.z + " kg");
                stringList.Add("bottomLeft:   " + theBalanceBoard.w + " kg");
                stringList.Add("topWeight:    " + topWeight + " kg");
                stringList.Add("bottomWeight: " + bottomWeight + " kg");
                stringList.Add("topBottomDiff:" + topBottomDiff + " kg");
            }
        }
        consoleText.text = string.Join("\n", stringList);
    }
Esempio n. 3
0
    // Zeroes center of balance to the position on which a person is standing on the board
    public void CalibrateCenterOfBalance()
    {
        float   weight             = Wii.GetTotalWeight(remote) / 4;
        Vector4 weigthDistribution = Wii.GetBalanceBoard(remote);

        weightOffset = new Vector4(weight, weight, weight, weight) - weigthDistribution;

        balanceOffset = (float)Wii.GetCenterOfBalance(remote).y;
    }
Esempio n. 4
0
    void FixedUpdate()
    {
        if (Wii.IsActive(whichRemote))            //remote is on
        {
            if (Wii.GetExpType(whichRemote) == 3) //balance board is being used
            {
                Vector4 theBalanceBoard = Wii.GetBalanceBoard(whichRemote);
                Vector2 theCenter       = Wii.GetCenterOfBalance(whichRemote);
                Debug.Log(theBalanceBoard + " " + theCenter);
                Debug.Log("the total weight is: k" + Wii.GetTotalWeight(whichRemote));

                // move self according the center of gravity
                rigidbody.AddForce(new Vector3(theCenter.x * speed, 0, theCenter.y * speed));
            }
        }
    }
Esempio n. 5
0
    // Send data from a board to the NewRobotController
    public void SendWheelRatio()
    {
        // Add offset to bring weight distribution on the board to zero while standing still
        Vector4 board = Wii.GetBalanceBoard(remote) + weightOffset;

        // Calculates distribution of front and back sensors on both sides independently
        float rightWheel = (board.x - board.z) / (board.x + board.z);
        float leftWheel  = (board.y - board.w) / (board.y + board.w);

        // Normalize values to start from the min need lean
        rightWheel = Normalize(rightWheel, minZone);
        leftWheel  = Normalize(leftWheel, minZone);

        // Send data to the NewRobotController
        NewRobotController.Instance.leftTarget  = leftWheel;
        NewRobotController.Instance.rightTarget = rightWheel;
    }
Esempio n. 6
0
    public void FixedUpdate()
    {
        // a -> Z-axis, b -> X-axis
        float x_axes = ((Wii.GetBalanceBoard(0).x + Wii.GetBalanceBoard(0).z) -   ////////////var x_axes yerine float yazdım
                        (Wii.GetBalanceBoard(0).y + Wii.GetBalanceBoard(0).w));

        float z_axes = ((Wii.GetBalanceBoard(0).x + Wii.GetBalanceBoard(0).y) -
                        (Wii.GetBalanceBoard(0).w + Wii.GetBalanceBoard(0).z));

        if (Wii.GetTotalWeight(0) > 0)
        {
            // Move translation along the object's z-axis

            Rigidbody.AddRelativeForce(x_axes / 8, 0, z_axes / 5);

            //   Debug.Log("x_axes: " + x_axes/8 + "\tz_axes: " + z_axes/5);
        }
    }
Esempio n. 7
0
    // Update is called once per frame
    void FixedUpdate()
    {
        /*     Returns the weight in kilograms on each of the four sensors in the balance board.
         *             The x-value is the top right sensor.
         *             The y-value is the top left sensor.
         *             The z-value is the bottom right sensor.
         *             The w-value is the bottom left sensor.  */

        x.text = Wii.GetBalanceBoard(0).x.ToString();
        y.text = Wii.GetBalanceBoard(0).y.ToString();
        z.text = Wii.GetBalanceBoard(0).z.ToString();
        w.text = Wii.GetBalanceBoard(0).w.ToString();

        /*     Returns the raw values generated by the four sensors in the balance board.
         *             The x-value is the top right sensor.
         *             The y-value is the top left sensor.
         *             The z-value is the bottom right sensor.
         *             The w-value is the bottom left sensor.  */

        a.text = Wii.GetRawBalanceBoard(0).x.ToString();
        b.text = Wii.GetRawBalanceBoard(0).y.ToString();
        c.text = Wii.GetRawBalanceBoard(0).z.ToString();
        d.text = Wii.GetRawBalanceBoard(0).w.ToString();

/*    Returns a Vector 2 representing the distribution of weight on the balance board.
 *     The x-value represents the difference in weight between the right and left sides.
 *     The y-value represents the difference in weight between the front and back sides.
 *    If there is no weight or the weight is evenly distributed, Vector2.zero is returned. */

        e.text = Wii.GetCenterOfBalance(0).x.ToString();
        f.text = Wii.GetCenterOfBalance(0).y.ToString();

        DBManager.rl_balance = Wii.GetCenterOfBalance(0).x;
        DBManager.fb_balance = Wii.GetCenterOfBalance(0).y;

        balance.text = ((Wii.GetCenterOfBalance(0).x + Wii.GetCenterOfBalance(0).y) / 2).ToString();

        //     Returns the total weight on the balance board in kilograms.

        h.text = Wii.GetTotalWeight(0).ToString();
    }
Esempio n. 8
0
 void Update()
 {
     for (int i = 0; i < Wii.GetRemoteCount(); ++i)
     {
         if (Wii.IsActive(i) && Wii.GetExpType(i) == 3)
         {
             Vector4 theBalanceBoard = Wii.GetBalanceBoard(i);
             Vector2 theCenter       = Wii.GetCenterOfBalance(i);
             float   topWeight       = theBalanceBoard.x + theBalanceBoard.y;
             float   bottomWeight    = theBalanceBoard.z + theBalanceBoard.w;
             float   totalWeight     = Wii.GetTotalWeight(i);
             float   topBottomDiff   = topWeight - bottomWeight;
             bool    beforeIsRide    = IsRide;
             IsRide = totalWeight > RideThreasoldWeight;
             if (IsRide)
             {
                 if (OnRidingWeightSreeem != null)
                 {
                     OnRidingWeightSreeem(theCenter, theBalanceBoard);
                 }
                 ResetGameTimeSecond = 0f;
                 if (Mathf.Abs(topBottomDiff) > (totalWeight * TriggerThreasoldRate))
                 {
                     if (topBottomDiff > 0)
                     {
                     }
                     else
                     {
                     }
                 }
                 else
                 {
                 }
             }
             break;
         }
     }
 }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        totalRemotes = Wii.GetRemoteCount();

        theRemoteNumber.text = "Remote on Display:" + (whichRemote + 1).ToString();

        for (var x = 0; x < 16; x++)
        {
            if (Wii.IsActive(x))
            {
                //remote button visible or not?
                selectButtons[x].interactable = true;
            }
            else
            {
                selectButtons[x].interactable = false;
            }
        }

        if (Wii.IsActive(whichRemote))
        {
            dropButton.SetActive(true);

            if (Wii.HasMotionPlus(whichRemote))
            {
                //deactivate motion plus
                deactivateMotionButton.SetActive(true);
                detectMotionButton.SetActive(false);

                if (Wii.IsMotionPlusCalibrated(whichRemote))
                {
                    Debug.Log("motion plus is calibrated");
                    //uncalibrate motion plus
                    uncalibrateMotionButton.SetActive(true);
                    calibrateMotionButton.SetActive(false);
                }
                else
                {
                    Debug.Log("motion plus is uncalibrated");
                    uncalibrateMotionButton.SetActive(false);
                    calibrateMotionButton.SetActive(true);
                    //calibrate motion plus
                }
            }
            else
            {
                calibrateMotionButton.SetActive(false);
                uncalibrateMotionButton.SetActive(false);
                deactivateMotionButton.SetActive(false);
                detectMotionButton.SetActive(true);
                //check for motion plus
            }


            theRemoteNumber.enabled = true;
            var inputDisplay = "";
            inputDisplay = inputDisplay + "Remote #" + whichRemote.ToString();
            inputDisplay = inputDisplay + "\nbattery " + Wii.GetBattery(whichRemote).ToString();

            if (Wii.GetExpType(whichRemote) == 3)         //balance board is in is in
            {
                balanceBoard.gameObject.SetActive(true);
                wiimote.gameObject.SetActive(false);

                Vector4 theBalanceBoard = Wii.GetBalanceBoard(whichRemote);
                Vector2 theCenter       = Wii.GetCenterOfBalance(whichRemote);
                //Debug.Log(theBalanceBoard+" "+theCenter);
                balanceTopLeft.localScale     = new Vector3(balanceTopLeft.localScale.x, 1f - (.01f * theBalanceBoard.y), balanceTopLeft.localScale.z);
                balanceTopRight.localScale    = new Vector3(balanceTopRight.localScale.x, 1f - (.01f * theBalanceBoard.x), balanceTopRight.localScale.z);
                balanceBottomLeft.localScale  = new Vector3(balanceBottomLeft.localScale.x, 1f - (.01f * theBalanceBoard.w), balanceBottomLeft.localScale.z);
                balanceBottomRight.localScale = new Vector3(balanceBottomRight.localScale.x, 1f - (.01f * theBalanceBoard.z), balanceBottomRight.localScale.z);

                theIR1.position  = new Vector2(Screen.width / 2 - (Screen.width / 4), Screen.height / 2 + (Screen.height / 4));
                theIR1.sizeDelta = new Vector2(10, 10);

                theIR2.position  = new Vector2(Screen.width / 2 + (Screen.width / 4), Screen.height / 2 + (Screen.height / 4));
                theIR2.sizeDelta = new Vector2(10, 10);

                theIR3.position  = new Vector2(Screen.width / 2 - (Screen.width / 4), Screen.height / 2 - (Screen.height / 4));
                theIR3.sizeDelta = new Vector2(10, 10);

                theIR4.position  = new Vector2(Screen.width / 2 + (Screen.width / 4), Screen.height / 2 - (Screen.height / 4));
                theIR4.sizeDelta = new Vector2(10, 10);

                theIRMain.position  = new Vector2((Screen.width / 2) + (theCenter.x * (Screen.width / 4)), (Screen.height / 2) + (theCenter.y * Screen.height / 4));
                theIRMain.sizeDelta = new Vector2(50, 50);

                inputDisplay = inputDisplay + "\nBALANCE BOARD";
                inputDisplay = inputDisplay + "\ntotal Weight " + Wii.GetTotalWeight(whichRemote) + "kg";
                inputDisplay = inputDisplay + "\ntopRight     " + theBalanceBoard.x + "kg";
                inputDisplay = inputDisplay + "\ntopLeft      " + theBalanceBoard.y + "kg";
                inputDisplay = inputDisplay + "\nbottomRight  " + theBalanceBoard.z + "kg";
                inputDisplay = inputDisplay + "\nbottomLeft   " + theBalanceBoard.w + "kg";
            }
            else
            {
                ///WIIREMOTE
                wiimote.gameObject.SetActive(true);
                Vector3[] pointerArray = Wii.GetRawIRData(whichRemote);
                Vector2   mainPointer  = Wii.GetIRPosition(whichRemote);
                Vector3   wiiAccel     = Wii.GetWiimoteAcceleration(whichRemote);

                theIRMain.position  = new Vector2(mainPointer.x * Screen.width, mainPointer.y * Screen.height);
                theIRMain.sizeDelta = new Vector2(50, 50);
                float sizeScale = 5.0f;

                theIRMain.position  = new Vector2(mainPointer.x * Screen.width, mainPointer.y * Screen.height);
                theIRMain.sizeDelta = new Vector2(50, 50);

                theIR1.position = new Vector2(pointerArray[0].x * Screen.width - (pointerArray[0].z * sizeScale / 2.0f),
                                              pointerArray[0].y * Screen.height - (pointerArray[0].z * sizeScale / 2.0f));
                theIR1.sizeDelta = new Vector2(pointerArray[0].z * sizeScale * 10, pointerArray[0].z * sizeScale * 10);

                theIR2.position = new Vector2(pointerArray[1].x * Screen.width - (pointerArray[1].z * sizeScale / 2.0f),
                                              pointerArray[1].y * Screen.height - (pointerArray[1].z * sizeScale / 2.0f));
                theIR2.sizeDelta = new Vector2(pointerArray[1].z * sizeScale * 10, pointerArray[1].z * sizeScale * 10);

                theIR3.position = new Vector2(pointerArray[2].x * Screen.width - (pointerArray[2].z * sizeScale / 2.0f),
                                              pointerArray[2].y * Screen.height - (pointerArray[2].z * sizeScale / 2.0f));
                theIR3.sizeDelta = new Vector2(pointerArray[2].z * sizeScale * 10, pointerArray[2].z * sizeScale * 10);

                theIR4.position = new Vector2(pointerArray[3].x * Screen.width - (pointerArray[3].z * sizeScale / 2.0f),
                                              pointerArray[3].y * Screen.height - (pointerArray[3].z * sizeScale / 2.0f));
                theIR4.sizeDelta = new Vector2(pointerArray[3].z * sizeScale * 10, pointerArray[3].z * sizeScale * 10);

                wiimote.localRotation = Quaternion.Slerp(transform.localRotation,
                                                         Quaternion.Euler(wiiAccel.y * 90.0f, 0.0f, wiiAccel.x * -90.0f), 5.0f);

                if (Wii.GetButton(whichRemote, "A"))
                {
                    buttonA.SetActive(true);
                }
                else
                {
                    buttonA.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "B"))
                {
                    buttonB.SetActive(true);
                }
                else
                {
                    buttonB.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "UP"))
                {
                    buttonUp.SetActive(true);
                }
                else
                {
                    buttonUp.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "DOWN"))
                {
                    buttonDown.SetActive(true);
                }
                else
                {
                    buttonDown.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "LEFT"))
                {
                    buttonLeft.SetActive(true);
                }
                else
                {
                    buttonLeft.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "RIGHT"))
                {
                    buttonRight.SetActive(true);
                }
                else
                {
                    buttonRight.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "MINUS"))
                {
                    buttonMinus.SetActive(true);
                }
                else
                {
                    buttonMinus.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "PLUS"))
                {
                    buttonPlus.SetActive(true);
                }
                else
                {
                    buttonPlus.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "HOME"))
                {
                    buttonHome.SetActive(true);
                }
                else
                {
                    buttonHome.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "ONE"))
                {
                    buttonOne.SetActive(true);
                }
                else
                {
                    buttonOne.SetActive(false);
                }
                if (Wii.GetButton(whichRemote, "TWO"))
                {
                    buttonTwo.SetActive(true);
                }
                else
                {
                    buttonTwo.SetActive(false);
                }

                inputDisplay = inputDisplay + "\nIR      " + Wii.GetIRPosition(whichRemote).ToString("#.0000");
                inputDisplay = inputDisplay + "\nIR rot  " + Wii.GetIRRotation(whichRemote).ToString();
                inputDisplay = inputDisplay + "\nA       " + Wii.GetButton(whichRemote, "A").ToString();
                inputDisplay = inputDisplay + "\nB       " + Wii.GetButton(whichRemote, "B").ToString();
                inputDisplay = inputDisplay + "\n1       " + Wii.GetButton(whichRemote, "1").ToString();
                inputDisplay = inputDisplay + "\n2       " + Wii.GetButton(whichRemote, "2").ToString();
                inputDisplay = inputDisplay + "\nUp      " + Wii.GetButton(whichRemote, "UP").ToString();
                inputDisplay = inputDisplay + "\nDown    " + Wii.GetButton(whichRemote, "DOWN").ToString();
                inputDisplay = inputDisplay + "\nLeft    " + Wii.GetButton(whichRemote, "LEFT").ToString();
                inputDisplay = inputDisplay + "\nRight   " + Wii.GetButton(whichRemote, "RIGHT").ToString();
                inputDisplay = inputDisplay + "\n-       " + Wii.GetButton(whichRemote, "-").ToString();
                inputDisplay = inputDisplay + "\n+       " + Wii.GetButton(whichRemote, "+").ToString();
                inputDisplay = inputDisplay + "\nHome    " + Wii.GetButton(whichRemote, "HOME").ToString();
                inputDisplay = inputDisplay + "\nAccel   " + Wii.GetWiimoteAcceleration(whichRemote).ToString("#.0000");

                Debug.Log(whichRemote);
                Debug.Log(Wii.GetWiimoteAcceleration(whichRemote));

                if (Wii.HasMotionPlus(whichRemote))
                {
                    motionPlus.gameObject.SetActive(true);
                    Vector3 motion = Wii.GetMotionPlus(whichRemote);
                    if (Input.GetKeyDown("space") || Wii.GetButtonDown(whichRemote, "HOME"))
                    {
                        motionPlus.localRotation = Quaternion.identity;
                    }
                    motionPlus.RotateAround(motionPlus.position, motionPlus.right, motion.x);
                    motionPlus.RotateAround(motionPlus.position, motionPlus.up, -motion.y);
                    motionPlus.RotateAround(motionPlus.position, motionPlus.forward, motion.z);

                    Debug.Log(motionPlus.rotation.x);
                    Debug.Log(motionPlus.rotation.y);
                    Debug.Log(motionPlus.rotation.z);

                    inputDisplay = inputDisplay + "\nMotion+ " + motion.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nYAW FAST " + Wii.IsYawFast(whichRemote);
                    inputDisplay = inputDisplay + "\nROLL FAST " + Wii.IsRollFast(whichRemote);
                    inputDisplay = inputDisplay + "\nPITCH FAST " + Wii.IsPitchFast(whichRemote);
                }
                else
                {
                    motionPlus.gameObject.SetActive(false);
                }

                if (Wii.GetExpType(whichRemote) == 1)             //nunchuck is in
                {
                    nunchuk.gameObject.SetActive(true);
                    nunchuk.localRotation = Quaternion.Slerp(transform.localRotation,
                                                             Quaternion.Euler(Wii.GetNunchuckAcceleration(whichRemote).y * 90.0f,
                                                                              0.0f,
                                                                              Wii.GetNunchuckAcceleration(whichRemote).x *-90f),
                                                             5.0f);

                    nunchuckStick.rotation = nunchuk.rotation;
                    nunchuckStick.RotateAround(nunchuckStick.position, nunchuckStick.right, Wii.GetAnalogStick(whichRemote).y *30.0f);
                    nunchuckStick.RotateAround(nunchuckStick.position, nunchuckStick.forward, Wii.GetAnalogStick(whichRemote).x *-30.0f);

                    if (Wii.GetButton(whichRemote, "C"))
                    {
                        buttonC.SetActive(true);
                    }
                    else
                    {
                        buttonC.SetActive(false);
                    }
                    if (Wii.GetButton(whichRemote, "Z"))
                    {
                        buttonZ.SetActive(true);
                    }
                    else
                    {
                        buttonZ.SetActive(false);
                    }

                    inputDisplay = inputDisplay + "\nNUNCHUCK";
                    inputDisplay = inputDisplay + "\nC       " + Wii.GetButton(whichRemote, "C").ToString();
                    inputDisplay = inputDisplay + "\nZ       " + Wii.GetButton(whichRemote, "Z").ToString();
                    inputDisplay = inputDisplay + "\nnunchuckStick N " + Wii.GetAnalogStick(whichRemote).ToString("#.0000");
                    inputDisplay = inputDisplay + "\nAccel N " + Wii.GetNunchuckAcceleration(whichRemote).ToString("#.0000");
                }
                else if (Wii.GetExpType(whichRemote) == 2)             //classic controller is in
                {
                    classic.gameObject.SetActive(true);
                    Vector2 theStickLeft  = Wii.GetAnalogStick(whichRemote, "CLASSICLEFT");
                    Vector2 theStickRight = Wii.GetAnalogStick(whichRemote, "CLASSICRIGHT");

                    classicStickLeft.rotation = classic.rotation;
                    classicStickLeft.RotateAround(classicStickLeft.position, transform.right,
                                                  theStickLeft.y * 30.0f);
                    classicStickLeft.RotateAround(classicStickLeft.position, transform.forward,
                                                  theStickLeft.x * -30.0f);

                    classicStickRight.rotation = classic.rotation;
                    classicStickRight.RotateAround(classicStickRight.position, transform.right,
                                                   theStickRight.y * 30.0f);
                    classicStickRight.RotateAround(classicStickRight.position, transform.forward,
                                                   theStickRight.x * -30.0f);

                    buttonClassicL.transform.localScale = new Vector3(4.0f * Wii.GetAnalogButton(whichRemote, "CLASSICL"), buttonClassicL.transform.localScale.y, buttonClassicL.transform.localScale.z);
                    buttonClassicR.transform.localScale = new Vector3(4.0f * Wii.GetAnalogButton(whichRemote, "CLASSICR"), buttonClassicL.transform.localScale.y, buttonClassicL.transform.localScale.z);

                    buttonClassicA.SetActive(Wii.GetButton(whichRemote, "CLASSICA"));
                    buttonClassicB.SetActive(Wii.GetButton(whichRemote, "CLASSICB"));
                    buttonClassicMinus.SetActive(Wii.GetButton(whichRemote, "CLASSICMINUS"));
                    buttonClassicPlus.SetActive(Wii.GetButton(whichRemote, "CLASSICPLUS"));
                    buttonClassicHome.SetActive(Wii.GetButton(whichRemote, "CLASSICHOME"));
                    buttonClassicX.SetActive(Wii.GetButton(whichRemote, "CLASSICX"));
                    buttonClassicY.SetActive(Wii.GetButton(whichRemote, "CLASSICY"));
                    buttonClassicUp.SetActive(Wii.GetButton(whichRemote, "CLASSICUP"));
                    buttonClassicDown.SetActive(Wii.GetButton(whichRemote, "CLASSICDOWN"));
                    buttonClassicLeft.SetActive(Wii.GetButton(whichRemote, "CLASSICLEFT"));
                    buttonClassicRight.SetActive(Wii.GetButton(whichRemote, "CLASSICRIGHT"));
                    buttonClassicL.SetActive(Wii.GetButton(whichRemote, "CLASSICL"));
                    buttonClassicR.SetActive(Wii.GetButton(whichRemote, "CLASSICR"));
                    buttonClassicZL.SetActive(Wii.GetButton(whichRemote, "CLASSICZL"));
                    buttonClassicZR.SetActive(Wii.GetButton(whichRemote, "CLASSICZR"));

                    inputDisplay = inputDisplay + "\n CLASSIC";
                    inputDisplay = inputDisplay + "\na       " + Wii.GetButton(whichRemote, "CLASSICA").ToString();
                    inputDisplay = inputDisplay + "\nb       " + Wii.GetButton(whichRemote, "CLASSICB").ToString();
                    inputDisplay = inputDisplay + "\n-       " + Wii.GetButton(whichRemote, "CLASSICMINUS").ToString();
                    inputDisplay = inputDisplay + "\n+       " + Wii.GetButton(whichRemote, "CLASSICPLUS").ToString();
                    inputDisplay = inputDisplay + "\nhome    " + Wii.GetButton(whichRemote, "CLASSICHOME").ToString();
                    inputDisplay = inputDisplay + "\nx       " + Wii.GetButton(whichRemote, "CLASSICX").ToString();
                    inputDisplay = inputDisplay + "\ny       " + Wii.GetButton(whichRemote, "CLASSICY").ToString();
                    inputDisplay = inputDisplay + "\nup      " + Wii.GetButton(whichRemote, "CLASSICUP").ToString();
                    inputDisplay = inputDisplay + "\ndown    " + Wii.GetButton(whichRemote, "CLASSICDOWN").ToString();
                    inputDisplay = inputDisplay + "\nleft    " + Wii.GetButton(whichRemote, "CLASSICLEFT").ToString();
                    inputDisplay = inputDisplay + "\nright   " + Wii.GetButton(whichRemote, "CLASSICRIGHT").ToString();
                    inputDisplay = inputDisplay + "\nL       " + Wii.GetButton(whichRemote, "CLASSICL").ToString();
                    inputDisplay = inputDisplay + " " + Wii.GetAnalogButton(whichRemote, "CLASSICL").ToString("#.000");
                    inputDisplay = inputDisplay + "\nR       " + Wii.GetButton(whichRemote, "CLASSICR").ToString();
                    inputDisplay = inputDisplay + " " + Wii.GetAnalogButton(whichRemote, "CLASSICR").ToString("#.000");
                    inputDisplay = inputDisplay + "\nZL      " + Wii.GetButton(whichRemote, "CLASSICZL").ToString();
                    inputDisplay = inputDisplay + "\nZR      " + Wii.GetButton(whichRemote, "CLASSICZR").ToString();
                    inputDisplay = inputDisplay + "\nStick L " + theStickLeft.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nStick R " + theStickRight.ToString("#.0000");
                }
                else if (Wii.GetExpType(whichRemote) == 4)             //guitar is in
                {
                    guitarBody.gameObject.SetActive(true);
                    var theStick  = Wii.GetAnalogStick(whichRemote, "GUITAR");
                    var theWhammy = Wii.GetGuitarWhammy(whichRemote);
                    var theStrum  = Wii.GetGuitarStrum(whichRemote);


                    buttonGuitarGreen.SetActive(Wii.GetButton(whichRemote, "GUITARGREEN"));
                    buttonGuitarRed.SetActive(Wii.GetButton(whichRemote, "GUITARRED"));
                    buttonGuitarYellow.SetActive(Wii.GetButton(whichRemote, "GUITARYELLOW"));
                    buttonGuitarBlue.SetActive(Wii.GetButton(whichRemote, "GUITARBLUE"));
                    buttonGuitarOrange.SetActive(Wii.GetButton(whichRemote, "GUITARORANGE"));
                    buttonGuitarPlus.SetActive(Wii.GetButton(whichRemote, "GUITARPLUS"));
                    buttonGuitarMinus.SetActive(Wii.GetButton(whichRemote, "GUITARMINUS"));

                    guitarBody.localRotation = Quaternion.Euler(0, 0, 0);
                    guitarBody.RotateAround(guitarBody.position, guitarBody.forward, wiiAccel.x * 90.0f);

                    theStick             = Wii.GetAnalogStick(whichRemote, "GUITAR");
                    guitarStick.rotation = guitarBody.rotation;
                    guitarStick.RotateAround(guitarStick.position, guitarStick.up, theStick.y * 30.0f);
                    guitarStick.RotateAround(guitarStick.position, guitarStick.right, theStick.x * -30.0f);


                    guitarStrum.rotation = guitarBody.rotation;
                    guitarStrum.RotateAround(guitarStrum.position, guitarStrum.up, 20.0f * Wii.GetGuitarStrum(whichRemote));
                    guitarWhammy.rotation = guitarBody.rotation;
                    guitarWhammy.RotateAround(guitarWhammy.position, guitarWhammy.right, 20.0f * Wii.GetGuitarWhammy(whichRemote));

                    inputDisplay = inputDisplay + "\n GUITAR";
                    inputDisplay = inputDisplay + "\nGreen  " + Wii.GetButton(whichRemote, "GUITARGREEN").ToString();
                    inputDisplay = inputDisplay + "\nRed    " + Wii.GetButton(whichRemote, "GUITARRED").ToString();
                    inputDisplay = inputDisplay + "\nYellow " + Wii.GetButton(whichRemote, "GUITARYELLOW").ToString();
                    inputDisplay = inputDisplay + "\nBlue   " + Wii.GetButton(whichRemote, "GUITARBLUE").ToString();
                    inputDisplay = inputDisplay + "\nOrange " + Wii.GetButton(whichRemote, "GUITARORANGE").ToString();
                    inputDisplay = inputDisplay + "\nPlus   " + Wii.GetButton(whichRemote, "GUITARPLUS").ToString();
                    inputDisplay = inputDisplay + "\nMinus  " + Wii.GetButton(whichRemote, "GUITARMINUS").ToString();
                    inputDisplay = inputDisplay + "\nStick  " + theStick.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nWhammy " + theWhammy.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nStrum  " + theStrum.ToString();
                }
                else if (Wii.GetExpType(whichRemote) == 5)             //drums are in
                {
                    drumSet.gameObject.SetActive(true);
                    Vector2 theStick = Wii.GetAnalogStick(whichRemote, "DRUMS");
                    drumStick.rotation = drumSet.rotation;
                    drumStick.RotateAround(drumStick.position, drumStick.right,
                                           theStick.y * 30.0f);
                    drumStick.RotateAround(drumStick.position, drumStick.forward,
                                           theStick.x * -30.0f);

                    drumPlus.enabled  = Wii.GetButton(whichRemote, "DRUMPLUS");
                    drumMinus.enabled = Wii.GetButton(whichRemote, "DRUMMINUS");

                    if (Wii.GetButton(whichRemote, "DRUMGREEN"))
                    {
                        float boom = 1.5f / Wii.GetDrumVelocity(whichRemote, "GREEN");
                        drumGreen.localScale = new Vector3(boom, drumGreen.localScale.y, boom);
                    }
                    else
                    {
                        float boom = Mathf.Lerp(drumGreen.localScale.x, 1.5f, .1f);
                        drumGreen.localScale = new Vector3(boom, drumGreen.localScale.y, boom);
                    }

                    if (Wii.GetButton(whichRemote, "DRUMBLUE"))
                    {
                        float boom = 1.5f / Wii.GetDrumVelocity(whichRemote, "BLUE");
                        drumBlue.localScale = new Vector3(boom, drumBlue.localScale.y, boom);
                    }
                    else
                    {
                        float boom = Mathf.Lerp(drumBlue.localScale.x, 1.5f, .1f);
                        drumBlue.localScale = new Vector3(boom, drumBlue.localScale.y, boom);
                    }

                    if (Wii.GetButton(whichRemote, "DRUMRED"))
                    {
                        float boom = 1.5f / Wii.GetDrumVelocity(whichRemote, "RED");
                        drumRed.localScale = new Vector3(boom, drumRed.localScale.y, boom);
                    }
                    else
                    {
                        float boom = Mathf.Lerp(drumRed.localScale.x, 1.5f, .1f);
                        drumRed.localScale = new Vector3(boom, drumRed.localScale.y, boom);
                    }

                    if (Wii.GetButton(whichRemote, "DRUMORANGE"))
                    {
                        float boom = 1.5f / Wii.GetDrumVelocity(whichRemote, "ORANGE");
                        drumOrange.localScale = new Vector3(boom, drumOrange.localScale.y, boom);
                    }
                    else
                    {
                        float boom = Mathf.Lerp(drumOrange.localScale.x, 1.5f, .1f);
                        drumOrange.localScale = new Vector3(boom, drumOrange.localScale.y, boom);
                    }

                    if (Wii.GetButton(whichRemote, "DRUMYELLOW"))
                    {
                        float boom = 1.5f / Wii.GetDrumVelocity(whichRemote, "YELLOW");
                        drumYellow.localScale = new Vector3(boom, drumYellow.localScale.y, boom);
                    }
                    else
                    {
                        float boom = Mathf.Lerp(drumYellow.localScale.x, 1.5f, .1f);
                        drumYellow.localScale = new Vector3(boom, drumYellow.localScale.y, boom);
                    }

                    inputDisplay = inputDisplay + "\n  DRUMS";
                    inputDisplay = inputDisplay + "\nGreen  " + Wii.GetButton(whichRemote, "DRUMGREEN").ToString();
                    inputDisplay = inputDisplay + "\nRed    " + Wii.GetButton(whichRemote, "DRUMRED").ToString();
                    inputDisplay = inputDisplay + "\nYellow " + Wii.GetButton(whichRemote, "DRUMYELLOW").ToString();
                    inputDisplay = inputDisplay + "\nBlue   " + Wii.GetButton(whichRemote, "DRUMBLUE").ToString();
                    inputDisplay = inputDisplay + "\nOrange " + Wii.GetButton(whichRemote, "DRUMORANGE").ToString();
                    inputDisplay = inputDisplay + "\nPlus   " + Wii.GetButton(whichRemote, "DRUMPLUS").ToString();
                    inputDisplay = inputDisplay + "\nMinus  " + Wii.GetButton(whichRemote, "DRUMMINUS").ToString();
                    inputDisplay = inputDisplay + "\nPedal  " + Wii.GetButton(whichRemote, "DRUMPEDAL").ToString();
                    inputDisplay = inputDisplay + "\nStick  " + theStick.ToString("#.0000");
                }
                else if (Wii.GetExpType(whichRemote) == 6)             //turntable is in
                {
                    Vector2 theStick = Wii.GetAnalogStick(whichRemote, "TURNTABLE");
                    hub.gameObject.SetActive(true);

                    dial.rotation = hub.rotation;
                    dial.RotateAround(dial.position, dial.up, 360.0f * Wii.GetTurntableDial(whichRemote));

                    slider.localPosition = new Vector3(.3f * Wii.GetTurntableSlider(whichRemote), slider.localPosition.y, slider.localPosition.z);


                    tableStick.rotation = hub.rotation;
                    tableStick.RotateAround(tableStick.position, tableStick.right,
                                            theStick.y * 30.0f);
                    tableStick.RotateAround(tableStick.position, tableStick.forward,
                                            theStick.x * -30.0f);

                    buttonTablePlus.SetActive(Wii.GetButton(whichRemote, "TURNTABLEPLUS"));
                    buttonTableMinus.SetActive(Wii.GetButton(whichRemote, "TURNTABLEMINUS"));
                    butttonEuphoria.SetActive(Wii.GetButton(whichRemote, "TURNTABLEEUPHORIA"));

                    platterLeft.RotateAround(platterLeft.position, platterLeft.up, Wii.GetTurntableSpin(whichRemote, "LEFT"));
                    platterRight.RotateAround(platterRight.position, platterRight.up, Wii.GetTurntableSpin(whichRemote, "RIGHT"));

                    tableLeftGreen.SetActive(Wii.GetButton(whichRemote, "TURNTABLEGREENLEFT"));
                    tableLeftRed.SetActive(Wii.GetButton(whichRemote, "TURNTABLEREDLEFT"));
                    tableLeftBlue.SetActive(Wii.GetButton(whichRemote, "TURNTABLEBLUELEFT"));
                    tableRightGreen.SetActive(Wii.GetButton(whichRemote, "TURNTABLEGREENRIGHT"));
                    tableRightRed.SetActive(Wii.GetButton(whichRemote, "TURNTABLEREDRIGHT"));
                    tableRightBlue.SetActive(Wii.GetButton(whichRemote, "TURNTABLEBLUERIGHT"));

                    inputDisplay = inputDisplay + "\nTURN TABLE";
                    inputDisplay = inputDisplay + "\nLeft Green  " + Wii.GetButton(whichRemote, "TURNTABLEGREENLEFT").ToString();
                    inputDisplay = inputDisplay + "\nLeft Red    " + Wii.GetButton(whichRemote, "TURNTABLEREDLEFT").ToString();
                    inputDisplay = inputDisplay + "\nLeft Blue   " + Wii.GetButton(whichRemote, "TURNTABLEBLUELEFT").ToString();
                    inputDisplay = inputDisplay + "\nRight Green   " + Wii.GetButton(whichRemote, "TURNTABLEGREENRIGHT").ToString();
                    inputDisplay = inputDisplay + "\nRight Red     " + Wii.GetButton(whichRemote, "TURNTABLEREDRIGHT").ToString();
                    inputDisplay = inputDisplay + "\nRight Blue    " + Wii.GetButton(whichRemote, "TURNTABLEBLUERIGHT").ToString();
                    inputDisplay = inputDisplay + "\nEuphoria    " + Wii.GetButton(whichRemote, "TURNTABLEEUPHORIA").ToString();                                                                                                                               inputDisplay = inputDisplay + "\nPlus        " + Wii.GetButton(whichRemote, "TURNTABLEPLUS").ToString();
                    inputDisplay = inputDisplay + "\nMinus       " + Wii.GetButton(whichRemote, "TURNTABLEMINUS").ToString();
                    inputDisplay = inputDisplay + "\nStick       " + theStick.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nSlider      " + Wii.GetTurntableSlider(whichRemote);
                    inputDisplay = inputDisplay + "\nDial        " + Wii.GetTurntableDial(whichRemote);
                    inputDisplay = inputDisplay + "\nLeft Table  " + Wii.GetTurntableSpin(whichRemote, "LEFT");
                    inputDisplay = inputDisplay + "\nRight Table " + Wii.GetTurntableSpin(whichRemote, "RIGHT");;
                }
                else if (Wii.GetExpType(whichRemote) == 7)             //WiiUPro is in
                {
                    proU.gameObject.SetActive(true);
                    wiimote.gameObject.SetActive(false);

                    detectMotionButton.SetActive(false);
                    calibrateWiiUProButton.SetActive(true);
                    Vector2 theStickLeft  = Wii.GetAnalogStick(whichRemote, "WIIUPROLEFT");
                    Vector2 theStickRight = Wii.GetAnalogStick(whichRemote, "WIIUPRORIGHT");

                    proU.gameObject.SetActive(true);

                    proUStickLeft.rotation = proU.rotation;
                    proUStickLeft.RotateAround(proUStickLeft.position, transform.right,
                                               theStickLeft.y * 30.0f);
                    proUStickLeft.RotateAround(proUStickLeft.position, transform.forward,
                                               theStickLeft.x * -30.0f);

                    proUStickRight.rotation = proU.rotation;
                    proUStickRight.RotateAround(proUStickRight.position, transform.right,
                                                theStickRight.y * 30.0f);
                    proUStickRight.RotateAround(proUStickRight.position, transform.forward,
                                                theStickRight.x * -30.0f);

                    if (Wii.GetButton(whichRemote, "WIIUPROL3"))
                    {
                        proUStickLeft.localScale = new Vector3(proUStickLeft.localScale.x, 1.5f, proUStickLeft.localScale.z);
                    }
                    else
                    {
                        proUStickLeft.localScale = new Vector3(proUStickLeft.localScale.x, 2.3f, proUStickLeft.localScale.z);
                    }

                    if (Wii.GetButton(whichRemote, "WIIUPROR3"))
                    {
                        proUStickRight.localScale = new Vector3(proUStickRight.localScale.x, 1.5f, proUStickRight.localScale.z);
                    }
                    else
                    {
                        proUStickRight.localScale = new Vector3(proUStickRight.localScale.x, 2.3f, proUStickRight.localScale.z);
                    }

                    buttonProUA.SetActive(Wii.GetButton(whichRemote, "WIIUPROA"));
                    buttonProUB.SetActive(Wii.GetButton(whichRemote, "WIIUPROB"));
                    buttonProUMinus.SetActive(Wii.GetButton(whichRemote, "WIIUPROMINUS"));
                    buttonProUPlus.SetActive(Wii.GetButton(whichRemote, "WIIUPROPLUS"));
                    buttonProUHome.SetActive(Wii.GetButton(whichRemote, "WIIUPROHOME"));
                    buttonProUX.SetActive(Wii.GetButton(whichRemote, "WIIUPROX"));
                    buttonProUY.SetActive(Wii.GetButton(whichRemote, "WIIUPROY"));
                    buttonProUUp.SetActive(Wii.GetButton(whichRemote, "WIIUPROUP"));
                    buttonProUDown.SetActive(Wii.GetButton(whichRemote, "WIIUPRODOWN"));
                    buttonProULeft.SetActive(Wii.GetButton(whichRemote, "WIIUPROLEFT"));
                    buttonProURight.SetActive(Wii.GetButton(whichRemote, "WIIUPRORIGHT"));
                    buttonProUL.SetActive(Wii.GetButton(whichRemote, "WIIUPROL"));
                    buttonProUR.SetActive(Wii.GetButton(whichRemote, "WIIUPROR"));
                    buttonProUZL.SetActive(Wii.GetButton(whichRemote, "WIIUPROZL"));
                    buttonProUZR.SetActive(Wii.GetButton(whichRemote, "WIIUPROZR"));


                    inputDisplay = " WII U PRO ";
                    inputDisplay = inputDisplay + "\na       " + Wii.GetButton(whichRemote, "WIIUPROA").ToString();
                    inputDisplay = inputDisplay + "\nb       " + Wii.GetButton(whichRemote, "WIIUPROB").ToString();
                    inputDisplay = inputDisplay + "\n-       " + Wii.GetButton(whichRemote, "WIIUPROMINUS").ToString();
                    inputDisplay = inputDisplay + "\n+       " + Wii.GetButton(whichRemote, "WIIUPROPLUS").ToString();
                    inputDisplay = inputDisplay + "\nhome    " + Wii.GetButton(whichRemote, "WIIUPROHOME").ToString();
                    inputDisplay = inputDisplay + "\nx       " + Wii.GetButton(whichRemote, "WIIUPROX").ToString();
                    inputDisplay = inputDisplay + "\ny       " + Wii.GetButton(whichRemote, "WIIUPROY").ToString();
                    inputDisplay = inputDisplay + "\nup      " + Wii.GetButton(whichRemote, "WIIUPROUP").ToString();
                    inputDisplay = inputDisplay + "\ndown    " + Wii.GetButton(whichRemote, "WIIUPRODOWN").ToString();
                    inputDisplay = inputDisplay + "\nleft    " + Wii.GetButton(whichRemote, "WIIUPROLEFT").ToString();
                    inputDisplay = inputDisplay + "\nright   " + Wii.GetButton(whichRemote, "WIIUPRORIGHT").ToString();
                    inputDisplay = inputDisplay + "\nL       " + Wii.GetButton(whichRemote, "WIIUPROL").ToString();
                    inputDisplay = inputDisplay + "\nR       " + Wii.GetButton(whichRemote, "WIIUPROR").ToString();
                    inputDisplay = inputDisplay + "\nZL      " + Wii.GetButton(whichRemote, "WIIUPROZL").ToString();
                    inputDisplay = inputDisplay + "\nZR      " + Wii.GetButton(whichRemote, "WIIUPROZR").ToString();
                    inputDisplay = inputDisplay + "\nL3      " + Wii.GetButton(whichRemote, "WIIUPROL3").ToString();
                    inputDisplay = inputDisplay + "\nR3      " + Wii.GetButton(whichRemote, "WIIUPROR3").ToString();
                    inputDisplay = inputDisplay + "\nStick L " + theStickLeft.ToString("#.0000");
                    inputDisplay = inputDisplay + "\nStick R " + theStickRight.ToString("#.0000");
                }
                else if (Wii.GetExpType(whichRemote) == 0)
                {
                    nunchuk.gameObject.SetActive(false);
                    balanceBoard.gameObject.SetActive(false);
                    classic.gameObject.SetActive(false);
                    guitarBody.gameObject.SetActive(false);
                    hub.gameObject.SetActive(false);
                    drumSet.gameObject.SetActive(false);
                    proU.gameObject.SetActive(false);
                }
            }
            theText.text = inputDisplay;
        }
        else
        {
            dropButton.SetActive(false);

            nunchuk.gameObject.SetActive(false);
            balanceBoard.gameObject.SetActive(false);
            classic.gameObject.SetActive(false);
            guitarBody.gameObject.SetActive(false);
            hub.gameObject.SetActive(false);
            drumSet.gameObject.SetActive(false);
            wiimote.gameObject.SetActive(false);
            motionPlus.gameObject.SetActive(false);
            proU.gameObject.SetActive(false);

            calibrateWiiUProButton.SetActive(false);
            detectMotionButton.SetActive(false);
            calibrateMotionButton.SetActive(false);
            uncalibrateMotionButton.SetActive(false);
            deactivateMotionButton.SetActive(false);


            theRemoteNumber.enabled = false;
            theText.text            = "Ready.";
        }

        if (Wii.IsSearching())
        {
            //cancel search
            cancelButton.SetActive(true);
        }
        else
        {
            cancelButton.SetActive(false);
            if (!Wii.IsSearching() && (totalRemotes < 16))
            {
                //Find Button
                searchButton.SetActive(true);
            }
            else
            {
                searchButton.SetActive(false);
            }
        }
    }
 public static Vector4 Board_ForceRead(int number)
 {
     return(Wii.GetBalanceBoard(number));
 }