Remarks
Tb67h420ftg | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
Tb67h420ftg motorDriver;
PushButton button1;
PushButton button2;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
button1 = new PushButton(Device.Pins.D12, ResistorMode.InternalPullDown);
button2 = new PushButton(Device.Pins.D13, ResistorMode.InternalPullDown);
button1.PressStarted += Button1_PressStarted;
button1.PressEnded += Button1_PressEnded;
button2.PressStarted += Button2_PressStarted;
button2.PressEnded += Button2_PressEnded;
motorDriver = new Tb67h420ftg(
inA1: Device.Pins.D04, inA2: Device.Pins.D03, pwmA: Device.Pins.D01,
inB1: Device.Pins.D05, inB2: Device.Pins.D06, pwmB: Device.Pins.D00,
fault1: Device.Pins.D02, fault2: Device.Pins.D07,
hbMode: Device.Pins.D09, tblkab: Device.Pins.D10);
// 6V motors with a 12V input. this clamps them to 6V
motorDriver.Motor1.MotorCalibrationMultiplier = 0.5f;
motorDriver.Motor2.MotorCalibrationMultiplier = 0.5f;
Resolver.Log.Info("Initialization complete.");
return base.Initialize();
}
private void Button1_PressStarted(object sender, EventArgs e)
{
Resolver.Log.Info("Motor 1 start.");
motorDriver.Motor1.Power = 1f;
}
private void Button1_PressEnded(object sender, EventArgs e)
{
Resolver.Log.Info("Motor 1 stop.");
motorDriver.Motor1.Power = 0f;
}
private void Button2_PressStarted(object sender, EventArgs e)
{
Resolver.Log.Info("Motor 2 start.");
motorDriver.Motor2.Power = 0.5f;
}
private void Button2_PressEnded(object sender, EventArgs e)
{
Resolver.Log.Info("Motor 2 stop.");
motorDriver.Motor2.Power = 0f;
}
Sample project(s) available on GitHub
Wiring Example
To wire a Tb67h420ftg to your Meadow board, connect the following:
Tb67h420ftg | Meadow Pin |
---|---|
GND | GND |
VCC | 5V |
INA1 | D04 |
INA2 | D03 |
PWMA | D01 |
INB1 | D05 |
INB2 | D06 |
PWMB | D00 |
LOW1 | D02 |
LOW2 | D07 |
HBMODE | D09 |
TBLKAB | D10 |
It should look like the following diagram:
Characteristic | Locus |
---|---|
Inheritance | System.Object > Tb67h420ftg |
Namespace | Meadow.Foundation.Motors |
Assembly | Tb67h420ftg.dll |
Syntax
public class Tb67h420ftg : object
Constructors
Tb67h420ftg(IPin, IPin, IPin, Nullable<IPin>, Nullable<IPin>, Nullable<IPin>, Nullable<IPin>, Nullable<IPin>, Nullable<IPin>, Nullable<IPin>)
Create a new Tb67h420ftg object
Declaration
public Tb67h420ftg(IPin inA1, IPin inA2, IPin pwmA, IPin? inB1, IPin? inB2, IPin? pwmB, IPin? fault1, IPin? fault2, IPin? hbMode = null, IPin? tblkab = null)
Parameters
Type | Name | Description |
---|---|---|
IPin | inA1 | |
IPin | inA2 | |
IPin | pwmA | |
System.Nullable<IPin> | inB1 | |
System.Nullable<IPin> | inB2 | |
System.Nullable<IPin> | pwmB | |
System.Nullable<IPin> | fault1 | |
System.Nullable<IPin> | fault2 | |
System.Nullable<IPin> | hbMode | |
System.Nullable<IPin> | tblkab |
Tb67h420ftg(IPwmPort, IPwmPort, IDigitalOutputPort, Nullable<IPwmPort>, Nullable<IPwmPort>, Nullable<IDigitalOutputPort>, Nullable<IDigitalInputPort>, Nullable<IDigitalInputPort>, Nullable<IDigitalOutputPort>, Nullable<IDigitalOutputPort>)
Create a new Tb67h420ftg object
Declaration
public Tb67h420ftg(IPwmPort inA1, IPwmPort inA2, IDigitalOutputPort pwmA, IPwmPort? inB1, IPwmPort? inB2, IDigitalOutputPort? pwmB, IDigitalInputPort? fault1, IDigitalInputPort? fault2, IDigitalOutputPort? hbMode = null, IDigitalOutputPort? tblkab = null)
Parameters
Type | Name | Description |
---|---|---|
IPwmPort | inA1 | |
IPwmPort | inA2 | |
IDigitalOutputPort | pwmA | |
System.Nullable<IPwmPort> | inB1 | |
System.Nullable<IPwmPort> | inB2 | |
System.Nullable<IDigitalOutputPort> | pwmB | |
System.Nullable<IDigitalInputPort> | fault1 | |
System.Nullable<IDigitalInputPort> | fault2 | |
System.Nullable<IDigitalOutputPort> | hbMode | |
System.Nullable<IDigitalOutputPort> | tblkab |
Fields
hbridgeMode
H-bridge mode
Declaration
protected Tb67h420ftg.HBridgeMode hbridgeMode
Field Value
Type | Description |
---|---|
Tb67h420ftg.HBridgeMode |
Properties
Motor1
Motor 1
Declaration
public HBridgeMotor Motor1 { get; protected set; }
Property Value
Type | Description |
---|---|
HBridgeMotor |
Motor2
Motor 2
Declaration
public HBridgeMotor Motor2 { get; protected set; }
Property Value
Type | Description |
---|---|
HBridgeMotor |