Edit

Share via


DCMotor.Create Method

Definition

Overloads

Create(Int32, Int32, Int32, GpioController, Boolean)

Creates DCMotor instance using three pins which allows to control speed in both directions.

Create(Int32, Int32, GpioController, Boolean, Boolean)

Creates DCMotor instance using two pins which allows to control speed in both directions.

Create(PwmChannel, Int32, Int32, GpioController, Boolean)

Creates DCMotor instance using three pins which allows to control speed in both directions.

Create(PwmChannel, Int32, GpioController, Boolean, Boolean)

Creates DCMotor instance using two pins which allows to control speed in both directions.

Create(Int32, Int32, Int32, GpioController)
Create(Int32, Int32, GpioController)
Create(Int32, GpioController, Boolean)

Creates DCMotor instance using only one pin which allows to control speed in one direction.

Create(PwmChannel, Int32, GpioController)
Create(Int32, GpioController)
Create(PwmChannel)

Creates DCMotor instance using only one pin which allows to control speed in one direction.

Create(PwmChannel, Int32, Int32, GpioController)

Create(Int32, Int32, Int32, GpioController, Boolean)

Creates DCMotor instance using three pins which allows to control speed in both directions.

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, int directionPin, int otherDirectionPin, System.Device.Gpio.GpioController? controller = default, bool shouldDispose = true);
static member Create : int * int * int * System.Device.Gpio.GpioController * bool -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, directionPin As Integer, otherDirectionPin As Integer, Optional controller As GpioController = Nothing, Optional shouldDispose As Boolean = true) As DCMotor

Parameters

speedControlPin
Int32

Pin used to control the speed of the motor with software PWM (frequency will default to 50Hz)

directionPin
Int32

First pin used to control the direction of the motor

otherDirectionPin
Int32

Second pin used to control the direction of the motor

controller
GpioController

GpioController related to speedControlPin, directionPin and otherDirectionPin

shouldDispose
Boolean

True to dispose the Gpio Controller

Returns

DCMotor instance

Remarks

When speed is non-zero the value of otherDirectionPin will always be opposite to that of directionPin PWM pin speedControlPin should be connected to enable pin of the H-bridge. directionPin should be connected to H-bridge input corresponding to one of the motor inputs. otherDirectionPin should be connected to H-bridge input corresponding to the remaining motor input. Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(Int32, Int32, GpioController, Boolean, Boolean)

Creates DCMotor instance using two pins which allows to control speed in both directions.

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, int directionPin, System.Device.Gpio.GpioController? controller = default, bool shouldDispose = true, bool singleBiDirectionPin = false);
static member Create : int * int * System.Device.Gpio.GpioController * bool * bool -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, directionPin As Integer, Optional controller As GpioController = Nothing, Optional shouldDispose As Boolean = true, Optional singleBiDirectionPin As Boolean = false) As DCMotor

Parameters

speedControlPin
Int32

Pin used to control the speed of the motor with software PWM (frequency will default to 50Hz)

directionPin
Int32

Pin used to control the direction of the motor

controller
GpioController

GPIO controller related to speedControlPin and directionPin

shouldDispose
Boolean

True to dispose the Gpio Controller

singleBiDirectionPin
Boolean

True if a controller with one direction input is used, false if a controller with two direction inputs is used

Returns

DCMotor instance

Remarks

speedControlPin should be connected to the one of two inputs related with the motor direction (if H-bridge allows inputs to change frequently), or to PWM input if a controller with one direction input is used. directionPin should be connected to H-bridge input corresponding to one of the motor inputs. or to direction input if a controller with one direction input is used. Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(PwmChannel, Int32, Int32, GpioController, Boolean)

Creates DCMotor instance using three pins which allows to control speed in both directions.

public static Iot.Device.DCMotor.DCMotor Create (System.Device.Pwm.PwmChannel speedControlChannel, int directionPin, int otherDirectionPin, System.Device.Gpio.GpioController? controller = default, bool shouldDispose = true);
static member Create : System.Device.Pwm.PwmChannel * int * int * System.Device.Gpio.GpioController * bool -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlChannel As PwmChannel, directionPin As Integer, otherDirectionPin As Integer, Optional controller As GpioController = Nothing, Optional shouldDispose As Boolean = true) As DCMotor

Parameters

speedControlChannel
PwmChannel

PwmChannel used to control the speed of the motor

directionPin
Int32

First pin used to control the direction of the motor

otherDirectionPin
Int32

Second pin used to control the direction of the motor

controller
GpioController

GpioController related to directionPin and otherDirectionPin

shouldDispose
Boolean

True to dispose the Gpio Controller

Returns

DCMotor instance

Remarks

When speed is non-zero the value of otherDirectionPin will always be opposite to that of directionPin. speedControlChannel should be connected to enable pin of the H-bridge. directionPin should be connected to H-bridge input corresponding to one of the motor inputs. otherDirectionPin should be connected to H-bridge input corresponding to the remaining motor input. Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(PwmChannel, Int32, GpioController, Boolean, Boolean)

Creates DCMotor instance using two pins which allows to control speed in both directions.

