Beispiel #1
0
        void Initialize()
        {
            var onboardLed = new RgbPwmLed(
                device: Device,
                redPwmPin: Device.Pins.OnboardLedRed,
                greenPwmPin: Device.Pins.OnboardLedGreen,
                bluePwmPin: Device.Pins.OnboardLedBlue);

            onboardLed.SetColor(Color.Red);

            Up    = new PwmLed(Device.CreatePwmPort(Device.Pins.D07, 100, 0.0f), TypicalForwardVoltage.Red);
            Down  = new PwmLed(Device.CreatePwmPort(Device.Pins.D04, 100, 0.0f), TypicalForwardVoltage.Red);
            Left  = new PwmLed(Device.CreatePwmPort(Device.Pins.D02, 100, 0.0f), TypicalForwardVoltage.Red);
            Right = new PwmLed(Device.CreatePwmPort(Device.Pins.D03, 100, 0.0f), TypicalForwardVoltage.Red);

            joystick = new AnalogJoystick(
                Device.CreateAnalogInputPort(Device.Pins.A01),
                Device.CreateAnalogInputPort(Device.Pins.A00),
                null, true);

            joystick.SetCenterPosition();
            joystick.Updated += JoystickUpdated;
            joystick.StartUpdating(TimeSpan.FromMilliseconds(100));

            onboardLed.SetColor(Color.Green);
        }
Beispiel #2
0
        public MeadowApp()
        {
            joystick = new AnalogJoystick(
                Device.CreateAnalogInputPort(Device.Pins.A01),
                Device.CreateAnalogInputPort(Device.Pins.A00),
                null, false);

            joystick.SetCenterPosition(); //fire and forget
            joystick.Updated += JoystickUpdated;
            joystick.StartUpdating();
        }
        public MeadowApp()
        {
            var led = new RgbLed(Device, Device.Pins.OnboardLedRed, Device.Pins.OnboardLedGreen, Device.Pins.OnboardLedBlue);

            led.SetColor(RgbLed.Colors.Red);

            Up    = new PwmLed(Device.CreatePwmPort(Device.Pins.D07, 100, 0.0f), TypicalForwardVoltage.Red);
            Down  = new PwmLed(Device.CreatePwmPort(Device.Pins.D04, 100, 0.0f), TypicalForwardVoltage.Red);
            Left  = new PwmLed(Device.CreatePwmPort(Device.Pins.D02, 100, 0.0f), TypicalForwardVoltage.Red);
            Right = new PwmLed(Device.CreatePwmPort(Device.Pins.D03, 100, 0.0f), TypicalForwardVoltage.Red);

            joystick = new AnalogJoystick(
                Device.CreateAnalogInputPort(Device.Pins.A01),
                Device.CreateAnalogInputPort(Device.Pins.A00),
                null, true);

            joystick.SetCenterPosition();
            joystick.Updated += JoystickUpdated;
            joystick.StartUpdating();

            led.SetColor(RgbLed.Colors.Green);

            //TestAnalogJoystick();
        }