///////////////// /// Main Loop /// ///////////////// void Start() { writeTextHelper = new WriteTextHelper(); // open the event listening of the arduino port sp.Open(); sp.ReadTimeout = 1; // need to re-assign the path variable or otherwise will encounter ArgumentNullException path = "C:/Users/HRK/Desktop/Angle/test.txt"; }
// ----------------------------- // Main Loop // ----------------------------- // Runs at the start of the application void Start() { // Setting object reference to the instance of object networking = new NetworkingHelper(); writeTextHelper = new WriteTextHelper(); // Sends starting message to server to check whether the http functions are working StartCoroutine(UploadHTTP("Connected!")); // Starts clock for updating current brick coordinate text mesh in virtual environment at a slow 2fps to reduce computation InvokeRepeating("UpdateText", 0.5f, 0.5f); // initially assign to empty string posX = ""; posY = ""; posZ = ""; rotX = ""; rotY = ""; rotZ = ""; // Initializes gesture recognition for single taps tapRecognizer = new GestureRecognizer(); tapRecognizer.SetRecognizableGestures(GestureSettings.Tap); tapRecognizer.TappedEvent += TapRecognizer_TappedEvent; tapRecognizer.StartCapturingGestures(); odd_tap = true;// Used for identifying odd and even taps, which either creates a new brick or dropps a brick // Voice Recognition for resetting brick KeywordRecognizer resetRecognizer = new KeywordRecognizer(new[] { "Reset" }); resetRecognizer.OnPhraseRecognized += ResetRecognizer_OnPhraseRecognized; resetRecognizer.Start(); // assign the file path the data will be written into //path = "Asset/Resources/test.txt"; // relative path path = "C:/Users/Danny/Documents/RobotSandbox/test.txt"; // absolute path: so the path could be referred to after the compilation // Clear the content of text file before loading data into it File.WriteAllText(path, String.Empty); }
///////////////// /// Main Loop /// ///////////////// void Awake() { arduinoHelper = arduinoGameObjectCalibration.GetComponent <ArduinoHelper>(); writeTextHelper = new WriteTextHelper(); }