public static Iot.Device.DCMotor.DCMotor Create (System.Device.Pwm.PwmChannel speedControlChannel, int directionPin, System.Device.Gpio.GpioController? controller = default, bool shouldDispose = true, bool singleBiDirectionPin = false);
static member Create : System.Device.Pwm.PwmChannel * int * System.Device.Gpio.GpioController * bool * bool -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlChannel As PwmChannel, directionPin As Integer, Optional controller As GpioController = Nothing, Optional shouldDispose As Boolean = true, Optional singleBiDirectionPin As Boolean = false) As DCMotor

Parameters

speedControlChannel
PwmChannel

PwmChannel used to control the speed of the motor

directionPin
Int32

Pin used to control the direction of the motor

controller
GpioController

GpioController related to the directionPin

shouldDispose
Boolean

True to dispose the Gpio Controller

singleBiDirectionPin
Boolean

True if a controller with one direction input is used, false if a controller with two direction inputs is used

Returns

DCMotor instance

Remarks

speedControlChannel should be connected to the one of two inputs related with the motor direction (if H-bridge allows inputs to change frequently), or to PWM input if a controller with one direction input is used. directionPin should be connected to H-bridge input corresponding to one of the motor inputs. or to direction input if a controller with one direction input is used. Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(Int32, Int32, Int32, GpioController)

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, int directionPin, int otherDirectionPin, System.Device.Gpio.GpioController controller = default);
static member Create : int * int * int * System.Device.Gpio.GpioController -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, directionPin As Integer, otherDirectionPin As Integer, Optional controller As GpioController = Nothing) As DCMotor

Parameters

speedControlPin
Int32
directionPin
Int32
otherDirectionPin
Int32
controller
GpioController

Returns

Applies to

Create(Int32, Int32, GpioController)

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, int directionPin, System.Device.Gpio.GpioController controller = default);
static member Create : int * int * System.Device.Gpio.GpioController -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, directionPin As Integer, Optional controller As GpioController = Nothing) As DCMotor

Parameters

speedControlPin
Int32
directionPin
Int32
controller
GpioController

Returns

Applies to

Create(Int32, GpioController, Boolean)

Creates DCMotor instance using only one pin which allows to control speed in one direction.

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, System.Device.Gpio.GpioController? controller = default, bool shouldDispose = true);
static member Create : int * System.Device.Gpio.GpioController * bool -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, Optional controller As GpioController = Nothing, Optional shouldDispose As Boolean = true) As DCMotor

Parameters

speedControlPin
Int32

Pin used to control the speed of the motor with software PWM (frequency will default to 50Hz)

controller
GpioController

GpioController related to the speedControlPin

shouldDispose
Boolean

True to dispose the Gpio Controller

Returns

DCMotor instance

Remarks

speedControlPin can be connected to either enable pin of the H-bridge. or directly to the on of two inputs related with the motor direction (if H-bridge allows inputs to change frequently). Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(PwmChannel, Int32, GpioController)

public static Iot.Device.DCMotor.DCMotor Create (System.Device.Pwm.PwmChannel speedControlChannel, int directionPin, System.Device.Gpio.GpioController controller = default);
static member Create : System.Device.Pwm.PwmChannel * int * System.Device.Gpio.GpioController -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlChannel As PwmChannel, directionPin As Integer, Optional controller As GpioController = Nothing) As DCMotor

Parameters

speedControlChannel
PwmChannel
directionPin
Int32
controller
GpioController

Returns

Applies to

Create(Int32, GpioController)

public static Iot.Device.DCMotor.DCMotor Create (int speedControlPin, System.Device.Gpio.GpioController controller = default);
static member Create : int * System.Device.Gpio.GpioController -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlPin As Integer, Optional controller As GpioController = Nothing) As DCMotor

Parameters

speedControlPin
Int32
controller
GpioController

Returns

Applies to

Create(PwmChannel)

Creates DCMotor instance using only one pin which allows to control speed in one direction.

public static Iot.Device.DCMotor.DCMotor Create (System.Device.Pwm.PwmChannel speedControlChannel);
static member Create : System.Device.Pwm.PwmChannel -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlChannel As PwmChannel) As DCMotor

Parameters

speedControlChannel
PwmChannel

PwmChannel used to control the speed of the motor

Returns

DCMotor instance

Remarks

PWM pin speedControlChannel can be connected to either enable pin of the H-bridge. or directly to the one of two inputs related with the motor direction (if H-bridge allows inputs to change frequently). Connecting motor directly to GPIO pin is not recommended and may damage your board.

Applies to

Create(PwmChannel, Int32, Int32, GpioController)

public static Iot.Device.DCMotor.DCMotor Create (System.Device.Pwm.PwmChannel speedControlChannel, int directionPin, int otherDirectionPin, System.Device.Gpio.GpioController controller = default);
static member Create : System.Device.Pwm.PwmChannel * int * int * System.Device.Gpio.GpioController -> Iot.Device.DCMotor.DCMotor
Public Shared Function Create (speedControlChannel As PwmChannel, directionPin As Integer, otherDirectionPin As Integer, Optional controller As GpioController = Nothing) As DCMotor

Parameters

speedControlChannel
PwmChannel
directionPin
Int32
otherDirectionPin
Int32
controller
GpioController

Returns

Applies to