Пример #1
0
        //Breakout breakout = new Breakout(9);
        void timer_Tick(GT.Timer timer)
        {
            Debug.Print("--------");
            AnalogInput analogInput = breakout.CreateAnalogInput(GT.Socket.Pin.Three);

            Debug.Print("Voltage: " + analogInput.ReadVoltage().ToString());
        }
Пример #2
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");
            Breakout    breakout    = new Breakout(9);
            AnalogInput analogInput = breakout.CreateAnalogInput(GT.Socket.Pin.Three);

            while (true)
            {
                Debug.Print("Voltage: " + analogInput.ReadVoltage().ToString());
                Thread.Sleep(500);
            }

            /*
             * GT.Timer timer = new GT.Timer(500);
             * timer.Tick += timer_Tick;
             * timer.Start();
             */
        }