/* * Event Handler for Receiving the Data from Arduino (Serial Port) and Appending the Message to the Event Args */ private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { try { ArduinoSerialReadEventArgs asre = new ArduinoSerialReadEventArgs(); asre.message = serial_port.ReadLine(); ardEvent?.Invoke(this, asre); } catch (System.IO.IOException) { return; } }
/* * Event Handler For Writing to file, enabling the method to write to file continiously as long as Arduino (Serial Port) is sending messages to the Serial Port. */ private void WriteToFileEventHandler(object sender, ArduinoSerialReadEventArgs e) { WriteToFile(e.message); }
/* * Event Handler For Appending text to SERIAL_READ and ONE_LINE_READ text boxes, enabling the methods to append text continiously as long as Arduino (Serial Port) is sending messages to the Serial Port. */ private void ArduinoSerialReadEventHandler(object sender, ArduinoSerialReadEventArgs e) { SERIAL_READ_SET_TEXT(e.message); ONE_LINE_READ_SET_TEXT(e.message); }