예제 #1
0
 public LightSprint(int pixelCount)
 {
     this.ledStrip = new LPD8806LEDStrip(pixelCount);
     this.buttons  = new Buttons();
     this.display  = new Display();
     this.buzzer   = new Buzzer();
 }
        private async void InitDrivers()
        {
            await Ds3231.Initialize(    );

            await Tsl2561.Initialize(    );

            await Buzzer.Initialize(17);

            await Ssd1308.Initialize(    );

            // Get DateTime in Ds3231, auto net sync
            DateTime LocalDateTime = Ds3231.Now;
            double   Temperature   = Ds3231.Temperature;

            // Get luminosity
            double Luminosity = Tsl2561.Lux;

            // Buzzz
            Buzzer.Tone(1400, 800, 200);

            // Draw Frame
            Ssd1308.DrawHLine(0, 0, 128);
            Ssd1308.DrawVLine(0, 0, 64);
            Ssd1308.DrawVLine(127, 0, 64);
            Ssd1308.DrawHLine(0, 63, 128);

            Ssd1308.DrawChar('M', DisplayFonts.System7pt, 87, 3);
            Ssd1308.DrawChar('A', DisplayFonts.System7pt, 97, 3);
            Ssd1308.DrawChar('N', DisplayFonts.System7pt, 107, 3);
            Ssd1308.DrawChar('U', DisplayFonts.System7pt, 117, 3);
        }
예제 #3
0
        public async static void ConfigureGpio()
        {
            try
            {
                await Bus1.Connect();
            }
            catch (Exception)
            {
                Debug.WriteLine("No se ha podido conectar con el dispositivo I2C 0x20.");
            }

            Bus1.SetPortDirection(0, 0x00);
            Bus1.SetPortDirection(1, 0x00);
            Bus1.WritePort(0, 0x00);
            Bus1.WritePort(1, 0x00);
            Reset.SetDriveMode(GpioPinDriveMode.Output);
            Reset.Write(GpioPinValue.High);
            Buzzer.SetDriveMode(GpioPinDriveMode.Output);
            Buzzer.Write(GpioPinValue.Low);
            EntranceRSw1.SetDriveMode(GpioPinDriveMode.Input);
            TerraceRSw2.SetDriveMode(GpioPinDriveMode.Input);
            GarageRSw3.SetDriveMode(GpioPinDriveMode.Input);
            BedroomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            LivingRoomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            BathroomCurtain.SetDriveMode(GpioPinDriveMode.Input);
            GarageDoor.SetDriveMode(GpioPinDriveMode.Input);
            LightSensor.SetDriveMode(GpioPinDriveMode.Input);
        }
예제 #4
0
        internal static PocketView GetSvg(this Buzzer buzzer)
        {
            var isOn       = buzzer.IsOn;
            var wavesBlock = isOn
                ? g()
                : g[@class : "Waves"](
                CreatePath("M933.18,189.115C936.844,191.266 939.306,195.248 939.306,199.8C939.306,204.46 936.726,208.522 932.919,210.635", "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:2px;"),
                CreatePath("M920.686,210.498C917.011,208.349 914.54,204.361 914.54,199.8C914.54,195.347 916.896,191.44 920.429,189.258", "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:2px;"),
                g[transform : "matrix(1.27179,0,0,1.27179,-251.928,-54.3035)"](
                    CreatePath("M920.686,210.498C917.011,208.349 914.54,204.361 914.54,199.8C914.54,195.347 916.896,191.44 920.429,189.258", "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:1.57px;")
                    ),
                g[transform : "matrix(-1.27179,0.000527782,-0.000527782,-1.27179,2105.88,453.415)"](
                    CreatePath("M920.686,210.498C917.011,208.349 914.54,204.361 914.54,199.8C914.54,195.347 916.896,191.44 920.429,189.258", "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:1.57px;")
                    )
                );

            return(g(
                       g[transform: "matrix(0.0834819,0,0,0.0762288,-11.0292,-7.71042)"](
                           CreatePath("M623.239,203.06C623.239,154.054 586.908,114.267 542.16,114.267L225.172,114.267C180.423,114.267 144.093,154.054 144.093,203.06L144.093,550.209C144.093,599.216 180.423,639.003 225.172,639.003L542.16,639.003C586.908,639.003 623.239,599.216 623.239,550.209L623.239,203.06Z", "fill:white;stroke:black;stroke-width:25.02px;")
                           ),
                       g[transform: "matrix(1,0,0,1,-764.084,-112.282)"](
                           _.text[x: "768.748px", y: "149.76px", style: TextStyle]("BUZZER")
                           ),
                       g[transform: "matrix(1,0,0,1,-905.923,-182.8)"](
                           wavesBlock,
                           g(
                               _.circle[cx: "788.557", cy: "138.653", r: "8.673", style: "fill:rgb(235,235,235);fill-opacity:0;stroke:black;stroke-width:2px;"]())
                           )
                       ));
        }
