The Basics

Where Do We Write Our Code?

 We'll begin by navigating to the correct folder within our project to write our code in. You can start by closing the README.md file, as it's simply a text file with the project's description. Now, on the Android Studio sidebar you can see on the full list of all folders within your project, and you'll do all of your coding in TeamCode/java/org.firstinspires.ftc.teamcode

 Once you reveal the org.firstinspires.ftc.teamcode folder on your sidebar, right click on it, and select New Java Class. Name your new file BasicOpMode_Iterative.java. This will be our file for the TeleOp portion of our game when we can control our robot with a controller. We will code the Autonomous portion of our game later in a separate file.

Necessary Utilities

 You should now be greeted with a blank file (other than the package statement), but before you can start controlling your robot, you need to import the necessary utilities. It's alright if you do not know exactly what this implies yet, but you can think of it like this: The Java programming language provides us with some tools already, but we're grabbing some extra tools to specifically help us with programming the robot. Simply copy the following lines of code into your program:

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.Range;

Program Structure

 Next, copy these lines of code into the program after your import statements.

@TeleOp(name="Basic: Iterative OpMode", group="Iterative Opmode")
public class BasicOpMode_Iterative extends OpMode {

    @Override
    public void init() {
    
    }

    @Override
    public void loop() {
    
    }
}

init and loop are both functions. Functions are blocks of code that can later be executed. The init function is executed upon hitting the Init (initialize) button on your driver phone, and the loop function is executed repeatedly, starting upon pressing the Start button, and ending upon pressing the Stop button.