Beispiel #1
0
        public static void Main()
        {
            // Setup GoBus ports
            led1 = new NetduinoGo.RgbLed(GoSockets.Socket8);
            led2 = new NetduinoGo.RgbLed(GoSockets.Socket7);
            led3 = new NetduinoGo.RgbLed(GoSockets.Socket6);
            button1 = new NetduinoGo.Button(GoSockets.Socket1);
            button2 = new NetduinoGo.Button(GoSockets.Socket3);
            InterruptPort settingButton = new InterruptPort(Pins.Button, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
            settingButton.OnInterrupt += new NativeEventHandler(settingButton_OnInterrupt);
            OutputPort powerlight = new OutputPort(Pins.PowerLed, false);

            #if !mute
            buzzer = new NetduinoGo.PiezoBuzzer();
            #endif

            // Set Scale
            SetScale();

            // Register Buttons
            button1.ButtonPressed += new NetduinoGo.Button.ButtonEventHandler(button1_ButtonPressed);
            button2.ButtonPressed += new NetduinoGo.Button.ButtonEventHandler(button2_ButtonPressed);
            led2.SetColor(0, 0, 255);
            // Main thread sleep time
            Thread.Sleep(Timeout.Infinite);
        }
        public static void Main()
        {
            NetduinoGo.Potentiometer pot    = new NetduinoGo.Potentiometer();
            NetduinoGo.PiezoBuzzer   buzzer = new NetduinoGo.PiezoBuzzer();

            while (true)
            {
                buzzer.SetFrequency(pot.GetValue() * 2000);
            }
        }