Ejemplo n.º 1
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing
            their name followed by a period, e.g.  button.  or  camera.

            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>

            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            GT.Socket ledSocket = GT.Socket.GetSocket(ledExtender.ExtenderSocketNumber, true, ledExtender, null);
            _ledStrip = new LedStripLPD8806(ledSocket, NUM_LEDS);

            _heartRateSensor = new GroveHeartRateSensor(GT.Socket.GetSocket(heartRateExtender.ExtenderSocketNumber, true, heartRateExtender, null), 40);
            _heartRateSensor.HeartBeat += (sender, time) =>
                               {
                                   Debug.Print(@"  --\");
                                   Debug.Print(@"     >  [BPM: " + _heartRateSensor.BeatsPerMinute + "]");
                                   Debug.Print(@"  --/");
                                   BlinkAll();
                               };

            var timer1 = new GT.Timer(250);
            timer1.Tick += timer => Debug.Print(@"  |");
            timer1.Start();
            //oledDisplay.SimpleGraphics.BackgroundColor = GT.Color.Red;
            //oledDisplay.SimpleGraphics.DisplayTextInRectangle("Now running!", 2, 2, 120, 20, GT.Color.Black, Resources.GetFont(Resources.FontResources.NinaB));
        }
Ejemplo n.º 2
0
        void ProgramStarted()
        {
            GT.Socket ledSocket = GT.Socket.GetSocket(ledExtender.ExtenderSocketNumber, true, ledExtender, null);
            mLedStrip = new LedStripLPD8806(ledSocket, NUM_LEDS);

            mLedStrip.Set(255,255,255);

            Thread.Sleep(10000);

            mLedStrip.TurnOff();
            return;

            var ledTimer = new GT.Timer(20000);
            ledTimer.Tick += timer => FlashTest();
            ledTimer.Start();
        }