Skip to content
CrocoDocs
Starter GuideProgrammingEngineeringDesignPortfolio
Starter Guide
Starter Guide

Start your team

  1. 01FIRST and FTC
  2. 02Starting a team
  3. 03People and meetings
  4. 04Budget and equipment
  5. 05Safety

Build your first robot

  1. 06The game and your strategy
  2. 07Robot parts
  3. 08Your first build
  4. 09Wiring your robot
  5. 10Your first program
  6. 11Autonomous and driving

Design your own parts

  1. 12Your first CAD part
  2. 13CAD assemblies
  3. 14Making parts

Prepare for competition

  1. 15Your notebook and portfolio
  2. 16Outreach and funding
  3. 17Your first event
  4. 18Your season plan
Glossary
Appearance
Starter GuideLesson 10 of 18

Your first program

Try an editable Blocks example, then learn how to run a program on your robot.

A program is a set of instructions for a computer. In , your program reads inputs, such as gamepad buttons or values, and controls outputs, such as power.

lets you assemble those instructions as connected shapes. is a text-based programming language. Both can teach the same basic ideas; Blocks is a useful place to start if your team has never programmed before.

Try a sequence

A sequence is a series of instructions performed in order. In this , a computer model takes the place of a real . You can try code without connecting any hardware.

Press Play. The robot drives forward, pauses, reverses, and stops. The numbers after sleep are milliseconds: 1000 milliseconds is one second.

Find the first sleep block and change 700 to 1400. Press Reset to return the robot to its starting position, then Play again. The forward movement now lasts twice as long. Press Stop to end a run early. If the blocks are too large to see together, use − in the editor to zoom out.

Drive, wait, reverse
Open example in a new tab

Edit the example, then press Play. Reloading this page or changing theme restores the example.

On a narrow screen, use Code to edit and Simulator to watch. The drive function is a named group of instructions that sets the four motors together. The collapsed setup function reverses the right-side motors for this simulated robot. Expand either function below the main stack to inspect it.

A motor command of 0.25 is a low forward power setting on a scale from -1 to 1; a negative number reverses its direction. Power is not a speed in metres per second. Battery charge, load, friction, and the motor all affect how far the robot moves. Equal forward and reverse times do not guarantee it returns exactly to its starting point.

The example uses the simulator's hardware names. Your own robot needs its own configuration and direction checks.

Set up your real robot

Have an adult or experienced team help install the supported and . Use the current FTC setup instructions for your devices. Software means the programs and apps running on them.

Connect the Driver Station to the Robot Controller using the documented robot network. Open the Robot Controller's Program & Manage address in your computer's browser. Use the address shown by your controller, rather than guessing one.

Create and activate a hardware configuration. Add the connected motors with the names from your wiring table. Open the Blocks editor and start from a suitable official sample. A sample is a working example you adapt to your hardware.

Init, Start, and Stop

An is one selectable FTC robot program. It may control driver-operated play or an routine.

  1. Select the OpMode on the Driver Station.
  2. Press to initialize it. Initialize means prepare the program, for example by finding its configured motors.
  3. Check that the test area is clear and the robot is ready.
  4. Press Start to begin the running part.
  5. Press Stop to end it.

On a real robot, Init and Start are separate actions. This embedded simulator's Play control handles its run sequence for the example. Never assume a real is safe to touch during initialization.

Read code a little at a time

A stores a value, such as the drive power. A asks a question, such as whether a button is pressed. A repeats instructions. Driver control normally uses a loop so the robot keeps reading the gamepad and updating its outputs.

Start by changing one value in a sample, then predict and observe what happens. Download your .blk files regularly and save them with the team's work. Blocks programs live on the Robot Controller; a browser bookmark is not a .

Use the Programming setup guides when you are ready to configure devices, write a drive program, or move to Java.

Sources

  • FTC Docs — Blocks programming tutorial
  • FTC Docs — creating a Blocks OpMode
  • FTC Docs — choosing a programming tool
  • Crimson Crocs FTC Simulator

Wiring your robot

Learn the power path, connect each device correctly, and label the connections.

Autonomous and driving

Build a short autonomous routine and practise as a drive team.

On this page

Try a sequenceSet up your real robotInit, Start, and StopRead code a little at a timeSources