Update arduinoCtrl.cs

This commit is contained in:
BlitzCityDIY 2022-08-30 08:58:06 -04:00
parent 5eda1a94d9
commit f32fd919ce

View file

@ -10,27 +10,14 @@ using UnityEngine.UI;
public class arduinoCtrl : MonoBehaviour public class arduinoCtrl : MonoBehaviour
{ {
// replace with your board's COM port
SerialPort stream = new SerialPort("COM52", 9600); SerialPort stream = new SerialPort("COM52", 9600);
//public float sensitivity;
public Transform t; public Transform t;
private float posX;
private float posY;
private float posZ;
private float sensX;
private float sensY;
private float sensZ;
public float Xcal;
public float Ycal;
public float Zcal;
void Start() void Start()
{ {
stream.Open(); stream.Open();
//stream.ReadTimeout = 20;
} }
void Update() void Update()
@ -47,27 +34,6 @@ public class arduinoCtrl : MonoBehaviour
lastData = new Vector3(AccX, AccY, AccZ); lastData = new Vector3(AccX, AccY, AccZ);
//Vector3 ParseAccelerometerData(string stream);
/*string Temp = SplitData[4];
string GyroX = (float.Parse(SplitData[5]) / 10000).ToString();
string GyroY = (float.Parse(SplitData[6]) / 10000).ToString();
string GyroZ = (float.Parse(SplitData[7]) / 10000).ToString();*/
/*Acceleration.text = "X: " + AccX + "\nY: " + AccY + "\nZ: " + AccZ;
Gyroscope.text = "X: " + GyroX + "\nY: " + GyroY + "\nZ: " + GyroZ;
Magnetometer.text = "X: " + MagX + "\nY: " + MagY + "\nZ: " + MagZ;
Temperature.text = Temp + "`C";
posX += float.Parse(GyroX);
posY += float.Parse(GyroY);
posZ += float.Parse(GyroZ);
sensX += float.Parse(AccX);
sensY += float.Parse(AccY);
sensZ += float.Parse(AccZ);*/
//Vector3 accl = ParseAccelerometerData(stream);
//Smoothly rotate to the new rotation position.
t.transform.rotation = Quaternion.Slerp(t.transform.rotation, Quaternion.Euler(lastData), Time.deltaTime * 2f); t.transform.rotation = Quaternion.Slerp(t.transform.rotation, Quaternion.Euler(lastData), Time.deltaTime * 2f);
} }