> For the complete documentation index, see [llms.txt](https://guides.mccaskeyrobotics.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.mccaskeyrobotics.org/ftc/programming.md).

# Programming

To create a new program click on the + sign which you should find near the top left of your screen.&#x20;

![](/files/rdpHPGgOIglDsoYADXXq)

Name your file. From the Sample code select `BlankLinearOpMode` and make sure to check the `TeleOp` Option.

![](/files/75oXaikUYj2FFzzTDXwt)

After you hit `OK` Your code will look something like this:

```
package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.util.ElapsedTime;

@TeleOp

public class BlankLinearOpMode extends LinearOpMode {


    @Override
    public void runOpMode() {

        telemetry.addData("Status", "Initialized");
        telemetry.update();
        
        // Wait for the game to start (driver presses PLAY)
        waitForStart();

        // run until the end of the match (driver presses STOP)
        while (opModeIsActive()) {
        
            telemetry.addData("Status", "Running");
            telemetry.update();

        }
    }
}
```

## Running your program

At the bottom right of your screen click on the wrench.

![](/files/07vqmn4JG754Ra8dJAa3)

Now open your DS app on your group’s phone and select the right-side dropdown menu. Now choose the program you just built.

Click “Init. You should now see a message on the bottom of the screen that says: “Status: Initialized”.Now click “Play”. You should now see the message on the bottom of the screen that says “Status: Running”.

![](/files/wgmyKzhbfZa3mSNoITDb)

![](/files/sGN9evMndGxpStJgdXQG)

{% hint style="success" %}
Congratulations you just wrote your first program!
{% endhint %}

You robot doesn’t do much yet.. Just send a message to the phone to tell you it’s status. Go ahead and hit the stop button to stop your program.

Before we start programming our drive motors, let’s take a minute to look at the structure of a opMode.

![](/files/9wBUn8DYjnDJQ3dHc5Qe)

This Is a comment. A comment is the code between the `/*` and `*/` symbols. It is just there to help the person writing the code understand what it does. When the robot runs this program it will skip over this section.

{% hint style="info" %}
TIP: If you only need a single line comment you can add two slashes to the begining of that line.

Example:

// Wait for the game to start
{% endhint %}

![](/files/x30GXMFw4twMpRmSlutg)

Here is where we import other code that the robot needs to run. The robot should add these automatically so you do not need to worry about editing this section &#x20;

![](/files/h3kwarKW2eOC5ULkdq9r)

This line of code tells the robot where you have to go to run your program. You have three options for this line. @Autonimous, @TeleOp, and @Disabled. The main difference between Autonomous and TeleOp is that Autonimous had a 30s timer. Disabled will hide your program from the menu and is helpful if you have a lot of programs.

Shown below is where you can find your programs.

![](/files/pa5xqSI98VbxiRkHlL6p)

![](/files/rxeKbQqiNYKrFtAJPuzh)

These line are needed to run your program. Your class name MUST match your file name.&#x20;

Your program must extend eighter `LinearOpMode` or `OpMode`. OpMode is a bit more complicated so for right now just use LinearOpMode.

![](/files/p7cep4OFNUYgdRrEEigA)

telemetry is a way the robot tells you what it is thinking. When you use the code

&#x20;`telemetry.addData("Statius", "Initialized");`

The robot will save the information you gave it until you call&#x20;

`telemetry.update();`

which then sends it to the driver.

![](/files/9T7DJqWeH6rdd0uYQWLK)

This is a while loop it will repeat anything in side the curly braces until the program ends.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://guides.mccaskeyrobotics.org/ftc/programming.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
