示例#1
0
        /*Method which handles data entry/decimation of data without a timmer
         * Use if the arduino will handle the timer delays
         *
         */
        private void data_eventNoTimer(object sender, EventArgs e)
        {
            date = DateTime.Now;                                                                    //gets current time

            string time = date.Hour + ":" + date.Minute + ":" + date.Second;                        //creates a time string

            currentSec = date.Second;                                                               //gets the current seconds from the time


            DataDisplay.AppendText(time + "\t\t\t " + in_data + "\n");                                              //display the time and reading in the textbox
        }
示例#2
0
        /*Method which handles data entry/decimation of data
         * Use if the c# application will monitor the timer
         *
         */
        private void data_event(object sender, EventArgs e)
        {
            date = DateTime.Now;                                                                    //gets current time

            string time = date.Hour + ":" + date.Minute + ":" + date.Second;                        //creates a time string

            currentSec = date.Second;                                                               //gets the current seconds from the time

            if (currentSec % waitTime == 0 && firstReading)                                         //if its been waittime seconds and its the first reading within the second
            {
                DataDisplay.AppendText(time + "\t\t\t " + in_data + "\n");                          //display the time and reading in the textbox
                firstReading = false;                                                               //the first reading has now happened
            }
            else if (currentSec % waitTime != 0 && !firstReading)                                   //if it hasnt been waittime seconds and we already took the first reading
            {
                firstReading = true;                                                                //reset the firstreading bool to true so we can now take a reading when five seconds has passed
            }
        }