using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;

public class potenciometro : MonoBehaviour {
	//public float dato=1;

	SerialPort serial=new SerialPort("COM3",115200);

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(!serial.IsOpen){
			serial.Open();
		}
		float x = float.Parse(serial.ReadLine());
		float y = float.Parse(serial.ReadLine());
		float z = float.Parse(serial.ReadLine());
		//int rotation = dato;
		Debug.Log(x);
			x = x / 190;
            y += y / 3000;
            z += z / 3000;
            transform.localEulerAngles = new Vector3(-x, -y, 0f);

		//transform.eulerAngles=new Vector3(-x,-y,-z);
		//transform.Translate(new Vector3(0f,dato,0f)*Time.deltaTime);
		//transform.Translate(new Vector3(0f,-dato+0.2f,dato)*Time.deltaTime);
		//transform.position = new Vector3(0, dato, 0); 
		//transform.Translate(Input.acceleration.x, 0, -Input.acceleration.z);
	}
}
