Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (read)
        {
            if (var > 0)
            {
                sphere.transform.localScale = new Vector3((float)(var / 255.0f), (float)(var / 255.0f), (float)(var / 255.0f));
            }
            arduinoConnector.WriteByteToArduinoAsync(counter); //send 255 to Arduino
            counter++;
            if (counter > 255)
            {
                counter = 0;
            }

            read = false;

            arduinoConnector.ReadByteFromArduinoAsync(arduinoRead); //read from Arduino
        }
    }