예제 #5
0
 //public void CorrectYield (int buzzIn, string buzzOut)
 //{
 //    Assert.AreEqual (Buzzer.Buzz(buzzIn), buzzOut);
 //}
 public void CorrectYield()
 {
     Assert.AreEqual(Buzzer.Buzz(3), "Fizz");
     Assert.AreEqual(Buzzer.Buzz(5), "Buzz");
     Assert.AreEqual(Buzzer.Buzz(15), "FizzBuzz");
     Assert.AreEqual(Buzzer.Buzz(43), "43");
 }
예제 #6
0
        public async Task <GetBuzzerCommandResult> Handle(GetBuzzerCommand command)
        {
            GetBuzzerCommandResult result = new GetBuzzerCommandResult();

            ObjectId buzzerId = new ObjectId();

            if (!ObjectId.TryParse(command.BuzzerId, out buzzerId))
            {
                AddNotification(nameof(command.BuzzerId), ENotifications.InvalidFormat);
            }

            if (Valid)
            {
                Buzzer buzzer = _buzzerRepository.Get(buzzerId);

                if (buzzer != null)
                {
                    buzzer = await UpdateState(buzzer);

                    result = new GetBuzzerCommandResult(HttpStatusCode.OK).Build <Buzzer, GetBuzzerCommandResult>(buzzer, command.Fields);
                }

                else if (_buzzerRepository.Valid)
                {
                    result = new GetBuzzerCommandResult(HttpStatusCode.NoContent);
                }
            }

            else
            {
                result = new GetBuzzerCommandResult(HttpStatusCode.BadRequest, Notifications);
            }

            return(result);
        }
예제 #7
0
        public CommandResult Handle(UpdateBuzzerCommand command)
        {
            CommandResult result = new CommandResult();

            ObjectId buzzerId = new ObjectId();

            if (!ObjectId.TryParse(command.BuzzerId, out buzzerId))
            {
                AddNotification(nameof(command.BuzzerId), ENotifications.InvalidFormat);
            }

            if (Valid)
            {
                Buzzer buzzer = _buzzerRepository.Get(buzzerId);

                if (buzzer == null && _buzzerRepository.Valid)
                {
                    AddNotification(nameof(command.BuzzerId), ENotifications.NotFound);
                }

                if (Valid)
                {
                    PinPort pinPort = null;

                    if (command.PinPort != null)
                    {
                        pinPort = new PinPort(command.PinPort);
                    }

                    buzzer.Update(command.Description, pinPort);

                    if (buzzer.Valid)
                    {
                        _buzzerRepository.Update(buzzer);

                        if (_buzzerRepository.Valid)
                        {
                            result = new CommandResult(HttpStatusCode.OK);
                        }
                    }

                    else
                    {
                        result = new CommandResult(HttpStatusCode.BadRequest, buzzer.Notifications);
                    }
                }

                else
                {
                    result = new CommandResult(HttpStatusCode.BadRequest, Notifications);
                }
            }

            else
            {
                result = new CommandResult(HttpStatusCode.BadRequest, Notifications);
            }

            return(result);
        }
예제 #8
0
        public void TestBuzzer()
        {
            IWattCalculator test = new Breadboard();

            Assert.AreEqual(3.50, test.Measure());
            test = new Buzzer(test);
            Assert.AreEqual(8.91, test.Measure() - 3.50);
        }
예제 #9
0
 public static void Main(string[] args)
 {
     for (int i = 1; i <= 100; i++)
     {
         Console.WriteLine(Buzzer.Buzz(i));
     }
     var tester = new Tester();
 }
