hybridgroup/artoo-gpio

View on GitHub
docs/commands_motor.md

Summary

Maintainability
Test Coverage
# Commands

## stop 

Stops the motor.

##### Params

`no params`

##### Returns

`true or nil`

## start 

Starts the motor.

##### Params

`no params`

##### Returns

`true or nil`

## on?

Returns true if the motor is on, otherwise returns false.

##### Params

`no params`

##### Returns

`true or false`

## off? 

Returns true if the motor is off, otherwise returns false.

##### Params

`no params`

##### Returns

`true or false`

## toggle 

Sets the state of the motor to the oposite of the current state, if motor is on then sets it to off.

##### Params

`no params`

##### Returns

`true or nil`

## speed(speed_value)

Sets the speed of the motor to the value provided in the speed param, speed value must be an integer between `0` and `255`.

##### Params

- **speed_value** - params, the speed value

##### Returns

`true or nil`

## min 

Stops the motor, sets the speed to `0`.

##### Params

`no params`

##### Returns

`true or nil`

## max 

Starts the motor at max speed, sets the speed to `255`.

##### Params

`no params`

##### Returns

`true or nil`

## forward(speed) 

Starts the motor in forward direction at the provided speed.

##### Params

- **speed** - params, the speed value

##### Returns

`true or nil`

## backward(speed)

Starts the motor in backward direction at the provided speed.

##### Params

- **speed** - params, the speed value

##### Returns

`true or nil`

## forward? 

Returns true if the motor is direction is set to forward, otherwise false.

##### Params

`no params`

##### Returns

`true or false`

## backward? 

Returns true if the motor is direction is set to backward, otherwise false.

##### Params

`no params`

##### Returns

`true or false`

## current_speed 

Returns the current speed of the motor as an integer between `0` and `255`.

##### Params

`no params`

##### Returns

`speed`