Skip to content

Commit f32fd91

Browse files
committed
Update arduinoCtrl.cs
1 parent 5eda1a9 commit f32fd91

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

Arduino_9DoF_to_Unity/arduinoCtrl.cs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,14 @@
1010

1111
public class arduinoCtrl : MonoBehaviour
1212
{
13+
// replace with your board's COM port
1314
SerialPort stream = new SerialPort("COM52", 9600);
14-
//public float sensitivity;
1515

1616
public Transform t;
1717

18-
private float posX;
19-
private float posY;
20-
private float posZ;
21-
22-
private float sensX;
23-
private float sensY;
24-
private float sensZ;
25-
26-
public float Xcal;
27-
public float Ycal;
28-
public float Zcal;
29-
3018
void Start()
3119
{
3220
stream.Open();
33-
//stream.ReadTimeout = 20;
3421
}
3522

3623
void Update()
@@ -47,27 +34,6 @@ void Update()
4734

4835
lastData = new Vector3(AccX, AccY, AccZ);
4936

50-
//Vector3 ParseAccelerometerData(string stream);
51-
/*string Temp = SplitData[4];
52-
string GyroX = (float.Parse(SplitData[5]) / 10000).ToString();
53-
string GyroY = (float.Parse(SplitData[6]) / 10000).ToString();
54-
string GyroZ = (float.Parse(SplitData[7]) / 10000).ToString();*/
55-
56-
/*Acceleration.text = "X: " + AccX + "\nY: " + AccY + "\nZ: " + AccZ;
57-
Gyroscope.text = "X: " + GyroX + "\nY: " + GyroY + "\nZ: " + GyroZ;
58-
Magnetometer.text = "X: " + MagX + "\nY: " + MagY + "\nZ: " + MagZ;
59-
Temperature.text = Temp + "`C";
60-
61-
posX += float.Parse(GyroX);
62-
posY += float.Parse(GyroY);
63-
posZ += float.Parse(GyroZ);
64-
65-
sensX += float.Parse(AccX);
66-
sensY += float.Parse(AccY);
67-
sensZ += float.Parse(AccZ);*/
68-
69-
//Vector3 accl = ParseAccelerometerData(stream);
70-
//Smoothly rotate to the new rotation position.
7137
t.transform.rotation = Quaternion.Slerp(t.transform.rotation, Quaternion.Euler(lastData), Time.deltaTime * 2f);
7238

7339
}

0 commit comments

Comments
 (0)