예제 #10
0
        public override bool Configure(string jsonDeviceConfiguration)
        {
            var config = DeserializeDeviceConfig <BuzzerConfiguration>(jsonDeviceConfiguration);

            _buzzer = new Buzzer(config.PinNumber, config.PwmChannel);

            return(true);
        }
예제 #11
0
        void run()
        {
            while (true)
            {
                hasError = false;
                print("Application start.");
                taskDownload.start();
                taskUpload.start();
                taskExecute.start();
                taskKill.start();
                taskSQL.start();

                print("All tasks started. Wait for completion...");

                while (!hasError)
                {
                    Thread.Sleep(500);
                }

                Buzzer.Beep();
                print("Auto revive in " + reviveTime + " seconds.");
                int reviveCount = reviveTime;
                while (reviveCount >= 0)
                {
                    string msg = "\rAuto revive in " + reviveCount + " seconds";
                    string dots;
                    if (reviveCount % 3 == 0)
                    {
                        dots = "...";
                    }
                    else if (reviveCount % 3 == 1)
                    {
                        dots = "..";
                    }
                    else
                    {
                        dots = ".";
                    }
                    Console.Write("\r" + new string(' ', Console.WindowWidth - 1) + "\r");
                    Console.Write(msg + dots);
                    Thread.Sleep(1000);
                    reviveCount--;
                }

                isTerminating = false;
                if (reviveFromDead)
                {
                    print("The program revive now.");
                    continue;
                }
                else
                {
                    break;
                }
            }
            print("Press <Enter> to exit.");
            Console.ReadLine();
        }
예제 #12
0
 /// <summary>
 /// Main constructor
 /// </summary>
 /// <param name="iNA219s">Array of objects representing sensors</param>
 /// <param name="buz">Buzzer to send sound signals</param>
 /// <param name="dis">Display to show current data</param>
 /// <param name="disable">Action to disable device if needed</param>
 /// <param name="del">Time between each electric reads</param>
 public INA219Array(INA219[] iNA219s, Buzzer buz, DisplayLCD dis, Action disable, int del = 5000)
 {
     inas             = iNA219s;
     buzzer           = buz;
     display          = dis;
     delay            = del;
     emergencyDisable = disable;
     source           = new CancellationTokenSource();
 }
예제 #13
0
        private void Beep(string reason)
        {
            BeepInfo beep;

            if (mConfiguration.Beeps.TryGetValue(reason, out beep))
            {
                Buzzer.Beep(beep.Frequency, beep.Duration, beep.Times, beep.DutyTime);
            }
        }
예제 #14
0
 public static void RFIDError()
 {
     Buzzer.Write(GpioPinValue.High);
     Thread.Sleep(100);
     Buzzer.Write(GpioPinValue.Low);
     Thread.Sleep(50);
     Buzzer.Write(GpioPinValue.High);
     Thread.Sleep(100);
     Buzzer.Write(GpioPinValue.Low);
 }
예제 #15
0
        public new void Apply(double pressure)
        {
            pressureLoggerService.WriteLog(pressure);
            double speed = ComputeSpeed();

            if (speed > maxSpeed)
            {
                Buzzer.bip(12);
            }
        }
예제 #16
0
        private async Task <Buzzer> UpdateState(Buzzer buzzer)
        {
            if (buzzer.State != await _arduinoCommunicationService.Buzzers.Read(buzzer.PinPort))
            {
                buzzer.Switch();
                _buzzerRepository.Update(buzzer);
            }

            return(buzzer);
        }
