Exemple #1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (Radar != null)
            {
                //Distanz angeben, Achtung Distanz  ist in millimetern ( vom Sensor
                this.label1.Text = "Distanz: " + Radar.Distance.ToString("0.00") + " m";
                //Radard Distanz, konvertiert in centi
                int value = (int)(Radar.Distance * 100);
                //obergrenze Radar
                if (value > 255)
                {
                    value = 255;
                }
                //untergrenze
                if (value < 0)
                {
                    value = 0;
                }

                //Falls Radar Distanz unter 20cm -> Block und event triggern, sprich alle abonnierten invoken
                if (value < 20)
                {
                    TooClose?.Invoke(null, null);
                }
                //progressbar aktualisieren
                this.progressBar1.Value = value;
            }
        }
Exemple #2
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (Radar != null)
            {
                this.label1.Text = "Distanz: " + Radar.Distance.ToString("0.00") + " m";
                int value = (int)(Radar.Distance * 100);
                if (value > 255)
                {
                    value = 255;
                }
                if (value < 0)
                {
                    value = 0;
                }

                if (value < 20)
                {
                    TooClose?.Invoke(null, null);
                }

                this.progressBar1.Value = value;
            }
        }