public MeadowApp() { leds = new PwmLed[7]; leds[0] = new PwmLed( Device.CreatePwmPort(Device.Pins.D06), TypicalForwardVoltage.Red); leds[1] = new PwmLed( Device.CreatePwmPort(Device.Pins.D07), TypicalForwardVoltage.Red); leds[2] = new PwmLed( Device.CreatePwmPort(Device.Pins.D08), TypicalForwardVoltage.Red); leds[3] = new PwmLed( Device.CreatePwmPort(Device.Pins.D09), TypicalForwardVoltage.Yellow); leds[4] = new PwmLed( Device.CreatePwmPort(Device.Pins.D10), TypicalForwardVoltage.Yellow); leds[5] = new PwmLed( Device.CreatePwmPort(Device.Pins.D11), TypicalForwardVoltage.Red); leds[6] = new PwmLed( Device.CreatePwmPort(Device.Pins.D12), TypicalForwardVoltage.Red); button = new PushButton(Device, Device.Pins.D05); button.Clicked += ButtonClicked; ShuffleAnimation(); // Keeps the app running Thread.Sleep(Timeout.Infinite); }
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, Device.Pins.D13, TypicalForwardVoltage.Red); down = new PwmLed(Device, Device.Pins.D10, TypicalForwardVoltage.Red); left = new PwmLed(Device, Device.Pins.D11, TypicalForwardVoltage.Red); right = new PwmLed(Device, Device.Pins.D12, TypicalForwardVoltage.Red); up.IsOn = down.IsOn = left.IsOn = right.IsOn = false; var motorLeft = new HBridgeMotor ( a1Pin: Device.CreatePwmPort(Device.Pins.D05), a2Pin: Device.CreatePwmPort(Device.Pins.D06), enablePin: Device.CreateDigitalOutputPort(Device.Pins.D07) ); var motorRight = new HBridgeMotor ( a1Pin: Device.CreatePwmPort(Device.Pins.D02), a2Pin: Device.CreatePwmPort(Device.Pins.D03), enablePin: Device.CreateDigitalOutputPort(Device.Pins.D04) ); carController = new CarController(motorLeft, motorRight); led.SetColor(RgbLed.Colors.Green); TestCar(); }
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); }
void Initialize() { var onboardLed = new RgbPwmLed( device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue); onboardLed.SetColor(Color.Red); notes = new float[] { 261.63f, 329.63f, 392, 523.25f }; game = new SimonGame(); leds = new PwmLed[4]; leds[0] = new PwmLed(Device, Device.Pins.D10, TypicalForwardVoltage.Red); leds[1] = new PwmLed(Device, Device.Pins.D09, TypicalForwardVoltage.Green); leds[2] = new PwmLed(Device, Device.Pins.D08, TypicalForwardVoltage.Blue); leds[3] = new PwmLed(Device, Device.Pins.D07, TypicalForwardVoltage.Yellow); buttons = new PushButton[4]; buttons[0] = new PushButton(Device, Device.Pins.MISO); buttons[0].Clicked += ButtonRedClicked; buttons[1] = new PushButton(Device, Device.Pins.D02); buttons[1].Clicked += ButtonGreenClicked; buttons[2] = new PushButton(Device, Device.Pins.D03); buttons[2].Clicked += ButtonBlueClicked; buttons[3] = new PushButton(Device, Device.Pins.D04); buttons[3].Clicked += ButtonYellowClicked; speaker = new PiezoSpeaker(Device, Device.Pins.D12); onboardLed.SetColor(Color.Green); }
public void ConfigurePeripherals() { Console.WriteLine("Creating peripherals..."); this._redPwmLed = new PwmLed(Device, Device.Pins.OnboardLedRed, TypicalForwardVoltage.ResistorLimited, CircuitTerminationType.High); this._greenPwmLed = new PwmLed(Device, Device.Pins.OnboardLedGreen, TypicalForwardVoltage.ResistorLimited, CircuitTerminationType.High); this._bluePwmLed = new PwmLed(Device, Device.Pins.OnboardLedBlue, TypicalForwardVoltage.ResistorLimited, CircuitTerminationType.High); }
public void blinkLed() { Console.WriteLine("Creating Outputs..."); var pwmRedLed = new PwmLed(Device, Device.Pins.D13, TypicalForwardVoltage.Red); var pwmBlueLed = new PwmLed(Device, Device.Pins.D12, TypicalForwardVoltage.Blue); pwmRedLed.StartBlink(10, 10); pwmBlueLed.StartBlink(10, 10); Thread.Sleep(Timeout.Infinite); }
void Initialize() { led = new RgbLed( Device, Device.Pins.OnboardLedRed, Device.Pins.OnboardLedGreen, Device.Pins.OnboardLedBlue); led.SetColor(RgbLed.Colors.Red); ledUp = new PwmLed(Device, Device.Pins.D13, TypicalForwardVoltage.Red); ledDown = new PwmLed(Device, Device.Pins.D10, TypicalForwardVoltage.Red); ledLeft = new PwmLed(Device, Device.Pins.D11, TypicalForwardVoltage.Red); ledRight = new PwmLed(Device, Device.Pins.D12, TypicalForwardVoltage.Red); ledUp.IsOn = ledDown.IsOn = ledLeft.IsOn = ledRight.IsOn = true; var motorLeft = new HBridgeMotor ( device: Device, a1Pin: Device.Pins.D05, a2Pin: Device.Pins.D06, enablePin: Device.Pins.D07 ); var motorRight = new HBridgeMotor ( device: Device, a1Pin: Device.Pins.D02, a2Pin: Device.Pins.D03, enablePin: Device.Pins.D04 ); carController = new CarController(motorLeft, motorRight); led.SetColor(RgbLed.Colors.Blue); bleTreeDefinition = GetDefinition(); Device.BluetoothAdapter.StartBluetoothServer(bleTreeDefinition); up.ValueSet += UpValueSet; down.ValueSet += DownValueSet; left.ValueSet += LeftValueSet; right.ValueSet += RightValueSet; led.SetColor(RgbLed.Colors.Green); }
private void InitializePeripherals() { resetButton = new PushButton(N.Pins.ONBOARD_BTN, Netduino.Foundation.CircuitTerminationType.Floating); resetButton.Clicked += OnResetButton; tree = new InputPort(N.Pins.GPIO_PIN_D10, true, Port.ResistorMode.PullUp); speaker = new PiezoSpeaker(N.PWMChannels.PWM_PIN_D3); greenLed = new PwmLed(N.PWMChannels.PWM_PIN_D5, 2.0f); redLed = new PwmLed(N.PWMChannels.PWM_PIN_D6, 2.0f); var ssd1306 = new SSD1306(0x3c, 400, SSD1306.DisplayType.OLED128x64); display = new GraphicsLibrary(ssd1306); display.CurrentFont = new Font8x12(); display.Clear(true); PlayBuzzer(); }
public MeadowApp() { var led = new RgbLed(Device, Device.Pins.OnboardLedRed, Device.Pins.OnboardLedGreen, Device.Pins.OnboardLedBlue); led.SetColor(RgbLed.Colors.Red); leds = new PwmLed[7]; leds[0] = new PwmLed(Device.CreatePwmPort(Device.Pins.D06), TypicalForwardVoltage.Red); // leds[1] = new PwmLed(Device.CreatePwmPort(Device.Pins.D07), TypicalForwardVoltage.Red); // [6] [5] leds[2] = new PwmLed(Device.CreatePwmPort(Device.Pins.D08), TypicalForwardVoltage.Red); // leds[3] = new PwmLed(Device.CreatePwmPort(Device.Pins.D09), TypicalForwardVoltage.Red); // [4] [3] [2] leds[4] = new PwmLed(Device.CreatePwmPort(Device.Pins.D10), TypicalForwardVoltage.Red); // leds[5] = new PwmLed(Device.CreatePwmPort(Device.Pins.D11), TypicalForwardVoltage.Red); // [1] [0] leds[6] = new PwmLed(Device.CreatePwmPort(Device.Pins.D12), TypicalForwardVoltage.Red); // button = new PushButton(Device, Device.Pins.D05); button.Clicked += ButtonClicked; led.SetColor(RgbLed.Colors.Green); ShuffleAnimation(); }
void Initialize() { var onboardLed = new RgbPwmLed( device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue); onboardLed.SetColor(Color.Red); leds = new PwmLed[7]; leds[0] = new PwmLed(Device.CreatePwmPort(Device.Pins.D06), TypicalForwardVoltage.Red); // leds[1] = new PwmLed(Device.CreatePwmPort(Device.Pins.D07), TypicalForwardVoltage.Red); // [6] [5] leds[2] = new PwmLed(Device.CreatePwmPort(Device.Pins.D08), TypicalForwardVoltage.Red); // leds[3] = new PwmLed(Device.CreatePwmPort(Device.Pins.D09), TypicalForwardVoltage.Red); // [4] [3] [2] leds[4] = new PwmLed(Device.CreatePwmPort(Device.Pins.D10), TypicalForwardVoltage.Red); // leds[5] = new PwmLed(Device.CreatePwmPort(Device.Pins.D11), TypicalForwardVoltage.Red); // [1] [0] leds[6] = new PwmLed(Device.CreatePwmPort(Device.Pins.D12), TypicalForwardVoltage.Red); // button = new PushButton(Device, Device.Pins.D05); button.Clicked += ButtonClicked; onboardLed.SetColor(Color.Green); }
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(); }
public App() { // instantiate our peripherals this._rotary = new RotaryEncoder(N.Pins.GPIO_PIN_D6, N.Pins.GPIO_PIN_D7); this._led = new PwmLed(N.PWMChannels.PWM_PIN_D11, TypicalForwardVoltage.Green); }
public App() { // instantiate our peripherals this._rotary = new RotaryEncoderWithButton(N.Pins.GPIO_PIN_D6, N.Pins.GPIO_PIN_D7, N.Pins.GPIO_PIN_D5, CircuitTerminationType.CommonGround); this._led = new PwmLed(N.PWMChannels.PWM_PIN_D11, TypicalForwardVoltage.Green); }