예제 #17
0
 void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
 {
     if (e.Topic.Equals("incendio"))
     {
         String       message = new String(Encoding.UTF8.GetChars(e.Message));
         AlarmMessage m       = new AlarmMessage(message);
         Buzzer.setState(m.Alarm);
         StatusLed.led.SetLed(5, m.Alarm);
         StatusLed.led.SetLed(6, m.Alarm);
     }
 }
        public App()
        {
            object spiLock = new object();             //two devices on one spi bus, needs a lockObject

            ST7567.ST7567Pinning displayPinning = new ST7567.ST7567Pinning()
            {
                RST     = 2,
                A0      = 7,
                CS      = 0, //note this is not the pin but the /dev/spi1.x
                SpiBus  = 1,
                SpiLock = spiLock,
            };
            Display = new ST7567(displayPinning, 128, 64);

            PN5180.PN5180Pinning pn5180Pinning = new PN5180.PN5180Pinning()
            {
                RST  = 19,
                BUSY = 18,
                NSS  = 10,
                //IRQ = 18,
                CS      = 1, //note this is not the pin but the /dev/spi1.x
                SpiBus  = 1,
                SpiLock = spiLock,
            };
            Mifare = new PN5180(pn5180Pinning);

            RgbLed.RgbLedPinning rgbLedPinning = new RgbLed.RgbLedPinning()
            {
                Red   = 0,
                Green = 1,
                Blue  = 3
            };
            RgbLed = new RgbLed(rgbLedPinning);

            DigitalEncoder.DigitalEncoderPinning digitalEncoderPinning = new DigitalEncoder.DigitalEncoderPinning()
            {
                Enc0 = 12,
                Enc1 = 198,
                Enc2 = 199
            };
            DigitalEncoder            = new DigitalEncoder(digitalEncoderPinning);
            DigitalEncoder.Pushed    += DigitalEncoder_Pushed;
            DigitalEncoder.Releashed += DigitalEncoder_Releashed;
            DigitalEncoder.Right     += DigitalEncoder_Right;
            DigitalEncoder.Left      += DigitalEncoder_Left;

            Buzzer.BuzzerPinning buzzerPinning = new Buzzer.BuzzerPinning()
            {
                BuzzerPin = 6, //PA6
            };
            Buzzer = new Buzzer(buzzerPinning);

            UpdateScreen();
        }
        public ButtonTimerHostedService(IPIManager Pimanager)
        {
            _piManager   = Pimanager;
            button       = new Button(_piManager.grovePi, GrovePort.DigitalPin7);
            buzzer       = new Buzzer(_piManager.grovePi, GrovePort.DigitalPin6);
            buzzer.Value = 10;

            lightSensor      = new LightSensor(_piManager.grovePi, GrovePort.AnalogPin0);
            soundSesnor      = new SoundSensor(_piManager.grovePi, GrovePort.AnalogPin1);
            ultrasonicSensor = new UltrasonicSensor(_piManager.grovePi, GrovePort.DigitalPin8);
        }
예제 #20
0
 public void log(string msg)
 {
     try
     {
         lock (mutex) { File.AppendAllText(file2Log, getTimestamp() + msg + Environment.NewLine); }
     }
     catch
     {
         // if buzz that means I/O error, maybe no disk space, or invalid path
         Buzzer.Beep();
     }
 }
예제 #21
0
        private static void TestBuzzer()
        {
            int[]  notes  = new int[] { 261, 293, 329, 349, 392, 440, 493, 523 };
            Buzzer buzzer = new Buzzer(_goPiGo3, GrovePort.Grove1);

            Console.WriteLine($"Play notes on {buzzer.SensorName} on port {buzzer.Port} in loops, changing duty cycle 50 (default), 80 and 10. Press a enter to stop the test.");
            buzzer.Start();
            Console.WriteLine($"Playing with duty cycle = {buzzer.Duty}");
            int i = 0;

            while (!Console.KeyAvailable)
            {
                buzzer.Value = notes[i++];
                if (i == notes.Length)
                {
                    i = 0;
                }

                Thread.Sleep(1000);
            }

            var readkey = Console.ReadLine();

            buzzer.Duty = 80;
            Console.WriteLine($"Playing with duty cycle = {buzzer.Duty}");
            while (!Console.KeyAvailable)
            {
                buzzer.Value = notes[i++];
                if (i == notes.Length)
                {
                    i = 0;
                }

                Thread.Sleep(1000);
            }

            readkey     = Console.ReadLine();
            buzzer.Duty = 10;
            Console.WriteLine($"Playing with duty cycle = {buzzer.Duty}");
            while (!Console.KeyAvailable)
            {
                buzzer.Value = notes[i++];
                if (i == notes.Length)
                {
                    i = 0;
                }

                Thread.Sleep(1000);
            }

            buzzer.Stop();
        }
