Ejemplo n.º 1
0
 void OnMouseDown()     //if the cube is clicked
 {
     if (!yellow)
     {
         Debug.Log("Turn on LED!");
         rend.material.SetColor("_Color", Color.yellow); //turn the cube YELLOW
         arduinoConnector.WriteByteToArduino(255);       //send 255 to Arduino
         yellow = true;
     }
     else
     {
         Debug.Log("Turn LED off!");
         rend.material.SetColor("_Color", Color.blue); //turn the cube YELLOW
         arduinoConnector.WriteByteToArduino(255);     //send 255 to Arduino
         yellow = false;
     }
 }