1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#pragma once
// ============================================================
// NRL.h — student umbrella include
// ============================================================
// One line gives you everything you need:
//
// #include "NRL.h"
//
// Declare your hardware at file-scope (above your class),
// initialise in init(), then use in loop():
//
// static HexaDCMotor leftMotor {{ .dirPin = MOTOR_L_DIR, .pwmPin = MOTOR_L_PWM }};
// static HexaDCMotor rightMotor{{ .dirPin = MOTOR_R_DIR, .pwmPin = MOTOR_R_PWM, .flipped = true }};
// static HexaServo arm {{ .signalPin = SERVO_1, .startAngle = 90.0f }};
// static HexaServo gripper {{ .signalPin = SERVO_2, .startAngle = 15.0f }};
// static HexaIMU imu { hexaImuConfig() }; // on-board IMU (Wire)
// static HexaOLED myOled { hexaOledConfig() }; // on-board OLED (Wire1)
// static TankDrive drive(leftMotor, rightMotor);
// static DriveActions driveActions(drive);
//
// Gamepad (always available, no declaration needed):
// gamepad1.leftY() — axis -1.0 to +1.0
// gamepad1.justPressed(BTN_DPAD_RIGHT) — true on the tick of press
//
// User LED (always available, no declaration needed):
// userLed.setSolid(255, 0, 0) — solid red
// userLed.setBlink(0, 255, 0, 500) — blink green, 500ms period
// userLed.setPulse(0, 0, 255, 1000) — breathe blue, 1s cycle
// userLed.setOff() — turn off
//
// Battery voltage (always available, no declaration needed):
// power.getBatteryVoltage() — robot pack voltage (V)
// power.isBatteryLow() — true when the pack is low
//
// Rail current — read directly from `power` (always available, no declaration
// needed). There is ONE ACS712 per rail, not one per motor/servo, so this is
// the whole rail's current regardless of how many motors/servos you declared:
// power.getMainCurrent() — total battery current (A)
// power.getMotorCurrent() — DC-motor branch current (A)
// power.getServoCurrent() — servo rail current (A, derived: main − motor)
//
// Telemetry:
// telemetry.addData("key", value)
// Hardware types
#include "HexaDCMotor.h" // DC motor driver
#include "HexaServo.h" // servo driver
#include "HexaOLED.h" // 128×64 OLED display
#include "HexaIMU.h" // LSM6DSOX IMU (accel + gyro + heading)
#include "HexaPower.h" // MCP3008 ADC — battery voltage + ACS712 current
#include "TankDrive.h" // differential drive helper
#include "DriveTuning.h" // DriveTuning struct (speed/msPerInch/timeout defaults)
#include "DriveActions.h" // DriveActions — turn(), driveInches(), auto_() chaining
#include "Gamepad.h" // gamepad1 object
// Framework internals
#include "BoardPins.h" // MOTOR_L_DIR, SERVO_1, I2C_SDA … pin constants
#include "RobotConfig.h" // botOled, gamepad1 (framework globals)
#include "NRLGamepad.h" // BTN_X/A/B/Y, BTN_DPAD_*, BTN_RB/LB/LT/RT constants, NRLGamepad raw statics
#include "NRLComms.h" // NRLComms::sendTelemetry("key", value)
#include "NRLAction.h" // instant(), sequential(), parallel(), sleep_ms(), wait_until()
#include "NRLOpMode.h" // NRLOpMode base class, init()/start()/loop()/stop(), runAction()
#include "OpModeRegistry.h" // REGISTER_OPMODE macro
|