public ArduinoPlotter(ref Chart chart, ref Label _lblBufferStatus) { chartHandler = new ChartHandler(ref chart, 5000); 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; }
public ArduinoPlotter(ref Chart chart, ref Label _lblBufferStatus) { chartHandler = new ChartHandler(ref chart, 5000); //para lidar com o chart chartHandler.ConfigureChart("Leituras", "Arduino Plotter", "Pontos", "Valores"); //configurar o chart arduinoHandler = new ArduinoHandler(); //para lidar com a aquisição de dados a partir do arduino //thread para consumir os dados dataconsumer = new ThreadHandler(() => { if (arduinoHandler.dataWaiting) { chartHandler.AddYToBuffer(arduinoHandler.bufferAquisition.SecureDequeue() * 5 / 1024.0); } }); bufferLabelUpdater = new Timer(); //timer para atualizar a label lblBufferStatus = _lblBufferStatus; bufferLabelUpdater.Interval = 50; //intervalo de tempo para timer da label bufferLabelUpdater.Tick += bufferLabelUpdater_Tick; }