Example OpModes#
Every example below lives in the driver repository on GitHub, under org/firstinspires/ftc/teamcode/:
Get the driver and examples on GitHub →
Or clone it directly:
git clone https://github.com/BuildingBlockRobotics/DigitalExpander.git
Copy the ones you want into your project. They all expect the device to be named expander in the robot configuration — if you named yours something else, change that string.
Start here#
| OpMode | What it shows |
|---|---|
BBRSensorDumpTest |
Every live value in one transaction — the fastest way to check your wiring |
BBRColorClassExample |
Reading colour classes and confidence, the primary sensor interface |
BBREncoderExample |
Counts, firmware velocities, idempotent resets |
Colour#
| OpMode | What it shows |
|---|---|
BBRTeachColorExample |
Teach-by-example from a gamepad button, saving to flash |
BBRThreeColorExample |
The full three-colour season pattern, one pin per colour |
BBRColorTriggerSetup |
Setting up a colour-driven digital output |
BBRColorLatchExample |
Latched outputs — catching an event too brief for your loop |
Distance#
| OpMode | What it shows |
|---|---|
BBRDistanceTriggerSetup |
The canonical setup-once trigger configuration |
BBRDistanceTriggerRuntime |
The match half: a stock DigitalChannel, zero I2C |
Read these two together. They are the clearest demonstration of what the board is for — the setup OpMode runs once and is then never needed again, and the runtime OpMode has no idea the Expander exists.
Encoders#
| OpMode | What it shows |
|---|---|
BBRPwmEncoderExample |
Absolute pulse-width encoders, wrap tracking |
BBREncoderTriggerExample |
Driving an output from an encoder threshold |
Heading and odometry#
| OpMode | What it shows |
|---|---|
BBRImuHeadingExample |
Heading, gyro calibration, failing loudly on an untrustworthy gyro |
BBRHeadingTriggerExample |
Driving an output from heading, including the ±180 wrap |
BBRLocalizerExample |
Full pose tracking: params, calibration, live pose, re-zeroing |
Diagnostics#
| OpMode | What it shows |
|---|---|
BBRLineProbeTest |
Bench-testing a sensor against a line |
BBRSensorDumpTest |
Complete state dump, useful whenever something is unclear |
A note on the examples#
They are written to be read as much as run. Where an example catches an exception or checks a status flag, that is showing you something worth copying — particularly the BBRTransportException handling in the IMU and localizer examples, which is what keeps a normal OpMode shutdown from looking like a hardware fault.