Example #1
0
        public MainWindow()
        {
            view = new ViewParams();
            InitializeComponent();
            scale   = new ScaleTransform(1, 1, 0, 0);
            pan     = new TranslateTransform(0, plot.Height);
            signals = new SignalCollection(this);
            signals.scaleSignalStrokes(scale);
            signals.updateLabels();
            resetTransform();
            ports = SerialPort.GetPortNames();

            Console.WriteLine("ports:");
            foreach (string port in ports)
            {
                comportList.Items.Add(port.ToString());
                Console.WriteLine(port);
            }
            arduinoPort             = new SerialPort();
            arduinoPort.Parity      = Parity.None;
            arduinoPort.StopBits    = StopBits.One;
            arduinoPort.DataBits    = 8;
            arduinoPort.BaudRate    = 9600;
            arduinoPort.ReadTimeout = 200;
            if (comportList.Items.Count > 0)
            {
                arduinoPort.PortName = comportList.Items[0].ToString();
            }
            else
            {
                Console.WriteLine("No ports available");
                connectButton.IsEnabled = false;
            }
        }
        public MainWindow()
        {
            view = new ViewParams();
            InitializeComponent();
            scale = new ScaleTransform(1, 1, 0, 0);
            pan = new TranslateTransform(0, plot.Height);
            signals = new SignalCollection(this);
                signals.scaleSignalStrokes(scale);
                signals.updateLabels();
            resetTransform();
            ports = SerialPort.GetPortNames();
            
            Console.WriteLine("ports:");
            foreach(string port in ports){
                comportList.Items.Add(port.ToString());
                Console.WriteLine(port);
            }
            arduinoPort = new SerialPort();
            arduinoPort.Parity = Parity.None;
            arduinoPort.StopBits = StopBits.One;
            arduinoPort.DataBits = 8;
            arduinoPort.BaudRate = 9600;
            arduinoPort.ReadTimeout = 200;
            if (comportList.Items.Count > 0)
            {
                arduinoPort.PortName = comportList.Items[0].ToString();
            }
            else
            {
                Console.WriteLine("No ports available");
                connectButton.IsEnabled = false;
            }


        }
Example #3
0
 public Exporter(SignalCollection signals, String filename)
 {
     //Combine the new file name with the path
     file = System.IO.Path.Combine(directory, filename);
     foreach(Signal signal in signals.signals) 
     {
         filecontents = filecontents + signal.name + ", ";
         foreach (int value in signal.values)
         {
             filecontents = filecontents + value.ToString() + ", ";
         }
         filecontents = filecontents + "\n";
     }
     //writeFile();
 }
Example #4
0
 public Exporter(SignalCollection signals, String filename)
 {
     //Combine the new file name with the path
     file = System.IO.Path.Combine(directory, filename);
     foreach (Signal signal in signals.signals)
     {
         filecontents = filecontents + signal.name + ", ";
         foreach (int value in signal.values)
         {
             filecontents = filecontents + value.ToString() + ", ";
         }
         filecontents = filecontents + "\n";
     }
     //writeFile();
 }