예제 #22
0
        public CreateEntityCommandResult Handle(CreateBuzzerCommand command)
        {
            CreateEntityCommandResult result = new CreateEntityCommandResult();

            ObjectId roomId;

            if (!ObjectId.TryParse(command.RoomId, out roomId))
            {
                AddNotification(nameof(roomId), ENotifications.InvalidFormat);
            }

            if (Valid)
            {
                PinPort pinPort = new PinPort(command.PinPort);
                Buzzer  buzzer  = new Buzzer(command.Description, pinPort, roomId);

                if (buzzer.Valid)
                {
                    if (_roomRepository.Get(roomId) == null)
                    {
                        AddNotification(nameof(command.RoomId), ENotifications.NotFound);
                    }

                    if (Valid)
                    {
                        _buzzerRepository.Create(buzzer);

                        if (_buzzerRepository.Valid)
                        {
                            result = new CreateEntityCommandResult(HttpStatusCode.OK).Build <Buzzer, CreateEntityCommandResult>(buzzer);
                        }
                    }

                    else
                    {
                        result = new CreateEntityCommandResult(HttpStatusCode.BadRequest, Notifications);
                    }
                }

                else
                {
                    result = new CreateEntityCommandResult(HttpStatusCode.BadRequest, buzzer.Notifications);
                }
            }

            else
            {
                result = new CreateEntityCommandResult(HttpStatusCode.BadRequest, Notifications);
            }

            return(result);
        }
예제 #23
0
 // beep thread
 static void Beep()
 {
     while (true)
     {
         if ((getLocalTime() % beepEvery) < epsilon)
         {
             Buzzer.On();
             Debug.Print("Beep. Local time: " + getLocalTime() + " offset is " + _offset);
             Thread.Sleep(buzzerOnTime);
             Buzzer.Off();
         }
     }
 }
예제 #24
0
        static void Main(string[] args)
        {
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            var buttonReader = new ButtonReader(RunMachineLearningCode);

            buttonReader.ReadButton(cancellationTokenSource.Token);

            _ledRed   = new Led(Led.LedColor.Red);
            _ledGreen = new Led(Led.LedColor.Green);
            _ledBlue  = new Led(Led.LedColor.Blue);

            _buzzer = new Buzzer();

            // Do the test run
            _ledRed.Flash();
            _ledGreen.Flash();
            _ledBlue.Flash();

            _buzzer.Buzz();

            Console.WriteLine("Ready to get going. Press any key to stop the program.");

            try
            {
                while (!Console.KeyAvailable)
                {
                    _ledBlue.On();

                    RunMachineLearningCode(false);
                    _ledBlue.Off();

                    Task.Delay(2000).Wait();
                }
            }
            finally
            {
                cancellationTokenSource.Cancel();

                cancellationTokenSource.Dispose();
                _ledRed.Off();
                _ledGreen.Off();
                _ledBlue.Off();

                buttonReader.Dispose();
                _buzzer.Dispose();
                _ledRed.Dispose();
                _ledGreen.Dispose();
                _ledBlue.Dispose();
            }
        }
예제 #25
0
        public async Task <CommandResult> Handle(SwitchBuzzerCommand command)
        {
            CommandResult result = new CommandResult();

            ObjectId buzzerId = new ObjectId();

            if (!ObjectId.TryParse(command.BuzzerId, out buzzerId))
            {
                AddNotification(nameof(command.BuzzerId), ENotifications.InvalidFormat);
            }

            if (Valid)
            {
                Buzzer buzzer = _buzzerRepository.Get(buzzerId);

                if (buzzer == null && _buzzerRepository.Valid)
                {
                    AddNotification(nameof(command.BuzzerId), ENotifications.NotFound);
                }

                if (Valid)
                {
                    buzzer = await UpdateState(buzzer);

                    buzzer.Switch();

                    if (await _arduinoCommunicationService.Buzzers.Switch(new SwitchBuzzerQuery(buzzer.PinPort, !buzzer.State)))
                    {
                        _buzzerRepository.Update(buzzer);

                        if (_arduinoCommunicationService.Buzzers.Valid)
                        {
                            result = new CommandResult(HttpStatusCode.OK);
                        }
                    }
                }

                else
                {
                    result = new CommandResult(HttpStatusCode.BadRequest, Notifications);
                }
            }

            else
            {
                result = new CommandResult(HttpStatusCode.BadRequest, Notifications);
            }

            return(result);
        }
