Smartcar Shield
Public Member Functions | List of all members
Motor Interface Referenceabstract

#include <Motor.hpp>

Inheritance diagram for Motor:
Inheritance graph
Collaboration diagram for Motor:
Collaboration graph

Public Member Functions

virtual ~Motor ()=default
 
virtual void setSpeed (int speed)=0
 Sets the motor speed and direction as the percentage of the maximum possible speed, where the sign of the argument represents the direction. More...
 

Detailed Description

Interface programmatically representing any kind of motor. Fundamentally, a motor is something you can control the speed and direction of its rotation.

Definition at line 22 of file Motor.hpp.

Constructor & Destructor Documentation

◆ ~Motor()

virtual Motor::~Motor ( )
virtualdefault

Member Function Documentation

◆ setSpeed()

virtual void Motor::setSpeed ( int  speed)
pure virtual

Sets the motor speed and direction as the percentage of the maximum possible speed, where the sign of the argument represents the direction.

Parameters
speedThe speed and direction within the range of [-100, 100]. -100 means that the motor is spinning at full speed towards the direction we have defined as backward. 100 interpreted as full speed forward. 0 means that the motor is at its idle/neutral state.

Example:

motor.setSpeed(0); // Stop the motor

Implemented in BrushedMotor, ServoMotor, and DualMotor.

Here is the caller graph for this function:

The documentation for this interface was generated from the following file: