Пример #1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     #region Circular Buffer
     mycircularbuffer   = new CircularBuffer <string>(4);
     btnDequeue.Enabled = false;
     btnEnqueue.Enabled = true;
     #endregion
     #region ThreadHandler
     mythread      = new ThreadHandler(threadFuction);
     threadcounter = 0;
     #endregion
     #region ArduinoHandler
     myarduinohandler            = new ArduinoHandler();
     aduinodataconsumer          = new ThreadHandler(ArduinoConsumer);
     arduinoBufferLabel          = new Timer();
     arduinoBufferLabel.Interval = 50;
     arduinoBufferLabel.Tick    += updateLabelBuffer;
     #endregion
     #region ChartHandler
     mychart = new ChartHandler(ref chart1);
     #endregion
     #region ArduinoPlotter
     myArduinoPlotter = new ArduinoPlotter(ref chart2, ref label9);
     #endregion
 }
Пример #2
0
        public ArduinoPlotter(ref Chart chart, ref Label _lblBufferStatus)
        {
            chartHandler = new ChartHandler(ref chart, 1000);

            chartHandler.ConfigureChart("Leituras", "Arduino Plotter", "Pontos", "Valores");


            arduinoHandler = new ArduinoHandler();

            dataconsumer = new ThreadHandler(() => {
                if (arduinoHandler.dataWaiting)
                {
                    chartHandler.AddYToBuffer(arduinoHandler.bufferAquisition.SecureDequeue() * 5 / 1024.0);
                }
            });

            bufferLabelUpdater          = new Timer();
            lblBufferStatus             = _lblBufferStatus;
            bufferLabelUpdater.Interval = 50;
            bufferLabelUpdater.Tick    += bufferLabelUpdater_Tick;
        }