# Programming Motors

{% hint style="warning" %}
Modify your OpMode to add the motor related code. For now your completed servo code can be dragged to the side of your work space. You may alternatively choose to create a second program.
{% endhint %}

### What is a Motor?

Just like servos, a motor is a form of actuator. You may picture a dozen different things when you think of a motor, from those used to spin the wheels of a car to the large turbines that allow a plane to fly. For our robots, we will be focusing on DC motors. These are a type of electrical motor that use direct current, or DC, to rotate and produce the mechanical force needed to move an attached mechanism.

{% hint style="info" %}
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.
{% endhint %}

Most standard motors are able to continuously rotate in either direction with an adjustable speed or power. Some motors may also include a built in encoder, which allows them to move to a specified position, similar to a servo, or to collect data like the number of completed rotations!

To access the motor snippets in Blocks we need to look under the **Actuators** dropdown menu:

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2F8LPwwoZop6Lnr4gQ419y%2Fimage.png?alt=media&#x26;token=8a59e81d-7890-4e06-9490-271379b6c4a1" alt=""><figcaption></figcaption></figure>

You may notice there are several options for blocks under the **DcMotor** menu. For Hello Robot we will be using those found in the **DcMotor** menu itself and under **Dual.**

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FCYyXz0X1edWWdvJDormh%2Fimage.png?alt=media&#x26;token=6503ea4c-bf11-4171-8af4-f9f28dc0abc2" alt=""><figcaption></figcaption></figure>

As the name suggests, the blocks found under **Dual** are intended for the use of two motors. We will learn more about them in [Part 2](https://docs.revrobotics.com/duo-control/hello-robot-blocks/part-2)!

{% hint style="info" %}
If you do not see the DcMotor menu under Actuators double check your [configuration ](https://docs.revrobotics.com/duo-control/hello-robot-blocks/configuration)includes a motor and is currently active on the Driver Hub!
{% endhint %}

## Let's get Programming!

In the next few sections, we will be learning to program our motor to first move automatically in different directions then in response to our gamepad inputs. In our final section we will take a look at using telemetry with our motor's built in encoder.

***

| [Programming Motor Basics](https://docs.revrobotics.com/duo-control/hello-robot-blocks/part-1/programming-motors/programming-motors-basics) | [Programming a Motor with a Gamepad](https://docs.revrobotics.com/duo-control/hello-robot-blocks/part-1/programming-motors/programming-a-motor-with-a-gamepad) | [Programming Motor Telemetry](https://docs.revrobotics.com/duo-control/hello-robot-blocks/part-1/programming-motors/programming-motor-telemetry) |
| ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |

Below is a sneak peek of our final full code:

<figure><img src="https://1359443677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUOOiQ4S2QcMWmVoSmeQ8%2Fuploads%2FDeQ4G6tpGK3xFRwgUuGB%2Fmotorfull.png?alt=media&#x26;token=da765ec4-949a-4a79-9173-29e91cb696fd" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revrobotics.com/duo-control/hello-robot-blocks/part-1/programming-motors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
