public SevenSegmentDisplay(IPinInterface centerPin, IPinInterface upperLeftPin, IPinInterface topPin, IPinInterface upperRightPin, IPinInterface lowerLeftPin, IPinInterface bottomPin, IPinInterface lowerRightPin, IPinInterface decimalPin = null) { Center = centerPin; UpperLeft = upperLeftPin; Top = topPin; UpperRight = upperRightPin; LowerLeft = lowerLeftPin; Bottom = bottomPin; LowerRight = lowerRightPin; Decimal = decimalPin; }
/// <summary>Creates a new shift register</summary> /// <param name="enabledPin">The pin controlling if the register is enabled</param> /// <param name="dataPin">The pin controlling the data input to the register</param> /// <param name="shiftPin">The pin controlling when to shift bits</param> /// <param name="outputPin">The pin controlling when to output data</param> /// <param name="clearPin">The pin controlling when to clear the register</param> public ShiftRegister(IPinInterface enabledPin, IPinInterface dataPin, IPinInterface shiftPin, IPinInterface outputPin, IPinInterface?clearPin = null) : base(dataPin, shiftPin) { _enabled = enabledPin; _output = outputPin; _clear = clearPin; if (_enabled != null) { _enabled.PowerMode = PowerMode.Differential; } if (_clear != null) { _clear.PowerMode = PowerMode.Differential; } }
public Game(RaspberryPi pi) { _cpuRed = pi.Pin11; _cpuYellow = pi.Pin13; _cpuGreen = pi.Pin15; _redButton = pi.Pin16; _yellowButton = pi.Pin18; _greenButton = pi.Pin22; _score1 = pi.Pin36; _score2 = pi.Pin38; _score3 = pi.Pin40; _difficultyDial = new RotaryEncoder(pi.Pin32, pi.Pin31); _random = new Random(); }
/// <summary>Creates a new DC motor</summary> /// <param name="enabledPin">The pin controlling if the motor is enabled</param> /// <param name="clockwisePin">The pin controlling clockwise rotation</param> /// <param name="counterclockwisePin">The pin controlling counter-clockwise rotation</param> public Motor(IPinInterface?enabledPin, IPinInterface clockwisePin, IPinInterface?counterclockwisePin = null) { _enabled = enabledPin; _clockwise = clockwisePin; _counterclockwise = counterclockwisePin; }
public RobotController(RaspberryPi pi) { _drive = new Motor(pi.Pin11, pi.Pin13); _flag = new Motor(pi.Pin33, pi.Pin35); _buzzer = pi.Pin40; }
protected Input(IPinInterface data, IPinInterface clock) { _clock = clock; _data = data; }
public InputStub(IPinInterface data, IPinInterface clock) : base(data, clock) { }
public PiController(RaspberryPi pi) { _redLED = pi.Pin16; _yellowLED = pi.Pin18; _greenLED = pi.Pin22; }
public RotaryEncoder(IPinInterface clockPin, IPinInterface dataPin) { _increase = clockPin; _decrease = dataPin; }
private static void SetComponent(IPinInterface pin, byte value) => pin.Strength = value / 2.55;
/// <summary>Creates a new RGB LED</summary> /// <param name="redPin">The pin controlling the red diode</param> /// <param name="greenPin">The pin controlling the green diode</param> /// <param name="bluePin">The pin controlling the blue diode</param> public RGBLED(IPinInterface redPin, IPinInterface greenPin, IPinInterface bluePin) { _red = redPin; _green = greenPin; _blue = bluePin; }