Skip to content
johnmeshulam edited this page Nov 6, 2019 · 5 revisions

Overview

There are two motor types: LargeMotor, and MediumMotor. When creating a motor, specify a name (It can be anything!) and the port it is connected to. You can then access and operate on that motor.

Defining motors

To define a new motor, write the following in HardwareCreator

new LargeMotor(String name, char port);
new MediumMotor(String name, char port);

Example:

new LargeMotor("armMotor", 'A');

If your motor is inverted, you can declare so by adding true to the constructor:

new LargeMotor("armMotor", 'A', true);

Accessing motors

To access a motor, call RobotMap.getMotor() with either the name or port:

RobotMap.getMotor("armMotor")
RobotMap.getMotor('A')

This will allow you to use the motor as follows:

RobotMap.getMotor("armMotor").forward(1.0);

General information

Motors have forward(double speed) and backwards(double speed) commands, as well as drive for degrees or seconds. (Similar to the Mindstorms software). A motor's speed is always between 0 and 1 when a direction is specified (i.e. motor.forward() ) or between -1 and 1 when no direction is specified (i.e. motor.rotate(speed, degrees, brake) )

The brake boolean at the end of certain functions specify whether the motor should brake or coast. (Again, similar to Mindstorms)

Clone this wiki locally