예제 #26
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Buzzer otherObject = other.gameObject.GetComponent <Buzzer>();

        if (otherObject != null)
        {
            Destroy(other.gameObject);
            otherObject.Hit();
            otherObject.PutInBasket();
            otherObject.parentEnemy.UpdateText();

            AddScore(score_catchBuzzer);
        }
    }
예제 #27
0
        static private void TestPotentiometer()
        {
            Buzzer buzzer = new Buzzer(_goPiGo3, GrovePort.Grove1);
            PotentiometerSensor potentiometerSensor = new PotentiometerSensor(_goPiGo3, GrovePort.Grove2);

            Console.WriteLine($"Control the {buzzer.SensorName} on port {buzzer.Port} with the {potentiometerSensor.SensorName} on port {buzzer.Port}. Press enter to stop the test.");
            AddLines();
            buzzer.Value = potentiometerSensor.Value;
            buzzer.Start();
            while (!Console.KeyAvailable)
            {
                buzzer.Value = potentiometerSensor.Value;
                Thread.Sleep(100);
            }
            buzzer.Stop();
        }
예제 #28
0
        public void TestComplicated()
        {
            double          testWatts;
            IWattCalculator test = new ArduinoUno();

            Assert.AreEqual(21.40, test.Measure());
            testWatts = test.Measure();
            test      = new RGBLED(test);
            Assert.AreEqual(testWatts + 15.48, test.Measure());
            testWatts = test.Measure();
            test      = new Buzzer(test);
            Assert.AreEqual(testWatts + 8.91, test.Measure());
            testWatts = test.Measure();
            test      = new Resistor(test);
            Assert.AreEqual(testWatts + 17.24, test.Measure());
            testWatts = test.Measure();
            test      = new LED(test);
            Assert.AreEqual(testWatts + 12.36, test.Measure());
        }
예제 #29
0
 private static void AlarmCountDownSound(object sender, object e)
 {
     if (AlarmCountDownLeft > 0)
     {
         AlarmCountDownLeft--;
         Buzzer.Write(GpioPinValue.High);
         Thread.Sleep(100);
         Buzzer.Write(GpioPinValue.Low);
     }
     else
     {
         IsAlarmCountDownEnabled = false;
         string device = AlarmCountDown.Current.device;
         AlarmCountDown.Current.Hide();
         IsAlarmRinging = true;
         // Buzzer.Write(GpioPinValue.High);
         Globals.OpenDialog(device, "alarm");
     }
 }
예제 #30
0
        public static void Main()
        {
            try
            {
                //var light = new LightSensor(Boards.Espectro32.GpioPin.ESPECTRO32_PHOTO_TR_ANALOG_CHANNEL);
                //var lcd = new LcdRgbBacklight();
                //var rgb = new RgbLed(Boards.Espectro32.GpioPin.ESPECTRO32_RGBLED_GPIO);
                //rgb.Demo();
                buzz = new Buzzer(Boards.Espectro32.GpioPin.D14);
                Led  = new LedSocket(Boards.Espectro32.GpioPin.BoardLed);
                var btn = new Button(Boards.Espectro32.GpioPin.ESPECTRO32_BUTTON_A_PIN);
                btn.ButtonPressed  += Btn_ButtonPressed;
                btn.ButtonReleased += Btn_ButtonReleased;
                //int counter = 0;
                // User code goes here

                /*
                 *
                 * lcd.EnableDisplay(true);
                 */
                //var light = new LightSensor(Boards.Espectro32.AdcChannel.A0);
                while (true)
                {
                    //lcd.Clear();
                    //lcd.SetCursor(0, 0);
                    //lcd.Write("Hello : "+counter++);
                    //var lightVal = light.ReadLightLevel();
                    //Console.WriteLine(lightVal.ToString());
                    //Console.WriteLine("counter : "+counter++);
                    //var valRot = light.ReadLightLevel();
                    Led.TurnOn();
                    Thread.Sleep(1000);
                    Led.TurnOff();
                    Thread.Sleep(1000);
                }
            }
            catch (Exception ex)
            {
                // Do whatever please you with the exception caught
            }
        }