/// <summary> /// H-Bridge-compatible Motor Driver (as used on the DFRobot Motorshield) /// </summary> /// <param name="Speed1">Motor 1 PWM control</param> /// <param name="Direction1">Motor 1 Direction control</param> /// <param name="Speed2">Motor 2 PWM control</param> /// <param name="Direction2">Motor 2 Direction control</param> public HBridge(IPWMPort Speed1, Cpu.Pin Direction1, IPWMPort Speed2, Cpu.Pin Direction2) { _Motor1Speed = Speed1; _Motor2Speed = Speed2; _Motor1Direction = new OutputPort(Direction1, false); _Motor2Direction = new OutputPort(Direction2, false); }
/// <summary> /// H-Bridge-compatible Motor Driver (as used on the DFRobot Motorshield) /// </summary> /// <param name="Speed1">Motor 1 PWM control</param> /// <param name="Direction1">Motor 1 Direction control</param> /// <param name="Speed2">Motor 2 PWM control</param> /// <param name="Direction2">Motor 2 Direction control</param> public HBridge(Cpu.PWMChannel Speed1, Cpu.Pin Direction1, Cpu.PWMChannel Speed2, Cpu.Pin Direction2) { _Motor1Speed = new IntegratedPWM(Speed1); _Motor2Speed = new IntegratedPWM(Speed2); _Motor1Direction = new OutputPort(Direction1, false); _Motor2Direction = new OutputPort(Direction2, false); }
/// <summary> /// /// </summary> /// <param name="ClockPin">SPI Clock pin</param> /// <param name="EnablePin">SPI Enable pin</param> /// <param name="DataPin">SPI Data pin</param> /// <param name="LatchPin">SPI Latch pin</param> /// <param name="Motor1Pwm">Motor 1 PWM pin</param> /// <param name="Motor2Pwm">Motor 2 PWM pin</param> /// <param name="Motor3Pwm">Motor 3 PWM pin</param> /// <param name="Motor4Pwm">Motor 4 PWM pin</param> public AdafruitMotorshield( Cpu.Pin ClockPin, Cpu.Pin EnablePin, Cpu.Pin DataPin, Cpu.Pin LatchPin, IPWMPort Motor1Pwm, IPWMPort Motor2Pwm, IPWMPort Motor3Pwm, IPWMPort Motor4Pwm ) { // This one should always be false this._EnablePin = new OutputPort(EnablePin, false); // Defines the 74HC595 chip by bitbanging this._IcOut = new Ic74hc595(ClockPin, DataPin, LatchPin); // Defines all 8 pins on the 74HC595 this._Motor1aPin = this._IcOut.Pins[2]; // M1A this._Motor1bPin = this._IcOut.Pins[3]; // M1B this._Motor2aPin = this._IcOut.Pins[1]; // M2A this._Motor2bPin = this._IcOut.Pins[4]; // M3B this._Motor4aPin = this._IcOut.Pins[0]; // M4A this._Motor4bPin = this._IcOut.Pins[6]; // M4B this._Motor3aPin = this._IcOut.Pins[5]; // M3A this._Motor3bPin = this._IcOut.Pins[7]; // M3B // Motor PWM pins this._Motor1Pwm = Motor1Pwm; // PWM2A this._Motor2Pwm = Motor2Pwm; // PWM2B this._Motor3Pwm = Motor3Pwm; // PWM0A this._Motor4Pwm = Motor4Pwm; // PWM0B if (this._Motor1Pwm != null) { this._Motor1Pwm.SetDutyCycle(0); this._Motor1Pwm.StartPulse(); } if (this._Motor2Pwm != null) { this._Motor2Pwm.SetDutyCycle(0); this._Motor2Pwm.StartPulse(); } if (this._Motor3Pwm != null) { this._Motor3Pwm.SetDutyCycle(0); this._Motor3Pwm.StartPulse(); } if (this._Motor4Pwm != null) { this._Motor4Pwm.SetDutyCycle(0); this._Motor4Pwm.StartPulse(); } }
/// <summary> /// Common RGB-led /// </summary> /// <param name="RedPin">The PWM-pin connected to Red</param> /// <param name="GreenPin">The PWM-pin connected to Green</param> /// <param name="BluePin">The PWM-pin connected to Blue</param> /// <param name="CommonAnode">Specifies if the led is common anode</param> public RgbLed(IPWMPort RedPin, IPWMPort GreenPin, IPWMPort BluePin, bool CommonAnode = true) { this._Red = RedPin; this._Green = GreenPin; this._Blue = BluePin; this._Red.StartPulse(); this._Green.StartPulse(); this._Blue.StartPulse(); this._CommonAnode = CommonAnode; }
/// <summary> /// Common RGB-led /// </summary> /// <param name="RedPin">The PWM-pin connected to Red</param> /// <param name="GreenPin">The PWM-pin connected to Green</param> /// <param name="BluePin">The PWM-pin connected to Blue</param> /// <param name="CommonAnode">Specifies if the led is common anode</param> public RgbLed(Cpu.PWMChannel RedPin, Cpu.PWMChannel GreenPin, Cpu.PWMChannel BluePin, bool CommonAnode = true) { this._Red = new IntegratedPWM(RedPin); this._Green = new IntegratedPWM(GreenPin); this._Blue = new IntegratedPWM(BluePin); this._Red.StartPulse(); this._Green.StartPulse(); this._Blue.StartPulse(); this._CommonAnode = CommonAnode; }
/// <summary> /// Defines a speaker /// </summary> /// <param name="PwmPort">The PWM port the speaker is connected to</param> public Speaker(Cpu.PWMChannel PwmPort) { this._Speaker = new IntegratedPWM(PwmPort); }
/// <summary> /// Defines a speaker /// </summary> /// <param name="PwmPort">The PWM port the speaker is connected to</param> public Speaker(Cpu.Pin PwmPort) { this._Speaker = ProviderCollection.GetPWMByPin(PwmPort); }
/// <summary> /// Defines a speaker /// </summary> /// <param name="PwmPort">The PWM port the speaker is connected to</param> public Speaker(IPWMPort PwmPort) { this._Speaker = PwmPort; }