C# Class BrickPi.Movement.Motor

This class contains a motor object and all needed functions and properties to pilot it
Inheritance: INotifyPropertyChanged
Show file Open project: Ellerbach/BrickPi

Public Methods

Method Description
GetSpeed ( ) : int

Get the speed

GetTachoCount ( ) : Int32

Gets the tacho count

Motor ( BrickPortMotor port ) : System

Create a motor

Motor ( BrickPortMotor port, int timeout ) : System
SetPolarity ( Polarity polarity ) : void

Change the polatity of the motor

SetSpeed ( int speed ) : void

Set the speed of the motor

SetTachoCount ( Int32 position ) : void

Set Tachometer encoder offset Use this to reset or setup a specific position

Start ( ) : void

Start the motor

Start ( int speed ) : void

Start with the specified speed

Stop ( ) : void

Stop the Motor

UpdateSensor ( object state ) : void

Update the sensor and this will raised an event on the interface

Private Methods

Method Description
OnPropertyChanged ( string name ) : void
StopTimerInternal ( ) : void

Method Details

GetSpeed() public method

Get the speed
public GetSpeed ( ) : int
return int

GetTachoCount() public method

Gets the tacho count
public GetTachoCount ( ) : Int32
return System.Int32

Motor() public method

Create a motor
public Motor ( BrickPortMotor port ) : System
port BrickPortMotor Motor port
return System

Motor() public method

public Motor ( BrickPortMotor port, int timeout ) : System
port BrickPortMotor
timeout int
return System

SetPolarity() public method

Change the polatity of the motor
public SetPolarity ( Polarity polarity ) : void
polarity Polarity Polarity of the motor, backward, forward or opposite
return void

SetSpeed() public method

Set the speed of the motor
public SetSpeed ( int speed ) : void
speed int speed is between -255 and +255
return void

SetTachoCount() public method

Set Tachometer encoder offset Use this to reset or setup a specific position
public SetTachoCount ( Int32 position ) : void
position System.Int32 New offset, 0 to reset
return void

Start() public method

Start the motor
public Start ( ) : void
return void

Start() public method

Start with the specified speed
public Start ( int speed ) : void
speed int speed is between -255 and +255
return void

Stop() public method

Stop the Motor
public Stop ( ) : void
return void

UpdateSensor() public method

Update the sensor and this will raised an event on the interface
public UpdateSensor ( object state ) : void
state object
return void