示例#1
0
        private void startBT()
        {
            var bt = new BtManager("COM10");

            //BT data received
            bt.BtDataParsed += (o, e) =>
            {
                points.Enqueue(e.rawValue);
                fullAverageLabel.Invoke((MethodInvoker)(() => fullAverageLabel.Text = ("Full Focus Average: " + (int)points.Average()).ToString()));

                chart1.Invoke((MethodInvoker)(() => chart1.Series[0].Points.Add(e.rawValue)));

                //Keeps queue and chart counts below max chart x axis
                if (points.Count > chart1.ChartAreas[0].AxisX.Maximum - 1)
                {
                    checkFocusThreshold(points);

                    points.Dequeue();
                    chart1.Invoke((MethodInvoker)(() => chart1.Series[0].Points.RemoveAt(0)));
                }

                //Writes values to CSV
                if (++writeThreshold >= chart1.ChartAreas[0].AxisX.Maximum - 1)
                {
                    writeThreshold = 0;
                    AppendToFile(saveFile, String.Join(",", points));
                }
            };
        }
示例#2
0
        static void Main(string[] args)
        {
            BtManager bt = new BtManager();

            bt.Start();

            Console.ReadLine();
        }