Example #1
0
        private void SerialDataHandler(object sender, SerialDataReceivedEventArgs e)
        {
            SerialPort port = sender as SerialPort;
            string     dane = port.ReadLine();
            //double[] doubles = Array.ConvertAll(dane.ToLowerInvariant().Split(','), new Converter<string, double>(Double.Parse));
            List <double> _Dane = new List <double>();

            foreach (string d in SplitString(dane))
            {
                try
                {
                    _Dane.Add(double.Parse(d, NumberStyles.Any, CultureInfo.InvariantCulture));
                    //Console.WriteLine("Converted '{0}' to {1}.", d, result);
                }
                catch (FormatException)
                {
                    Console.WriteLine("Unable to convert '{0}' to a Double.", d);
                }
            }

            double[] daneAr = _Dane.ToArray();
            ArduinoOutputDbg.Invoke((MethodInvoker) delegate { ArduinoOutputDbg.AppendText(dane); });
            for (int i = 0; i < 3; i++)
            {
                //daneAr[i] *= 9.81;
                Wykres.Series[i].Values.Add(daneAr[i]);
            }
        }
Example #2
0
 private void ArduinoOutputDbg_TextChanged(object sender, EventArgs e)
 {
     ArduinoOutputDbg.SelectionStart = ArduinoOutputDbg.TextLength;
     ArduinoOutputDbg.ScrollToCaret();
 }