⚡ Chapter 4: Motors

Visual Blocks Examples
Set motor power (full forward)
set motor1 .power to 1
Stop motor
set motor1 .power to 0
Reverse motor direction
set motor1 .direction to REVERSE
Motor controlled by gamepad
Set motor power from right joystick Y
repeat while opModeIsActive
set motor1 .power to gamepad1.right_stick_y
telemetry.update
Blocks Guide

Programming Motors

Programming Motors

Overview

Motors are actuators comparable to servos. For FTC robots, the focus is on DC motors that use direct current to rotate and produce mechanical force. Most standard motors are able to continuously rotate in either direction with an adjustable speed or power.

For this tutorial, either a Core Hex Motor or HD Hex Motor may be used as long as they have been properly configured on the Driver Hub.

Some motors include built-in encoders for position tracking or rotation data collection.

Motor blocks are located in the Blocks interface under the Actuators dropdown menu, specifically within the DcMotor section and a Dual submenu for dual-motor operations.

Structure

The page organizes content around three progressive topics:

  • Programming Motor Basics
  • Programming a Motor with a Gamepad
  • Programming Motor Telemetry
  • Users should have completed servo programming first and have an active motor configuration on their Driver Hub.

    The tutorial progresses from automatic motor movement through gamepad-controlled operation to implementing encoder-based telemetry.

    Level Up: OnBot Java versions

    Programming Motors (Java)

    Programming Motors - OnBot Java

    Modify your OpMode to add the motor related code. For now your completed servo code can be commented out.

    Just like servos, a motor is a form of actuator. DC motors use direct current to rotate and produce mechanical force for robot mechanisms.

    For this tutorial, either a Core Hex Motor or HD Hex Motor may be used as long as they have been properly configured on the Driver Hub.

    Standard motors can continuously rotate in either direction with adjustable speed. Some motors include built-in encoders enabling position-specific movement similar to servos or data collection on rotation counts.

    Structure

    The tutorial covers three progressive learning stages:

  • Programming Motor Basics
  • Programming a Motor with a Gamepad
  • Programming Motor Telemetry
  • The Java code demonstrates motor initialization through hardwareMap, servo positioning, and motor power control using gamepad input with telemetry feedback for monitoring motor power status.

    ← 🔧 Servos📡 Sensors →